jodit 4.15.17 → 4.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +12 -11
  4. package/es2015/jodit.js +198 -80
  5. package/es2015/jodit.min.js +12 -11
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +11 -10
  13. package/es2018/jodit.min.js +12 -11
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +15 -14
  18. package/es2021/jodit.js +196 -80
  19. package/es2021/jodit.min.js +17 -16
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +15 -14
  28. package/es2021.en/jodit.js +196 -80
  29. package/es2021.en/jodit.min.js +15 -14
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +258 -116
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/config.d.ts +23 -0
  51. package/esm/config.js +21 -0
  52. package/esm/core/constants.js +1 -1
  53. package/esm/core/helpers/utils/align.d.ts +8 -3
  54. package/esm/core/helpers/utils/align.js +40 -2
  55. package/esm/core/selection/selection.js +5 -0
  56. package/esm/core/ui/button/button/button.js +10 -4
  57. package/esm/core/ui/form/inputs/file/file.js +1 -0
  58. package/esm/core/ui/group/group.d.ts +4 -0
  59. package/esm/core/ui/group/group.js +5 -1
  60. package/esm/core/ui/group/list.js +2 -2
  61. package/esm/modules/dialog/dialog.js +7 -0
  62. package/esm/modules/toolbar/button/content.d.ts +7 -0
  63. package/esm/modules/toolbar/button/content.js +9 -1
  64. package/esm/plugins/image-properties/readers/align.d.ts +5 -1
  65. package/esm/plugins/image-properties/readers/align.js +4 -18
  66. package/esm/plugins/image-properties/readers/index.js +1 -1
  67. package/esm/plugins/image-properties/writers/index.js +1 -1
  68. package/esm/plugins/inline-popup/config/items/img.js +17 -2
  69. package/esm/plugins/source/editor/engines/ace.js +13 -6
  70. package/esm/plugins/source/source.js +20 -1
  71. package/esm/types/types.d.ts +4 -0
  72. package/package.json +1 -1
  73. package/types/config.d.ts +23 -0
  74. package/types/core/helpers/utils/align.d.ts +8 -3
  75. package/types/core/ui/group/group.d.ts +4 -0
  76. package/types/modules/toolbar/button/content.d.ts +7 -0
  77. package/types/plugins/image-properties/readers/align.d.ts +5 -1
  78. package/types/types/types.d.ts +4 -0
package/es2015/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.15.17
4
+ * Version: v4.16.0
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -728,6 +728,25 @@ let ConfigPrototype = {};
728
728
  /**
729
729
  * Default width (in pixels) applied to images inserted into the editor
730
730
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "imageDefaultWidth", 300);
731
+ /**
732
+ * Alignment given to images inserted into the editor. `'normal'` leaves
733
+ * them unaligned
734
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "imageDefaultAlign", 'normal');
735
+ /**
736
+ * Class names to align images with, instead of an inline `float` or
737
+ * `margin`. Aligning an image removes every class listed here and adds the
738
+ * chosen alignment's, which can be several separated by spaces.
739
+ *
740
+ * ```javascript
741
+ * Jodit.make('#editor', {
742
+ * imageAlignClasses: {
743
+ * left: 'align-left',
744
+ * right: 'align-right',
745
+ * center: 'align-center'
746
+ * }
747
+ * });
748
+ * ```
749
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "imageAlignClasses", null);
731
750
  /**
732
751
  * Do not display these buttons that are on the list
733
752
  *
@@ -1786,7 +1805,7 @@ __webpack_require__.r(__webpack_exports__);
1786
1805
  * ```
1787
1806
  * @packageDocumentation
1788
1807
  * @module constants
1789
- */ const APP_VERSION = "4.15.17";
1808
+ */ const APP_VERSION = "4.16.0";
1790
1809
  // prettier-ignore
1791
1810
  const ES = "es2015";
1792
1811
  const IS_ES_MODERN = true;
@@ -7562,6 +7581,7 @@ function trimChars(value, chars) {
7562
7581
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7563
7582
  /* harmony export */ alignElement: function() { return /* binding */ alignElement; },
7564
7583
  /* harmony export */ clearAlign: function() { return /* binding */ clearAlign; },
7584
+ /* harmony export */ getHAlign: function() { return /* binding */ getHAlign; },
7565
7585
  /* harmony export */ hAlignElement: function() { return /* binding */ hAlignElement; }
7566
7586
  /* harmony export */ });
7567
7587
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
@@ -7576,9 +7596,26 @@ function trimChars(value, chars) {
7576
7596
  */
7577
7597
 
7578
7598
 
7599
+ const classNames = (value)=>(value !== null && value !== void 0 ? value : '').split(/\s+/).filter(Boolean);
7579
7600
  /**
7580
- * Align image
7581
- */ function hAlignElement(image, align) {
7601
+ * Align image, with `classes` (see `imageAlignClasses`) instead of inline
7602
+ * styles when they are given
7603
+ */ function hAlignElement(image, align, classes) {
7604
+ if (classes) {
7605
+ hAlignElement(image, 'normal');
7606
+ Object.values(classes).forEach((value)=>image.classList.remove(...classNames(value)));
7607
+ image.classList.add(...classNames(classes[align || 'normal']));
7608
+ [
7609
+ 'class',
7610
+ 'style'
7611
+ ].forEach((name)=>{
7612
+ var _attr;
7613
+ if (!((_attr = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, name)) === null || _attr === void 0 ? void 0 : _attr.trim())) {
7614
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, name, null);
7615
+ }
7616
+ });
7617
+ return;
7618
+ }
7582
7619
  if (align && align !== 'normal') {
7583
7620
  if (align !== 'center') {
7584
7621
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float', align);
@@ -7601,6 +7638,31 @@ function trimChars(value, chars) {
7601
7638
  ;(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.clearCenterAlign)(image);
7602
7639
  }
7603
7640
  }
7641
+ /**
7642
+ * The alignment `hAlignElement` has set on an element
7643
+ */ function getHAlign(elm, classes) {
7644
+ if (classes) {
7645
+ for (const align of [
7646
+ 'left',
7647
+ 'right',
7648
+ 'center',
7649
+ 'normal'
7650
+ ]){
7651
+ const names = classNames(classes[align]);
7652
+ if (names.length && names.every((name)=>elm.classList.contains(name))) {
7653
+ return align;
7654
+ }
7655
+ }
7656
+ }
7657
+ const float = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(elm, 'float').toLowerCase();
7658
+ if (float === 'left' || float === 'right') {
7659
+ return float;
7660
+ }
7661
+ if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(elm, 'display') === 'block' && (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(elm, 'margin-left') === 'auto' && (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(elm, 'margin-right') === 'auto') {
7662
+ return 'center';
7663
+ }
7664
+ return 'normal';
7665
+ }
7604
7666
  /**
7605
7667
  * Remove text-align style for all selected children
7606
7668
  */ function clearAlign(node) {
@@ -8764,6 +8826,7 @@ __webpack_require__.r(__webpack_exports__);
8764
8826
  /* harmony export */ get: function() { return /* reexport safe */ _get__WEBPACK_IMPORTED_MODULE_15__.get; },
8765
8827
  /* harmony export */ getClassName: function() { return /* reexport safe */ _get_class_name__WEBPACK_IMPORTED_MODULE_16__.getClassName; },
8766
8828
  /* harmony export */ getDataTransfer: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.getDataTransfer; },
8829
+ /* harmony export */ getHAlign: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.getHAlign; },
8767
8830
  /* harmony export */ getPropertyDescriptor: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.getPropertyDescriptor; },
8768
8831
  /* harmony export */ getXPathByElement: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_24__.getXPathByElement; },
8769
8832
  /* harmony export */ hAlignElement: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.hAlignElement; },
@@ -8794,7 +8857,7 @@ __webpack_require__.r(__webpack_exports__);
8794
8857
  /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28712);
8795
8858
  /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_assert__WEBPACK_IMPORTED_MODULE_2__);
8796
8859
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
8797
- /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _assert__WEBPACK_IMPORTED_MODULE_2__) if(["default","alignElement","clearAlign","hAlignElement","alreadyLoadedList","appendScriptAsync","appendStyleAsync","loadNext","loadNextStyle"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = function(key) { return _assert__WEBPACK_IMPORTED_MODULE_2__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
8860
+ /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _assert__WEBPACK_IMPORTED_MODULE_2__) if(["default","alignElement","clearAlign","getHAlign","hAlignElement","alreadyLoadedList","appendScriptAsync","appendStyleAsync","loadNext","loadNextStyle"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = function(key) { return _assert__WEBPACK_IMPORTED_MODULE_2__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
8798
8861
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
8799
8862
  /* harmony import */ var _attr__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7909);
8800
8863
  /* harmony import */ var _browser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26136);
@@ -10721,11 +10784,12 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
10721
10784
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
10722
10785
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
10723
10786
  /* harmony import */ var jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(28686);
10724
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(28712);
10725
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_7__);
10726
- /* harmony import */ var jodit_core_selection_helpers_move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(7470);
10727
- /* harmony import */ var _style_commit_style__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(84578);
10728
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(42259);
10787
+ /* harmony import */ var jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(16849);
10788
+ /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(28712);
10789
+ /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8__);
10790
+ /* harmony import */ var jodit_core_selection_helpers_move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(7470);
10791
+ /* harmony import */ var _style_commit_style__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(84578);
10792
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(42259);
10729
10793
  /*!
10730
10794
  * Jodit Editor (https://xdsoft.net/jodit/)
10731
10795
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -10747,6 +10811,7 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
10747
10811
 
10748
10812
 
10749
10813
 
10814
+
10750
10815
  class Selection {
10751
10816
  /**
10752
10817
  * Short alias for this.jodit
@@ -11187,7 +11252,7 @@ class Selection {
11187
11252
  return node;
11188
11253
  }
11189
11254
  if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node)) {
11190
- const ret = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.findCorrectCurrentNode)(node, range, rightMode, sel.isCollapsed, checkChild, child);
11255
+ const ret = (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.findCorrectCurrentNode)(node, range, rightMode, sel.isCollapsed, checkChild, child);
11191
11256
  node = ret.node;
11192
11257
  rightMode = ret.rightMode;
11193
11258
  }
@@ -11331,6 +11396,10 @@ class Selection {
11331
11396
  if (styles && typeof styles === 'object') {
11332
11397
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.css)(image, styles);
11333
11398
  }
11399
+ const { imageDefaultAlign, imageAlignClasses } = this.j.o;
11400
+ if (imageDefaultAlign && imageDefaultAlign !== 'normal') {
11401
+ (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_7__.hAlignElement)(image, imageDefaultAlign, imageAlignClasses);
11402
+ }
11334
11403
  const onload = ()=>{
11335
11404
  if (image.naturalHeight < image.offsetHeight || image.naturalWidth < image.offsetWidth) {
11336
11405
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.css)(image, {
@@ -11455,7 +11524,7 @@ class Selection {
11455
11524
  const isSignificant = (elm)=>Boolean(elm && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(elm, 'br') && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(elm) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTemporary(elm) && !(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(elm) && this.j.e.fire('isInvisibleForCursor', elm) === true));
11456
11525
  // check right offset
11457
11526
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(container)) {
11458
- if ((0,_helpers__WEBPACK_IMPORTED_MODULE_10__.cursorInTheEdgeOfString)(container, offset, start, end)) {
11527
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_11__.cursorInTheEdgeOfString)(container, offset, start, end)) {
11459
11528
  return false;
11460
11529
  }
11461
11530
  } else {
@@ -11850,8 +11919,8 @@ class Selection {
11850
11919
  * }) // will remove `color:red` from `span`
11851
11920
  * ```
11852
11921
  */ commitStyle(options) {
11853
- ;(0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_7__.assert)((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.size)(options) > 0, 'Need to pass at least one option');
11854
- const styleElm = new _style_commit_style__WEBPACK_IMPORTED_MODULE_9__.CommitStyle(options);
11922
+ ;(0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8__.assert)((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.size)(options) > 0, 'Need to pass at least one option');
11923
+ const styleElm = new _style_commit_style__WEBPACK_IMPORTED_MODULE_10__.CommitStyle(options);
11855
11924
  styleElm.apply(this.j);
11856
11925
  }
11857
11926
  /**
@@ -11901,7 +11970,7 @@ class Selection {
11901
11970
  }
11902
11971
  const fragment = leftRange.extractContents();
11903
11972
  const clearEmpties = (node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.each(node, (node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(node) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeRemove(node));
11904
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(currentBox.parentNode, 'Splitting fails');
11973
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8__.assert)(currentBox.parentNode, 'Splitting fails');
11905
11974
  try {
11906
11975
  clearEmpties(fragment);
11907
11976
  clearEmpties(currentBox);
@@ -11954,7 +12023,7 @@ class Selection {
11954
12023
  const r = range.cloneRange();
11955
12024
  r.collapse(start);
11956
12025
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeInsertNode(r, fake);
11957
- (0,jodit_core_selection_helpers_move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_8__.moveTheNodeAlongTheEdgeOutward)(fake, start, this.j.editor);
12026
+ (0,jodit_core_selection_helpers_move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_9__.moveTheNodeAlongTheEdgeOutward)(fake, start, this.j.editor);
11958
12027
  return fake;
11959
12028
  };
11960
12029
  const leftFake = moveMaxEdgeFake(true);
@@ -14368,6 +14437,7 @@ class UIButton extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_11__.UIEle
14368
14437
  this.name = this.state.name;
14369
14438
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_10__.attr)(this.container, 'data-ref', this.state.name);
14370
14439
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_10__.attr)(this.container, 'ref', this.state.name);
14440
+ this.updateAriaLabel();
14371
14441
  }
14372
14442
  onChangeTooltip() {
14373
14443
  const i8nTooltip = this.state.tooltip ? this.jodit.i18n(this.state.tooltip) : null;
@@ -14379,9 +14449,12 @@ class UIButton extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_11__.UIEle
14379
14449
  }
14380
14450
  updateAriaLabel() {
14381
14451
  const hasText = this.state.text.trim().length > 0;
14382
- const i8nTooltip = this.state.tooltip ? this.jodit.i18n(this.state.tooltip) : null;
14383
- (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_10__.attr)(this.container, 'aria-label', i8nTooltip);
14384
- (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_10__.attr)(this.button, 'aria-label', !hasText ? i8nTooltip : null);
14452
+ // An icon-only button without a tooltip would have no accessible
14453
+ // name at all — fall back to its raw name (not translated: control
14454
+ // names are identifiers, not i18n keys).
14455
+ const label = this.state.tooltip ? this.jodit.i18n(this.state.tooltip) : !hasText && this.state.name ? this.state.name : null;
14456
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_10__.attr)(this.container, 'aria-label', label);
14457
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_10__.attr)(this.button, 'aria-label', !hasText ? label : null);
14385
14458
  }
14386
14459
  onChangeTabIndex() {
14387
14460
  ;(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_10__.attr)(this.container, 'tabindex', this.state.tabIndex);
@@ -15409,6 +15482,7 @@ class UIFileInput extends jodit_core_ui_form_inputs_input_input__WEBPACK_IMPORTE
15409
15482
  return this.j.create.fromHTML(`<input
15410
15483
  type="file"
15411
15484
  accept="${options.onlyImages ? 'image/*' : '*'}"
15485
+ aria-label="${this.j.i18n(options.tooltip || 'Upload')}"
15412
15486
  tabindex="-1"
15413
15487
  dir="auto"
15414
15488
  multiple=""
@@ -15913,9 +15987,12 @@ class UIGroup extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_6__.UIEleme
15913
15987
  className() {
15914
15988
  return 'UIGroup';
15915
15989
  }
15916
- getRole() {
15990
+ /**
15991
+ * A generic container: `group` allows any children. Toolbar button groups
15992
+ * are lists of `listitem`s and get `role="list"` explicitly from `UIList`.
15993
+ */ getRole() {
15917
15994
  var _this_options;
15918
- return ((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.role) || 'list';
15995
+ return ((_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.role) || 'group';
15919
15996
  }
15920
15997
  /**
15921
15998
  * All group children
@@ -16119,10 +16196,10 @@ class UIList extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_8__.UIGr
16119
16196
  }
16120
16197
  /**
16121
16198
  * Make new group and append it in list of elements
16122
- */ makeGroup(role) {
16123
- return new jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_8__.UIGroup(this.jodit, [], role ? {
16199
+ */ makeGroup(role = 'list') {
16200
+ return new jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_8__.UIGroup(this.jodit, [], {
16124
16201
  role
16125
- } : undefined);
16202
+ });
16126
16203
  }
16127
16204
  /**
16128
16205
  * All buttons from list
@@ -19209,13 +19286,14 @@ ContextMenu = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorat
19209
19286
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(28077);
19210
19287
  /* harmony import */ var jodit_core_helpers_array__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(45664);
19211
19288
  /* harmony import */ var jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(28686);
19212
- /* harmony import */ var jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(93640);
19213
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(28712);
19214
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_12__);
19215
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(4099);
19216
- /* harmony import */ var jodit_core_view_view__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(35099);
19217
- /* harmony import */ var jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(2222);
19218
- /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(5266);
19289
+ /* harmony import */ var jodit_core_helpers_html_strip_tags__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(22852);
19290
+ /* harmony import */ var jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(93640);
19291
+ /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(28712);
19292
+ /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_13__);
19293
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(4099);
19294
+ /* harmony import */ var jodit_core_view_view__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(35099);
19295
+ /* harmony import */ var jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(2222);
19296
+ /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(5266);
19219
19297
  /*!
19220
19298
  * Jodit Editor (https://xdsoft.net/jodit/)
19221
19299
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -19240,7 +19318,8 @@ ContextMenu = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorat
19240
19318
 
19241
19319
 
19242
19320
 
19243
- jodit_config__WEBPACK_IMPORTED_MODULE_16__.Config.prototype.dialog = {
19321
+
19322
+ jodit_config__WEBPACK_IMPORTED_MODULE_17__.Config.prototype.dialog = {
19244
19323
  namespace: '',
19245
19324
  extraButtons: [],
19246
19325
  /**
@@ -19256,7 +19335,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_16__.Config.prototype.dialog = {
19256
19335
  toolbarButtonSize: 'middle',
19257
19336
  zIndex: 'inherit'
19258
19337
  };
19259
- jodit_config__WEBPACK_IMPORTED_MODULE_16__.Config.prototype.controls.dialog = {
19338
+ jodit_config__WEBPACK_IMPORTED_MODULE_17__.Config.prototype.controls.dialog = {
19260
19339
  close: {
19261
19340
  icon: 'cancel',
19262
19341
  exec: (dialog)=>{
@@ -19264,7 +19343,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_16__.Config.prototype.controls.dialog = {
19264
19343
  }
19265
19344
  }
19266
19345
  };
19267
- class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_15__.ViewWithToolbar {
19346
+ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_16__.ViewWithToolbar {
19268
19347
  /** @override */ className() {
19269
19348
  return 'Dialog';
19270
19349
  }
@@ -19328,8 +19407,8 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19328
19407
  this.draggable = true;
19329
19408
  this.startX = e.clientX;
19330
19409
  this.startY = e.clientY;
19331
- this.startPoint.x = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__.css)(this.dialog, 'left');
19332
- this.startPoint.y = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__.css)(this.dialog, 'top');
19410
+ this.startPoint.x = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.css)(this.dialog, 'left');
19411
+ this.startPoint.y = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.css)(this.dialog, 'top');
19333
19412
  this.setMaxZIndex();
19334
19413
  if (e.cancelable) {
19335
19414
  e.preventDefault();
@@ -19419,7 +19498,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19419
19498
  if (h == null) {
19420
19499
  h = this.dialog.offsetHeight;
19421
19500
  }
19422
- ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__.css)(this.dialog, {
19501
+ ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.css)(this.dialog, {
19423
19502
  width: w,
19424
19503
  height: h
19425
19504
  });
@@ -19453,7 +19532,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19453
19532
  this.moved = Math.abs(x - left) > 100 || Math.abs(y - top) > 100;
19454
19533
  }
19455
19534
  // strings on purpose: `css()` would truncate fractional pixels
19456
- ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__.css)(this.dialog, {
19535
+ ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.css)(this.dialog, {
19457
19536
  left: (x || left) + 'px',
19458
19537
  top: (y || top) + 'px'
19459
19538
  });
@@ -19473,6 +19552,12 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19473
19552
  * ```
19474
19553
  */ setHeader(content) {
19475
19554
  this.setElements(this.dialogbox_header, content);
19555
+ // `role="dialog"` needs an accessible name; a text title is the
19556
+ // natural one (element titles are left to the caller).
19557
+ if ((0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_10__.isString)(content)) {
19558
+ const name = (0,jodit_core_helpers_html_strip_tags__WEBPACK_IMPORTED_MODULE_11__.stripTags)(content, this.od).trim();
19559
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.attr)(this.container, 'aria-label', name || null);
19560
+ }
19476
19561
  return this;
19477
19562
  }
19478
19563
  /**
@@ -19526,7 +19611,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19526
19611
  /**
19527
19612
  * Get zIndex from dialog
19528
19613
  */ getZIndex() {
19529
- return parseInt((0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__.css)(this.container, 'zIndex'), 10) || 0;
19614
+ return parseInt((0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.css)(this.container, 'zIndex'), 10) || 0;
19530
19615
  }
19531
19616
  /**
19532
19617
  * Get dialog instance with maximum z-index displaying it on top of all the dialog boxes
@@ -19549,7 +19634,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19549
19634
  this.__openedSiblings().forEach((dialog)=>{
19550
19635
  maxZIndex = Math.max(dialog.getZIndex(), maxZIndex);
19551
19636
  });
19552
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__.css)(this.container, 'zIndex', (maxZIndex + 1).toString());
19637
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.css)(this.container, 'zIndex', (maxZIndex + 1).toString());
19553
19638
  }
19554
19639
  /**
19555
19640
  * Expands the dialog on full browser window
@@ -19599,7 +19684,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19599
19684
  this.setPosition(this.offsetX, this.offsetY);
19600
19685
  this.setMaxZIndex();
19601
19686
  } else {
19602
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__.css)(this.container, 'zIndex', null);
19687
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.css)(this.container, 'zIndex', null);
19603
19688
  }
19604
19689
  if (this.o.fullsize) {
19605
19690
  this.toggleFullSize(true);
@@ -19713,7 +19798,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19713
19798
  * True, if dialog was opened
19714
19799
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isOpened", false);
19715
19800
  const self1 = this;
19716
- self1.options = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__.ConfigProto)(options, (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__.ConfigProto)(jodit_config__WEBPACK_IMPORTED_MODULE_16__.Config.prototype.dialog, Dialog.defaultOptions));
19801
+ self1.options = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.ConfigProto)(options, (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.ConfigProto)(jodit_config__WEBPACK_IMPORTED_MODULE_17__.Config.prototype.dialog, Dialog.defaultOptions));
19717
19802
  // Attach event handlers passed via `options.events` to the dialog's own
19718
19803
  // emitter (as FileBrowser already does), so a consumer — e.g. a plugin
19719
19804
  // forwarding the editor's `events` config — can observe `afterOpen` /
@@ -19731,40 +19816,40 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19731
19816
  </div>
19732
19817
  <div class="${n('content')}"></div>
19733
19818
  <div class="${n('footer')}"></div>
19734
- <div class="${n('resizer')}">${jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.Icon.get('resize_handler')}</div>
19819
+ <div class="${n('resizer')}">${jodit_core_ui__WEBPACK_IMPORTED_MODULE_14__.Icon.get('resize_handler')}</div>
19735
19820
  </div>
19736
19821
  </div>`);
19737
19822
  if (self1.options.direction === 'rtl') {
19738
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__.css)(self1.container, 'direction', 'rtl');
19739
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__.attr)(self1.container, 'dir', 'rtl');
19823
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.css)(self1.container, 'direction', 'rtl');
19824
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.attr)(self1.container, 'dir', 'rtl');
19740
19825
  }
19741
19826
  if (this.o.zIndex) {
19742
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__.css)(this.container, 'zIndex', this.o.zIndex.toString());
19827
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.css)(this.container, 'zIndex', this.o.zIndex.toString());
19743
19828
  }
19744
- ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__.attr)(self1.container, 'role', 'dialog');
19829
+ ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.attr)(self1.container, 'role', 'dialog');
19745
19830
  Object.defineProperty(self1.container, 'component', {
19746
19831
  value: this
19747
19832
  });
19748
19833
  self1.setMod('theme', self1.o.theme || 'default').setMod('resizable', Boolean(self1.o.resizable));
19749
19834
  const dialog = self1.getElm('panel');
19750
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_12__.assert)(dialog != null, 'Panel element does not exist');
19835
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_13__.assert)(dialog != null, 'Panel element does not exist');
19751
19836
  const resizer = self1.getElm('resizer');
19752
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_12__.assert)(resizer != null, 'Resizer element does not exist');
19837
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_13__.assert)(resizer != null, 'Resizer element does not exist');
19753
19838
  const dialogbox_header = self1.getElm('header-title');
19754
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_12__.assert)(dialogbox_header != null, 'header-title element does not exist');
19839
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_13__.assert)(dialogbox_header != null, 'header-title element does not exist');
19755
19840
  const dialogbox_content = self1.getElm('content');
19756
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_12__.assert)(dialogbox_content != null, 'Content element does not exist');
19841
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_13__.assert)(dialogbox_content != null, 'Content element does not exist');
19757
19842
  const dialogbox_footer = self1.getElm('footer');
19758
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_12__.assert)(dialogbox_footer != null, 'Footer element does not exist');
19843
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_13__.assert)(dialogbox_footer != null, 'Footer element does not exist');
19759
19844
  const dialogbox_toolbar = self1.getElm('header-toolbar');
19760
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_12__.assert)(dialogbox_toolbar != null, 'header-toolbar element does not exist');
19845
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_13__.assert)(dialogbox_toolbar != null, 'header-toolbar element does not exist');
19761
19846
  this.dialog = dialog;
19762
19847
  this.resizer = resizer;
19763
19848
  this.dialogbox_header = dialogbox_header;
19764
19849
  this.dialogbox_content = dialogbox_content;
19765
19850
  this.dialogbox_footer = dialogbox_footer;
19766
19851
  this.dialogbox_toolbar = dialogbox_toolbar;
19767
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_11__.css)(self1.dialog, {
19852
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_12__.css)(self1.dialog, {
19768
19853
  maxWidth: self1.options.maxWidth,
19769
19854
  minHeight: self1.options.minHeight,
19770
19855
  minWidth: self1.options.minWidth
@@ -19777,7 +19862,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19777
19862
  this.e.on(self1.container, 'close_dialog', self1.close).on(this.ow, 'keydown', this.__onEsc).on(this.ow, 'resize', this.__onResize);
19778
19863
  if (this.o.closeOnClickOverlay) {
19779
19864
  const overlay = self1.getElm('overlay');
19780
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_12__.assert)(overlay != null, 'Overlay element does not exist');
19865
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_13__.assert)(overlay != null, 'Overlay element does not exist');
19781
19866
  this.e.on(overlay, 'click', self1.close);
19782
19867
  }
19783
19868
  }
@@ -19786,7 +19871,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19786
19871
  * Registry of the currently opened dialogs. Replaces a DOM scan of the
19787
19872
  * whole `destination` (usually `document.body`) for every z-index update.
19788
19873
  */ ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(Dialog, "__opened", new Set());
19789
- (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(Dialog, "defaultOptions", (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_2__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_1__._)({}, jodit_core_view_view__WEBPACK_IMPORTED_MODULE_14__.View.defaultOptions), {
19874
+ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(Dialog, "defaultOptions", (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_2__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_1__._)({}, jodit_core_view_view__WEBPACK_IMPORTED_MODULE_15__.View.defaultOptions), {
19790
19875
  closeOnClickOverlay: false,
19791
19876
  closeOnEsc: true
19792
19877
  }));
@@ -24963,6 +25048,13 @@ class ToolbarContent extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__.U
24963
25048
  /** @override */ className() {
24964
25049
  return 'ToolbarContent';
24965
25050
  }
25051
+ /** A toolbar item like `ToolbarButton`: the parent group is a `list`. */ getRole() {
25052
+ return 'listitem';
25053
+ }
25054
+ /**
25055
+ * Arbitrary content is not a toggle button — `aria-pressed` is not
25056
+ * allowed on a `listitem`.
25057
+ */ onChangeActivated() {}
24966
25058
  /** @override */ update() {
24967
25059
  var _control_isDisabled, _control_isActive, _control_update;
24968
25060
  const { control } = this;
@@ -25003,7 +25095,6 @@ class ToolbarContent extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__.U
25003
25095
  constructor(jodit, control, target = null){
25004
25096
  super(jodit), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "control", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "target", void 0), this.control = control, this.target = target;
25005
25097
  this.container.classList.add(`${this.componentName}_${this.clearName(control.name)}`);
25006
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.attr)(this.container, 'role', 'content');
25007
25098
  }
25008
25099
  }
25009
25100
  ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
@@ -33718,7 +33809,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('imageProperties
33718
33809
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
33719
33810
  /* harmony export */ readAlign: function() { return /* binding */ readAlign; }
33720
33811
  /* harmony export */ });
33721
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80991);
33812
+ /* harmony import */ var jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16849);
33722
33813
  /*!
33723
33814
  * Jodit Editor (https://xdsoft.net/jodit/)
33724
33815
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -33728,20 +33819,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('imageProperties
33728
33819
  */
33729
33820
  /**
33730
33821
  * @private
33731
- */ function readAlign(image, values) {
33732
- // Align
33733
- if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'float') && [
33734
- 'left',
33735
- 'right'
33736
- ].indexOf((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'float').toLowerCase()) !== -1) {
33737
- values.align = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, 'float');
33738
- } else {
33739
- if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, 'display') === 'block' && (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'margin-left') === 'auto' && (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'margin-right') === 'auto') {
33740
- values.align = 'center';
33741
- } else {
33742
- values.align = '';
33743
- }
33744
- }
33822
+ */ function readAlign(image, values, classes) {
33823
+ const align = (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_0__.getHAlign)(image, classes);
33824
+ values.align = align === 'normal' ? '' : align;
33745
33825
  }
33746
33826
 
33747
33827
 
@@ -33780,7 +33860,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('imageProperties
33780
33860
  */ function readValuesFromImage(j, state) {
33781
33861
  return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function*() {
33782
33862
  const { sourceImage: image, values } = state;
33783
- (0,_align__WEBPACK_IMPORTED_MODULE_3__.readAlign)(image, values);
33863
+ (0,_align__WEBPACK_IMPORTED_MODULE_3__.readAlign)(image, values, j.o.imageAlignClasses);
33784
33864
  // Border radius
33785
33865
  values.borderRadius = parseInt((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(image, 'border-radius') || '0', 10) || 0;
33786
33866
  // Id
@@ -34832,7 +34912,7 @@ UIImagePositionTab = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__
34832
34912
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'id', id || null);
34833
34913
  }
34834
34914
  if (opt.image.editAlign) {
34835
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align);
34915
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align, j.o.imageAlignClasses);
34836
34916
  }
34837
34917
  }
34838
34918
 
@@ -35675,6 +35755,10 @@ const cmd = (control)=>control.args && (0,jodit_core_helpers_checker__WEBPACK_IM
35675
35755
 
35676
35756
 
35677
35757
 
35758
+ // Images align with `imageAlignClasses`; the wrappers of iframes and media
35759
+ // keep inline styles
35760
+ const alignClasses = (editor, elm)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, 'img') ? editor.o.imageAlignClasses : null;
35761
+ const currentAlign = (editor, elm)=>elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getHAlign)(elm, alignClasses(editor, elm)) : 'normal';
35678
35762
  const align = {
35679
35763
  name: 'left',
35680
35764
  childTemplate: (_, __, value)=>value,
@@ -35684,6 +35768,16 @@ const align = {
35684
35768
  'Center',
35685
35769
  'Normal'
35686
35770
  ],
35771
+ update: (editor, button)=>{
35772
+ const current = currentAlign(editor, button.target);
35773
+ button.state.icon.name = current === 'normal' ? 'left' : current;
35774
+ },
35775
+ isActive: (editor, button)=>currentAlign(editor, button.target) !== 'normal',
35776
+ isChildActive: (editor, button)=>{
35777
+ var _button_control_args;
35778
+ const [value] = (_button_control_args = button.control.args) !== null && _button_control_args !== void 0 ? _button_control_args : [];
35779
+ return (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_1__.isString)(value) && currentAlign(editor, button.target) === value.toLowerCase();
35780
+ },
35687
35781
  exec: (editor, elm, { control })=>{
35688
35782
  if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
35689
35783
  'img',
@@ -35696,7 +35790,7 @@ const align = {
35696
35790
  if (!command) {
35697
35791
  return false;
35698
35792
  }
35699
- ;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command);
35793
+ ;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command, alignClasses(editor, elm));
35700
35794
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
35701
35795
  'jodit',
35702
35796
  'jodit-media'
@@ -42284,19 +42378,26 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42284
42378
  onResize();
42285
42379
  this.onReady();
42286
42380
  };
42381
+ let loading = false;
42287
42382
  const initAceEditor = ()=>{
42288
42383
  if (editor.isInDestruct || editor.getRealMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.MODE_SOURCE && editor.getMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.MODE_SPLIT) {
42289
42384
  return;
42290
42385
  }
42386
+ // ACE (~400 KiB from the CDN) is only needed once the source view
42387
+ // is actually shown — a page that stays in WYSIWYG must not
42388
+ // download it.
42389
+ if (!this.aceExists()) {
42390
+ if (!loading) {
42391
+ loading = true;
42392
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.loadNext)(editor, editor.o.sourceEditorCDNUrlsJS).then(initAceEditor).catch(()=>null);
42393
+ }
42394
+ return;
42395
+ }
42291
42396
  this.fromWYSIWYG();
42292
42397
  tryInitAceEditor();
42293
42398
  };
42294
42399
  editor.e.on('afterSetMode', initAceEditor);
42295
42400
  initAceEditor();
42296
- // global add ace editor in browser
42297
- if (!this.aceExists()) {
42298
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.loadNext)(editor, editor.o.sourceEditorCDNUrlsJS).then(initAceEditor).catch(()=>null);
42299
- }
42300
42401
  }
42301
42402
  destruct() {
42302
42403
  var _this_j_events, _this_j;
@@ -42846,7 +42947,24 @@ class SourceEditor {
42846
42947
  return false;
42847
42948
  };
42848
42949
  if (!addEventListener()) {
42849
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(addEventListener, ()=>null);
42950
+ // js-beautify is only needed once the source view is shown —
42951
+ // do not download it for a page that stays in WYSIWYG.
42952
+ let loading = false;
42953
+ const loadBeautify = ()=>{
42954
+ if (loading || editor.getMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_SOURCE && editor.getMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_SPLIT) {
42955
+ return;
42956
+ }
42957
+ loading = true;
42958
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(()=>{
42959
+ // The source view was filled before the
42960
+ // beautifier arrived — format it now.
42961
+ if (addEventListener()) {
42962
+ this.syncValueFromWYSIWYG(true);
42963
+ }
42964
+ }, ()=>null);
42965
+ };
42966
+ editor.e.on('afterSetMode.source', loadBeautify);
42967
+ loadBeautify();
42850
42968
  }
42851
42969
  }
42852
42970
  this.syncValueFromWYSIWYG(true);