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
@@ -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
  *
@@ -1780,7 +1799,7 @@ __webpack_require__.r(__webpack_exports__);
1780
1799
  * ```
1781
1800
  * @packageDocumentation
1782
1801
  * @module constants
1783
- */ const APP_VERSION = "4.15.17";
1802
+ */ const APP_VERSION = "4.16.0";
1784
1803
  // prettier-ignore
1785
1804
  const ES = "es2021";
1786
1805
  const IS_ES_MODERN = true;
@@ -7535,6 +7554,7 @@ function trimChars(value, chars) {
7535
7554
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7536
7555
  /* harmony export */ alignElement: function() { return /* binding */ alignElement; },
7537
7556
  /* harmony export */ clearAlign: function() { return /* binding */ clearAlign; },
7557
+ /* harmony export */ getHAlign: function() { return /* binding */ getHAlign; },
7538
7558
  /* harmony export */ hAlignElement: function() { return /* binding */ hAlignElement; }
7539
7559
  /* harmony export */ });
7540
7560
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
@@ -7549,9 +7569,25 @@ function trimChars(value, chars) {
7549
7569
  */
7550
7570
 
7551
7571
 
7572
+ const classNames = (value)=>(value ?? '').split(/\s+/).filter(Boolean);
7552
7573
  /**
7553
- * Align image
7554
- */ function hAlignElement(image, align) {
7574
+ * Align image, with `classes` (see `imageAlignClasses`) instead of inline
7575
+ * styles when they are given
7576
+ */ function hAlignElement(image, align, classes) {
7577
+ if (classes) {
7578
+ hAlignElement(image, 'normal');
7579
+ Object.values(classes).forEach((value)=>image.classList.remove(...classNames(value)));
7580
+ image.classList.add(...classNames(classes[align || 'normal']));
7581
+ [
7582
+ 'class',
7583
+ 'style'
7584
+ ].forEach((name)=>{
7585
+ if (!(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, name)?.trim()) {
7586
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, name, null);
7587
+ }
7588
+ });
7589
+ return;
7590
+ }
7555
7591
  if (align && align !== 'normal') {
7556
7592
  if (align !== 'center') {
7557
7593
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float', align);
@@ -7574,6 +7610,31 @@ function trimChars(value, chars) {
7574
7610
  ;(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.clearCenterAlign)(image);
7575
7611
  }
7576
7612
  }
7613
+ /**
7614
+ * The alignment `hAlignElement` has set on an element
7615
+ */ function getHAlign(elm, classes) {
7616
+ if (classes) {
7617
+ for (const align of [
7618
+ 'left',
7619
+ 'right',
7620
+ 'center',
7621
+ 'normal'
7622
+ ]){
7623
+ const names = classNames(classes[align]);
7624
+ if (names.length && names.every((name)=>elm.classList.contains(name))) {
7625
+ return align;
7626
+ }
7627
+ }
7628
+ }
7629
+ const float = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(elm, 'float').toLowerCase();
7630
+ if (float === 'left' || float === 'right') {
7631
+ return float;
7632
+ }
7633
+ 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') {
7634
+ return 'center';
7635
+ }
7636
+ return 'normal';
7637
+ }
7577
7638
  /**
7578
7639
  * Remove text-align style for all selected children
7579
7640
  */ function clearAlign(node) {
@@ -8736,6 +8797,7 @@ __webpack_require__.r(__webpack_exports__);
8736
8797
  /* harmony export */ get: function() { return /* reexport safe */ _get__WEBPACK_IMPORTED_MODULE_15__.get; },
8737
8798
  /* harmony export */ getClassName: function() { return /* reexport safe */ _get_class_name__WEBPACK_IMPORTED_MODULE_16__.getClassName; },
8738
8799
  /* harmony export */ getDataTransfer: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.getDataTransfer; },
8800
+ /* harmony export */ getHAlign: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.getHAlign; },
8739
8801
  /* harmony export */ getPropertyDescriptor: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.getPropertyDescriptor; },
8740
8802
  /* harmony export */ getXPathByElement: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_24__.getXPathByElement; },
8741
8803
  /* harmony export */ hAlignElement: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.hAlignElement; },
@@ -8766,7 +8828,7 @@ __webpack_require__.r(__webpack_exports__);
8766
8828
  /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28712);
8767
8829
  /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_assert__WEBPACK_IMPORTED_MODULE_2__);
8768
8830
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
8769
- /* 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__)
8831
+ /* 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__)
8770
8832
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
8771
8833
  /* harmony import */ var _attr__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7909);
8772
8834
  /* harmony import */ var _browser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26136);
@@ -10666,11 +10728,12 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
10666
10728
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
10667
10729
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
10668
10730
  /* harmony import */ var jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(28686);
10669
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(28712);
10670
- /* 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__);
10671
- /* harmony import */ var jodit_core_selection_helpers_move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(7470);
10672
- /* harmony import */ var _style_commit_style__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(84578);
10673
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(42259);
10731
+ /* harmony import */ var jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(16849);
10732
+ /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(28712);
10733
+ /* 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__);
10734
+ /* harmony import */ var jodit_core_selection_helpers_move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(7470);
10735
+ /* harmony import */ var _style_commit_style__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(84578);
10736
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(42259);
10674
10737
  /*!
10675
10738
  * Jodit Editor (https://xdsoft.net/jodit/)
10676
10739
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -10692,6 +10755,7 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
10692
10755
 
10693
10756
 
10694
10757
 
10758
+
10695
10759
  class Selection {
10696
10760
  /**
10697
10761
  * Short alias for this.jodit
@@ -11124,7 +11188,7 @@ class Selection {
11124
11188
  return node;
11125
11189
  }
11126
11190
  if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node)) {
11127
- const ret = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.findCorrectCurrentNode)(node, range, rightMode, sel.isCollapsed, checkChild, child);
11191
+ const ret = (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.findCorrectCurrentNode)(node, range, rightMode, sel.isCollapsed, checkChild, child);
11128
11192
  node = ret.node;
11129
11193
  rightMode = ret.rightMode;
11130
11194
  }
@@ -11265,6 +11329,10 @@ class Selection {
11265
11329
  if (styles && typeof styles === 'object') {
11266
11330
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.css)(image, styles);
11267
11331
  }
11332
+ const { imageDefaultAlign, imageAlignClasses } = this.j.o;
11333
+ if (imageDefaultAlign && imageDefaultAlign !== 'normal') {
11334
+ (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_7__.hAlignElement)(image, imageDefaultAlign, imageAlignClasses);
11335
+ }
11268
11336
  const onload = ()=>{
11269
11337
  if (image.naturalHeight < image.offsetHeight || image.naturalWidth < image.offsetWidth) {
11270
11338
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.css)(image, {
@@ -11388,7 +11456,7 @@ class Selection {
11388
11456
  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));
11389
11457
  // check right offset
11390
11458
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(container)) {
11391
- if ((0,_helpers__WEBPACK_IMPORTED_MODULE_10__.cursorInTheEdgeOfString)(container, offset, start, end)) {
11459
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_11__.cursorInTheEdgeOfString)(container, offset, start, end)) {
11392
11460
  return false;
11393
11461
  }
11394
11462
  } else {
@@ -11776,8 +11844,8 @@ class Selection {
11776
11844
  * }) // will remove `color:red` from `span`
11777
11845
  * ```
11778
11846
  */ commitStyle(options) {
11779
- ;(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');
11780
- const styleElm = new _style_commit_style__WEBPACK_IMPORTED_MODULE_9__.CommitStyle(options);
11847
+ ;(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');
11848
+ const styleElm = new _style_commit_style__WEBPACK_IMPORTED_MODULE_10__.CommitStyle(options);
11781
11849
  styleElm.apply(this.j);
11782
11850
  }
11783
11851
  /**
@@ -11827,7 +11895,7 @@ class Selection {
11827
11895
  }
11828
11896
  const fragment = leftRange.extractContents();
11829
11897
  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));
11830
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(currentBox.parentNode, 'Splitting fails');
11898
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8__.assert)(currentBox.parentNode, 'Splitting fails');
11831
11899
  try {
11832
11900
  clearEmpties(fragment);
11833
11901
  clearEmpties(currentBox);
@@ -11880,7 +11948,7 @@ class Selection {
11880
11948
  const r = range.cloneRange();
11881
11949
  r.collapse(start);
11882
11950
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeInsertNode(r, fake);
11883
- (0,jodit_core_selection_helpers_move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_8__.moveTheNodeAlongTheEdgeOutward)(fake, start, this.j.editor);
11951
+ (0,jodit_core_selection_helpers_move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_9__.moveTheNodeAlongTheEdgeOutward)(fake, start, this.j.editor);
11884
11952
  return fake;
11885
11953
  };
11886
11954
  const leftFake = moveMaxEdgeFake(true);
@@ -14264,6 +14332,7 @@ class UIButton extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_11__.UIEle
14264
14332
  this.name = this.state.name;
14265
14333
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_10__.attr)(this.container, 'data-ref', this.state.name);
14266
14334
  (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_10__.attr)(this.container, 'ref', this.state.name);
14335
+ this.updateAriaLabel();
14267
14336
  }
14268
14337
  onChangeTooltip() {
14269
14338
  const i8nTooltip = this.state.tooltip ? this.jodit.i18n(this.state.tooltip) : null;
@@ -14275,9 +14344,12 @@ class UIButton extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_11__.UIEle
14275
14344
  }
14276
14345
  updateAriaLabel() {
14277
14346
  const hasText = this.state.text.trim().length > 0;
14278
- const i8nTooltip = this.state.tooltip ? this.jodit.i18n(this.state.tooltip) : null;
14279
- (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_10__.attr)(this.container, 'aria-label', i8nTooltip);
14280
- (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_10__.attr)(this.button, 'aria-label', !hasText ? i8nTooltip : null);
14347
+ // An icon-only button without a tooltip would have no accessible
14348
+ // name at all — fall back to its raw name (not translated: control
14349
+ // names are identifiers, not i18n keys).
14350
+ const label = this.state.tooltip ? this.jodit.i18n(this.state.tooltip) : !hasText && this.state.name ? this.state.name : null;
14351
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_10__.attr)(this.container, 'aria-label', label);
14352
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_10__.attr)(this.button, 'aria-label', !hasText ? label : null);
14281
14353
  }
14282
14354
  onChangeTabIndex() {
14283
14355
  ;(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_10__.attr)(this.container, 'tabindex', this.state.tabIndex);
@@ -15293,6 +15365,7 @@ class UIFileInput extends jodit_core_ui_form_inputs_input_input__WEBPACK_IMPORTE
15293
15365
  return this.j.create.fromHTML(`<input
15294
15366
  type="file"
15295
15367
  accept="${options.onlyImages ? 'image/*' : '*'}"
15368
+ aria-label="${this.j.i18n(options.tooltip || 'Upload')}"
15296
15369
  tabindex="-1"
15297
15370
  dir="auto"
15298
15371
  multiple=""
@@ -15791,8 +15864,11 @@ class UIGroup extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_6__.UIEleme
15791
15864
  className() {
15792
15865
  return 'UIGroup';
15793
15866
  }
15794
- getRole() {
15795
- return this.options?.role || 'list';
15867
+ /**
15868
+ * A generic container: `group` allows any children. Toolbar button groups
15869
+ * are lists of `listitem`s and get `role="list"` explicitly from `UIList`.
15870
+ */ getRole() {
15871
+ return this.options?.role || 'group';
15796
15872
  }
15797
15873
  /**
15798
15874
  * All group children
@@ -15995,10 +16071,10 @@ class UIList extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_8__.UIGr
15995
16071
  }
15996
16072
  /**
15997
16073
  * Make new group and append it in list of elements
15998
- */ makeGroup(role) {
15999
- return new jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_8__.UIGroup(this.jodit, [], role ? {
16074
+ */ makeGroup(role = 'list') {
16075
+ return new jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_8__.UIGroup(this.jodit, [], {
16000
16076
  role
16001
- } : undefined);
16077
+ });
16002
16078
  }
16003
16079
  /**
16004
16080
  * All buttons from list
@@ -19041,13 +19117,14 @@ ContextMenu = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorat
19041
19117
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(28077);
19042
19118
  /* harmony import */ var jodit_core_helpers_array__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(45664);
19043
19119
  /* harmony import */ var jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(28686);
19044
- /* harmony import */ var jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(93640);
19045
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(28712);
19046
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__);
19047
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(4099);
19048
- /* harmony import */ var jodit_core_view_view__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(35099);
19049
- /* harmony import */ var jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(2222);
19050
- /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(5266);
19120
+ /* harmony import */ var jodit_core_helpers_html_strip_tags__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(22852);
19121
+ /* harmony import */ var jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(93640);
19122
+ /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(28712);
19123
+ /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__);
19124
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(4099);
19125
+ /* harmony import */ var jodit_core_view_view__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(35099);
19126
+ /* harmony import */ var jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(2222);
19127
+ /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(5266);
19051
19128
  /*!
19052
19129
  * Jodit Editor (https://xdsoft.net/jodit/)
19053
19130
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -19070,7 +19147,8 @@ ContextMenu = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorat
19070
19147
 
19071
19148
 
19072
19149
 
19073
- jodit_config__WEBPACK_IMPORTED_MODULE_14__.Config.prototype.dialog = {
19150
+
19151
+ jodit_config__WEBPACK_IMPORTED_MODULE_15__.Config.prototype.dialog = {
19074
19152
  namespace: '',
19075
19153
  extraButtons: [],
19076
19154
  /**
@@ -19086,7 +19164,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_14__.Config.prototype.dialog = {
19086
19164
  toolbarButtonSize: 'middle',
19087
19165
  zIndex: 'inherit'
19088
19166
  };
19089
- jodit_config__WEBPACK_IMPORTED_MODULE_14__.Config.prototype.controls.dialog = {
19167
+ jodit_config__WEBPACK_IMPORTED_MODULE_15__.Config.prototype.controls.dialog = {
19090
19168
  close: {
19091
19169
  icon: 'cancel',
19092
19170
  exec: (dialog)=>{
@@ -19094,7 +19172,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_14__.Config.prototype.controls.dialog = {
19094
19172
  }
19095
19173
  }
19096
19174
  };
19097
- class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_13__.ViewWithToolbar {
19175
+ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_14__.ViewWithToolbar {
19098
19176
  /** @override */ className() {
19099
19177
  return 'Dialog';
19100
19178
  }
@@ -19158,8 +19236,8 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19158
19236
  this.draggable = true;
19159
19237
  this.startX = e.clientX;
19160
19238
  this.startY = e.clientY;
19161
- this.startPoint.x = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.dialog, 'left');
19162
- this.startPoint.y = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.dialog, 'top');
19239
+ this.startPoint.x = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.dialog, 'left');
19240
+ this.startPoint.y = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.dialog, 'top');
19163
19241
  this.setMaxZIndex();
19164
19242
  if (e.cancelable) {
19165
19243
  e.preventDefault();
@@ -19248,7 +19326,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19248
19326
  if (h == null) {
19249
19327
  h = this.dialog.offsetHeight;
19250
19328
  }
19251
- ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.dialog, {
19329
+ ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.dialog, {
19252
19330
  width: w,
19253
19331
  height: h
19254
19332
  });
@@ -19282,7 +19360,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19282
19360
  this.moved = Math.abs(x - left) > 100 || Math.abs(y - top) > 100;
19283
19361
  }
19284
19362
  // strings on purpose: `css()` would truncate fractional pixels
19285
- ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.dialog, {
19363
+ ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.dialog, {
19286
19364
  left: (x || left) + 'px',
19287
19365
  top: (y || top) + 'px'
19288
19366
  });
@@ -19302,6 +19380,12 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19302
19380
  * ```
19303
19381
  */ setHeader(content) {
19304
19382
  this.setElements(this.dialogbox_header, content);
19383
+ // `role="dialog"` needs an accessible name; a text title is the
19384
+ // natural one (element titles are left to the caller).
19385
+ if ((0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_8__.isString)(content)) {
19386
+ const name = (0,jodit_core_helpers_html_strip_tags__WEBPACK_IMPORTED_MODULE_9__.stripTags)(content, this.od).trim();
19387
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.attr)(this.container, 'aria-label', name || null);
19388
+ }
19305
19389
  return this;
19306
19390
  }
19307
19391
  /**
@@ -19355,7 +19439,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19355
19439
  /**
19356
19440
  * Get zIndex from dialog
19357
19441
  */ getZIndex() {
19358
- return parseInt((0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.container, 'zIndex'), 10) || 0;
19442
+ return parseInt((0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.container, 'zIndex'), 10) || 0;
19359
19443
  }
19360
19444
  /**
19361
19445
  * Get dialog instance with maximum z-index displaying it on top of all the dialog boxes
@@ -19378,7 +19462,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19378
19462
  this.__openedSiblings().forEach((dialog)=>{
19379
19463
  maxZIndex = Math.max(dialog.getZIndex(), maxZIndex);
19380
19464
  });
19381
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.container, 'zIndex', (maxZIndex + 1).toString());
19465
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.container, 'zIndex', (maxZIndex + 1).toString());
19382
19466
  }
19383
19467
  /**
19384
19468
  * Expands the dialog on full browser window
@@ -19428,7 +19512,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19428
19512
  this.setPosition(this.offsetX, this.offsetY);
19429
19513
  this.setMaxZIndex();
19430
19514
  } else {
19431
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.container, 'zIndex', null);
19515
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.container, 'zIndex', null);
19432
19516
  }
19433
19517
  if (this.o.fullsize) {
19434
19518
  this.toggleFullSize(true);
@@ -19542,7 +19626,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19542
19626
  * True, if dialog was opened
19543
19627
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isOpened", false);
19544
19628
  const self1 = this;
19545
- self1.options = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.ConfigProto)(options, (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.ConfigProto)(jodit_config__WEBPACK_IMPORTED_MODULE_14__.Config.prototype.dialog, Dialog.defaultOptions));
19629
+ self1.options = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.ConfigProto)(options, (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.ConfigProto)(jodit_config__WEBPACK_IMPORTED_MODULE_15__.Config.prototype.dialog, Dialog.defaultOptions));
19546
19630
  // Attach event handlers passed via `options.events` to the dialog's own
19547
19631
  // emitter (as FileBrowser already does), so a consumer — e.g. a plugin
19548
19632
  // forwarding the editor's `events` config — can observe `afterOpen` /
@@ -19560,40 +19644,40 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19560
19644
  </div>
19561
19645
  <div class="${n('content')}"></div>
19562
19646
  <div class="${n('footer')}"></div>
19563
- <div class="${n('resizer')}">${jodit_core_ui__WEBPACK_IMPORTED_MODULE_11__.Icon.get('resize_handler')}</div>
19647
+ <div class="${n('resizer')}">${jodit_core_ui__WEBPACK_IMPORTED_MODULE_12__.Icon.get('resize_handler')}</div>
19564
19648
  </div>
19565
19649
  </div>`);
19566
19650
  if (self1.options.direction === 'rtl') {
19567
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(self1.container, 'direction', 'rtl');
19568
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.attr)(self1.container, 'dir', 'rtl');
19651
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(self1.container, 'direction', 'rtl');
19652
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.attr)(self1.container, 'dir', 'rtl');
19569
19653
  }
19570
19654
  if (this.o.zIndex) {
19571
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.container, 'zIndex', this.o.zIndex.toString());
19655
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.container, 'zIndex', this.o.zIndex.toString());
19572
19656
  }
19573
- ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.attr)(self1.container, 'role', 'dialog');
19657
+ ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.attr)(self1.container, 'role', 'dialog');
19574
19658
  Object.defineProperty(self1.container, 'component', {
19575
19659
  value: this
19576
19660
  });
19577
19661
  self1.setMod('theme', self1.o.theme || 'default').setMod('resizable', Boolean(self1.o.resizable));
19578
19662
  const dialog = self1.getElm('panel');
19579
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(dialog != null, 'Panel element does not exist');
19663
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__.assert)(dialog != null, 'Panel element does not exist');
19580
19664
  const resizer = self1.getElm('resizer');
19581
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(resizer != null, 'Resizer element does not exist');
19665
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__.assert)(resizer != null, 'Resizer element does not exist');
19582
19666
  const dialogbox_header = self1.getElm('header-title');
19583
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(dialogbox_header != null, 'header-title element does not exist');
19667
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__.assert)(dialogbox_header != null, 'header-title element does not exist');
19584
19668
  const dialogbox_content = self1.getElm('content');
19585
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(dialogbox_content != null, 'Content element does not exist');
19669
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__.assert)(dialogbox_content != null, 'Content element does not exist');
19586
19670
  const dialogbox_footer = self1.getElm('footer');
19587
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(dialogbox_footer != null, 'Footer element does not exist');
19671
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__.assert)(dialogbox_footer != null, 'Footer element does not exist');
19588
19672
  const dialogbox_toolbar = self1.getElm('header-toolbar');
19589
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(dialogbox_toolbar != null, 'header-toolbar element does not exist');
19673
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__.assert)(dialogbox_toolbar != null, 'header-toolbar element does not exist');
19590
19674
  this.dialog = dialog;
19591
19675
  this.resizer = resizer;
19592
19676
  this.dialogbox_header = dialogbox_header;
19593
19677
  this.dialogbox_content = dialogbox_content;
19594
19678
  this.dialogbox_footer = dialogbox_footer;
19595
19679
  this.dialogbox_toolbar = dialogbox_toolbar;
19596
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(self1.dialog, {
19680
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(self1.dialog, {
19597
19681
  maxWidth: self1.options.maxWidth,
19598
19682
  minHeight: self1.options.minHeight,
19599
19683
  minWidth: self1.options.minWidth
@@ -19606,7 +19690,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19606
19690
  this.e.on(self1.container, 'close_dialog', self1.close).on(this.ow, 'keydown', this.__onEsc).on(this.ow, 'resize', this.__onResize);
19607
19691
  if (this.o.closeOnClickOverlay) {
19608
19692
  const overlay = self1.getElm('overlay');
19609
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(overlay != null, 'Overlay element does not exist');
19693
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__.assert)(overlay != null, 'Overlay element does not exist');
19610
19694
  this.e.on(overlay, 'click', self1.close);
19611
19695
  }
19612
19696
  }
@@ -19616,7 +19700,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19616
19700
  * whole `destination` (usually `document.body`) for every z-index update.
19617
19701
  */ ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(Dialog, "__opened", new Set());
19618
19702
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(Dialog, "defaultOptions", {
19619
- ...jodit_core_view_view__WEBPACK_IMPORTED_MODULE_12__.View.defaultOptions,
19703
+ ...jodit_core_view_view__WEBPACK_IMPORTED_MODULE_13__.View.defaultOptions,
19620
19704
  closeOnClickOverlay: false,
19621
19705
  closeOnEsc: true
19622
19706
  });
@@ -24744,6 +24828,13 @@ class ToolbarContent extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__.U
24744
24828
  /** @override */ className() {
24745
24829
  return 'ToolbarContent';
24746
24830
  }
24831
+ /** A toolbar item like `ToolbarButton`: the parent group is a `list`. */ getRole() {
24832
+ return 'listitem';
24833
+ }
24834
+ /**
24835
+ * Arbitrary content is not a toggle button — `aria-pressed` is not
24836
+ * allowed on a `listitem`.
24837
+ */ onChangeActivated() {}
24747
24838
  /** @override */ update() {
24748
24839
  const { control } = this;
24749
24840
  const content = control.getContent(this.j, this);
@@ -24783,7 +24874,6 @@ class ToolbarContent extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__.U
24783
24874
  constructor(jodit, control, target = null){
24784
24875
  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;
24785
24876
  this.container.classList.add(`${this.componentName}_${this.clearName(control.name)}`);
24786
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.attr)(this.container, 'role', 'content');
24787
24877
  }
24788
24878
  }
24789
24879
  ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
@@ -33085,7 +33175,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProperties
33085
33175
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
33086
33176
  /* harmony export */ readAlign: function() { return /* binding */ readAlign; }
33087
33177
  /* harmony export */ });
33088
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80991);
33178
+ /* harmony import */ var jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16849);
33089
33179
  /*!
33090
33180
  * Jodit Editor (https://xdsoft.net/jodit/)
33091
33181
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -33095,20 +33185,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProperties
33095
33185
  */
33096
33186
  /**
33097
33187
  * @private
33098
- */ function readAlign(image, values) {
33099
- // Align
33100
- if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'float') && [
33101
- 'left',
33102
- 'right'
33103
- ].indexOf((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'float').toLowerCase()) !== -1) {
33104
- values.align = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, 'float');
33105
- } else {
33106
- 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') {
33107
- values.align = 'center';
33108
- } else {
33109
- values.align = '';
33110
- }
33111
- }
33188
+ */ function readAlign(image, values, classes) {
33189
+ const align = (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_0__.getHAlign)(image, classes);
33190
+ values.align = align === 'normal' ? '' : align;
33112
33191
  }
33113
33192
 
33114
33193
 
@@ -33144,7 +33223,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProperties
33144
33223
  * @private
33145
33224
  */ async function readValuesFromImage(j, state) {
33146
33225
  const { sourceImage: image, values } = state;
33147
- (0,_align__WEBPACK_IMPORTED_MODULE_2__.readAlign)(image, values);
33226
+ (0,_align__WEBPACK_IMPORTED_MODULE_2__.readAlign)(image, values, j.o.imageAlignClasses);
33148
33227
  // Border radius
33149
33228
  values.borderRadius = parseInt((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__.cssInline)(image, 'border-radius') || '0', 10) || 0;
33150
33229
  // Id
@@ -34185,7 +34264,7 @@ UIImagePositionTab = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__
34185
34264
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'id', id || null);
34186
34265
  }
34187
34266
  if (opt.image.editAlign) {
34188
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align);
34267
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align, j.o.imageAlignClasses);
34189
34268
  }
34190
34269
  }
34191
34270
 
@@ -35025,6 +35104,10 @@ const cmd = (control)=>control.args && (0,jodit_core_helpers_checker__WEBPACK_IM
35025
35104
 
35026
35105
 
35027
35106
 
35107
+ // Images align with `imageAlignClasses`; the wrappers of iframes and media
35108
+ // keep inline styles
35109
+ const alignClasses = (editor, elm)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, 'img') ? editor.o.imageAlignClasses : null;
35110
+ const currentAlign = (editor, elm)=>elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getHAlign)(elm, alignClasses(editor, elm)) : 'normal';
35028
35111
  const align = {
35029
35112
  name: 'left',
35030
35113
  childTemplate: (_, __, value)=>value,
@@ -35034,6 +35117,15 @@ const align = {
35034
35117
  'Center',
35035
35118
  'Normal'
35036
35119
  ],
35120
+ update: (editor, button)=>{
35121
+ const current = currentAlign(editor, button.target);
35122
+ button.state.icon.name = current === 'normal' ? 'left' : current;
35123
+ },
35124
+ isActive: (editor, button)=>currentAlign(editor, button.target) !== 'normal',
35125
+ isChildActive: (editor, button)=>{
35126
+ const [value] = button.control.args ?? [];
35127
+ return (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_1__.isString)(value) && currentAlign(editor, button.target) === value.toLowerCase();
35128
+ },
35037
35129
  exec: (editor, elm, { control })=>{
35038
35130
  if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
35039
35131
  'img',
@@ -35046,7 +35138,7 @@ const align = {
35046
35138
  if (!command) {
35047
35139
  return false;
35048
35140
  }
35049
- ;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command);
35141
+ ;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command, alignClasses(editor, elm));
35050
35142
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
35051
35143
  'jodit',
35052
35144
  'jodit-media'
@@ -41214,19 +41306,26 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
41214
41306
  onResize();
41215
41307
  this.onReady();
41216
41308
  };
41309
+ let loading = false;
41217
41310
  const initAceEditor = ()=>{
41218
41311
  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) {
41219
41312
  return;
41220
41313
  }
41314
+ // ACE (~400 KiB from the CDN) is only needed once the source view
41315
+ // is actually shown — a page that stays in WYSIWYG must not
41316
+ // download it.
41317
+ if (!this.aceExists()) {
41318
+ if (!loading) {
41319
+ loading = true;
41320
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.loadNext)(editor, editor.o.sourceEditorCDNUrlsJS).then(initAceEditor).catch(()=>null);
41321
+ }
41322
+ return;
41323
+ }
41221
41324
  this.fromWYSIWYG();
41222
41325
  tryInitAceEditor();
41223
41326
  };
41224
41327
  editor.e.on('afterSetMode', initAceEditor);
41225
41328
  initAceEditor();
41226
- // global add ace editor in browser
41227
- if (!this.aceExists()) {
41228
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.loadNext)(editor, editor.o.sourceEditorCDNUrlsJS).then(initAceEditor).catch(()=>null);
41229
- }
41230
41329
  }
41231
41330
  destruct() {
41232
41331
  this.instance.off('change', this.toWYSIWYG);
@@ -41764,7 +41863,24 @@ class SourceEditor {
41764
41863
  return false;
41765
41864
  };
41766
41865
  if (!addEventListener()) {
41767
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(addEventListener, ()=>null);
41866
+ // js-beautify is only needed once the source view is shown —
41867
+ // do not download it for a page that stays in WYSIWYG.
41868
+ let loading = false;
41869
+ const loadBeautify = ()=>{
41870
+ if (loading || editor.getMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_SOURCE && editor.getMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_SPLIT) {
41871
+ return;
41872
+ }
41873
+ loading = true;
41874
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(()=>{
41875
+ // The source view was filled before the
41876
+ // beautifier arrived — format it now.
41877
+ if (addEventListener()) {
41878
+ this.syncValueFromWYSIWYG(true);
41879
+ }
41880
+ }, ()=>null);
41881
+ };
41882
+ editor.e.on('afterSetMode.source', loadBeautify);
41883
+ loadBeautify();
41768
41884
  }
41769
41885
  }
41770
41886
  this.syncValueFromWYSIWYG(true);