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/es2021/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
  *
@@ -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
@@ -19065,13 +19141,14 @@ ContextMenu = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorat
19065
19141
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(28077);
19066
19142
  /* harmony import */ var jodit_core_helpers_array__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(45664);
19067
19143
  /* harmony import */ var jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(28686);
19068
- /* harmony import */ var jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(93640);
19069
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(28712);
19070
- /* 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__);
19071
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(4099);
19072
- /* harmony import */ var jodit_core_view_view__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(35099);
19073
- /* harmony import */ var jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(2222);
19074
- /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(5266);
19144
+ /* harmony import */ var jodit_core_helpers_html_strip_tags__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(22852);
19145
+ /* harmony import */ var jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(93640);
19146
+ /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(28712);
19147
+ /* 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__);
19148
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(4099);
19149
+ /* harmony import */ var jodit_core_view_view__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(35099);
19150
+ /* harmony import */ var jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(2222);
19151
+ /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(5266);
19075
19152
  /*!
19076
19153
  * Jodit Editor (https://xdsoft.net/jodit/)
19077
19154
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -19094,7 +19171,8 @@ ContextMenu = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorat
19094
19171
 
19095
19172
 
19096
19173
 
19097
- jodit_config__WEBPACK_IMPORTED_MODULE_14__.Config.prototype.dialog = {
19174
+
19175
+ jodit_config__WEBPACK_IMPORTED_MODULE_15__.Config.prototype.dialog = {
19098
19176
  namespace: '',
19099
19177
  extraButtons: [],
19100
19178
  /**
@@ -19110,7 +19188,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_14__.Config.prototype.dialog = {
19110
19188
  toolbarButtonSize: 'middle',
19111
19189
  zIndex: 'inherit'
19112
19190
  };
19113
- jodit_config__WEBPACK_IMPORTED_MODULE_14__.Config.prototype.controls.dialog = {
19191
+ jodit_config__WEBPACK_IMPORTED_MODULE_15__.Config.prototype.controls.dialog = {
19114
19192
  close: {
19115
19193
  icon: 'cancel',
19116
19194
  exec: (dialog)=>{
@@ -19118,7 +19196,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_14__.Config.prototype.controls.dialog = {
19118
19196
  }
19119
19197
  }
19120
19198
  };
19121
- class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_13__.ViewWithToolbar {
19199
+ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_14__.ViewWithToolbar {
19122
19200
  /** @override */ className() {
19123
19201
  return 'Dialog';
19124
19202
  }
@@ -19182,8 +19260,8 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19182
19260
  this.draggable = true;
19183
19261
  this.startX = e.clientX;
19184
19262
  this.startY = e.clientY;
19185
- this.startPoint.x = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.dialog, 'left');
19186
- this.startPoint.y = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.dialog, 'top');
19263
+ this.startPoint.x = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.dialog, 'left');
19264
+ this.startPoint.y = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.dialog, 'top');
19187
19265
  this.setMaxZIndex();
19188
19266
  if (e.cancelable) {
19189
19267
  e.preventDefault();
@@ -19272,7 +19350,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19272
19350
  if (h == null) {
19273
19351
  h = this.dialog.offsetHeight;
19274
19352
  }
19275
- ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.dialog, {
19353
+ ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.dialog, {
19276
19354
  width: w,
19277
19355
  height: h
19278
19356
  });
@@ -19306,7 +19384,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19306
19384
  this.moved = Math.abs(x - left) > 100 || Math.abs(y - top) > 100;
19307
19385
  }
19308
19386
  // strings on purpose: `css()` would truncate fractional pixels
19309
- ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.dialog, {
19387
+ ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.dialog, {
19310
19388
  left: (x || left) + 'px',
19311
19389
  top: (y || top) + 'px'
19312
19390
  });
@@ -19326,6 +19404,12 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19326
19404
  * ```
19327
19405
  */ setHeader(content) {
19328
19406
  this.setElements(this.dialogbox_header, content);
19407
+ // `role="dialog"` needs an accessible name; a text title is the
19408
+ // natural one (element titles are left to the caller).
19409
+ if ((0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_8__.isString)(content)) {
19410
+ const name = (0,jodit_core_helpers_html_strip_tags__WEBPACK_IMPORTED_MODULE_9__.stripTags)(content, this.od).trim();
19411
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.attr)(this.container, 'aria-label', name || null);
19412
+ }
19329
19413
  return this;
19330
19414
  }
19331
19415
  /**
@@ -19379,7 +19463,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19379
19463
  /**
19380
19464
  * Get zIndex from dialog
19381
19465
  */ getZIndex() {
19382
- return parseInt((0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.container, 'zIndex'), 10) || 0;
19466
+ return parseInt((0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.container, 'zIndex'), 10) || 0;
19383
19467
  }
19384
19468
  /**
19385
19469
  * Get dialog instance with maximum z-index displaying it on top of all the dialog boxes
@@ -19402,7 +19486,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19402
19486
  this.__openedSiblings().forEach((dialog)=>{
19403
19487
  maxZIndex = Math.max(dialog.getZIndex(), maxZIndex);
19404
19488
  });
19405
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.container, 'zIndex', (maxZIndex + 1).toString());
19489
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.container, 'zIndex', (maxZIndex + 1).toString());
19406
19490
  }
19407
19491
  /**
19408
19492
  * Expands the dialog on full browser window
@@ -19452,7 +19536,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19452
19536
  this.setPosition(this.offsetX, this.offsetY);
19453
19537
  this.setMaxZIndex();
19454
19538
  } else {
19455
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.container, 'zIndex', null);
19539
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.container, 'zIndex', null);
19456
19540
  }
19457
19541
  if (this.o.fullsize) {
19458
19542
  this.toggleFullSize(true);
@@ -19566,7 +19650,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19566
19650
  * True, if dialog was opened
19567
19651
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "isOpened", false);
19568
19652
  const self1 = this;
19569
- 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));
19653
+ 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));
19570
19654
  // Attach event handlers passed via `options.events` to the dialog's own
19571
19655
  // emitter (as FileBrowser already does), so a consumer — e.g. a plugin
19572
19656
  // forwarding the editor's `events` config — can observe `afterOpen` /
@@ -19584,40 +19668,40 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19584
19668
  </div>
19585
19669
  <div class="${n('content')}"></div>
19586
19670
  <div class="${n('footer')}"></div>
19587
- <div class="${n('resizer')}">${jodit_core_ui__WEBPACK_IMPORTED_MODULE_11__.Icon.get('resize_handler')}</div>
19671
+ <div class="${n('resizer')}">${jodit_core_ui__WEBPACK_IMPORTED_MODULE_12__.Icon.get('resize_handler')}</div>
19588
19672
  </div>
19589
19673
  </div>`);
19590
19674
  if (self1.options.direction === 'rtl') {
19591
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(self1.container, 'direction', 'rtl');
19592
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.attr)(self1.container, 'dir', 'rtl');
19675
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(self1.container, 'direction', 'rtl');
19676
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.attr)(self1.container, 'dir', 'rtl');
19593
19677
  }
19594
19678
  if (this.o.zIndex) {
19595
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(this.container, 'zIndex', this.o.zIndex.toString());
19679
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(this.container, 'zIndex', this.o.zIndex.toString());
19596
19680
  }
19597
- ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.attr)(self1.container, 'role', 'dialog');
19681
+ ;(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.attr)(self1.container, 'role', 'dialog');
19598
19682
  Object.defineProperty(self1.container, 'component', {
19599
19683
  value: this
19600
19684
  });
19601
19685
  self1.setMod('theme', self1.o.theme || 'default').setMod('resizable', Boolean(self1.o.resizable));
19602
19686
  const dialog = self1.getElm('panel');
19603
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(dialog != null, 'Panel element does not exist');
19687
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__.assert)(dialog != null, 'Panel element does not exist');
19604
19688
  const resizer = self1.getElm('resizer');
19605
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(resizer != null, 'Resizer element does not exist');
19689
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__.assert)(resizer != null, 'Resizer element does not exist');
19606
19690
  const dialogbox_header = self1.getElm('header-title');
19607
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(dialogbox_header != null, 'header-title element does not exist');
19691
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__.assert)(dialogbox_header != null, 'header-title element does not exist');
19608
19692
  const dialogbox_content = self1.getElm('content');
19609
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(dialogbox_content != null, 'Content element does not exist');
19693
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__.assert)(dialogbox_content != null, 'Content element does not exist');
19610
19694
  const dialogbox_footer = self1.getElm('footer');
19611
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(dialogbox_footer != null, 'Footer element does not exist');
19695
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__.assert)(dialogbox_footer != null, 'Footer element does not exist');
19612
19696
  const dialogbox_toolbar = self1.getElm('header-toolbar');
19613
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(dialogbox_toolbar != null, 'header-toolbar element does not exist');
19697
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__.assert)(dialogbox_toolbar != null, 'header-toolbar element does not exist');
19614
19698
  this.dialog = dialog;
19615
19699
  this.resizer = resizer;
19616
19700
  this.dialogbox_header = dialogbox_header;
19617
19701
  this.dialogbox_content = dialogbox_content;
19618
19702
  this.dialogbox_footer = dialogbox_footer;
19619
19703
  this.dialogbox_toolbar = dialogbox_toolbar;
19620
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_9__.css)(self1.dialog, {
19704
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_10__.css)(self1.dialog, {
19621
19705
  maxWidth: self1.options.maxWidth,
19622
19706
  minHeight: self1.options.minHeight,
19623
19707
  minWidth: self1.options.minWidth
@@ -19630,7 +19714,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19630
19714
  this.e.on(self1.container, 'close_dialog', self1.close).on(this.ow, 'keydown', this.__onEsc).on(this.ow, 'resize', this.__onResize);
19631
19715
  if (this.o.closeOnClickOverlay) {
19632
19716
  const overlay = self1.getElm('overlay');
19633
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_10__.assert)(overlay != null, 'Overlay element does not exist');
19717
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_11__.assert)(overlay != null, 'Overlay element does not exist');
19634
19718
  this.e.on(overlay, 'click', self1.close);
19635
19719
  }
19636
19720
  }
@@ -19640,7 +19724,7 @@ class Dialog extends jodit_core_view_view_with_toolbar__WEBPACK_IMPORTED_MODULE_
19640
19724
  * whole `destination` (usually `document.body`) for every z-index update.
19641
19725
  */ ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(Dialog, "__opened", new Set());
19642
19726
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(Dialog, "defaultOptions", {
19643
- ...jodit_core_view_view__WEBPACK_IMPORTED_MODULE_12__.View.defaultOptions,
19727
+ ...jodit_core_view_view__WEBPACK_IMPORTED_MODULE_13__.View.defaultOptions,
19644
19728
  closeOnClickOverlay: false,
19645
19729
  closeOnEsc: true
19646
19730
  });
@@ -24768,6 +24852,13 @@ class ToolbarContent extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__.U
24768
24852
  /** @override */ className() {
24769
24853
  return 'ToolbarContent';
24770
24854
  }
24855
+ /** A toolbar item like `ToolbarButton`: the parent group is a `list`. */ getRole() {
24856
+ return 'listitem';
24857
+ }
24858
+ /**
24859
+ * Arbitrary content is not a toggle button — `aria-pressed` is not
24860
+ * allowed on a `listitem`.
24861
+ */ onChangeActivated() {}
24771
24862
  /** @override */ update() {
24772
24863
  const { control } = this;
24773
24864
  const content = control.getContent(this.j, this);
@@ -24807,7 +24898,6 @@ class ToolbarContent extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_5__.U
24807
24898
  constructor(jodit, control, target = null){
24808
24899
  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;
24809
24900
  this.container.classList.add(`${this.componentName}_${this.clearName(control.name)}`);
24810
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.attr)(this.container, 'role', 'content');
24811
24901
  }
24812
24902
  }
24813
24903
  ToolbarContent = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
@@ -33472,7 +33562,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProperties
33472
33562
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
33473
33563
  /* harmony export */ readAlign: function() { return /* binding */ readAlign; }
33474
33564
  /* harmony export */ });
33475
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80991);
33565
+ /* harmony import */ var jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16849);
33476
33566
  /*!
33477
33567
  * Jodit Editor (https://xdsoft.net/jodit/)
33478
33568
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -33482,20 +33572,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProperties
33482
33572
  */
33483
33573
  /**
33484
33574
  * @private
33485
- */ function readAlign(image, values) {
33486
- // Align
33487
- if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'float') && [
33488
- 'left',
33489
- 'right'
33490
- ].indexOf((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'float').toLowerCase()) !== -1) {
33491
- values.align = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, 'float');
33492
- } else {
33493
- 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') {
33494
- values.align = 'center';
33495
- } else {
33496
- values.align = '';
33497
- }
33498
- }
33575
+ */ function readAlign(image, values, classes) {
33576
+ const align = (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_0__.getHAlign)(image, classes);
33577
+ values.align = align === 'normal' ? '' : align;
33499
33578
  }
33500
33579
 
33501
33580
 
@@ -33531,7 +33610,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProperties
33531
33610
  * @private
33532
33611
  */ async function readValuesFromImage(j, state) {
33533
33612
  const { sourceImage: image, values } = state;
33534
- (0,_align__WEBPACK_IMPORTED_MODULE_2__.readAlign)(image, values);
33613
+ (0,_align__WEBPACK_IMPORTED_MODULE_2__.readAlign)(image, values, j.o.imageAlignClasses);
33535
33614
  // Border radius
33536
33615
  values.borderRadius = parseInt((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__.cssInline)(image, 'border-radius') || '0', 10) || 0;
33537
33616
  // Id
@@ -34572,7 +34651,7 @@ UIImagePositionTab = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__
34572
34651
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'id', id || null);
34573
34652
  }
34574
34653
  if (opt.image.editAlign) {
34575
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align);
34654
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align, j.o.imageAlignClasses);
34576
34655
  }
34577
34656
  }
34578
34657
 
@@ -35412,6 +35491,10 @@ const cmd = (control)=>control.args && (0,jodit_core_helpers_checker__WEBPACK_IM
35412
35491
 
35413
35492
 
35414
35493
 
35494
+ // Images align with `imageAlignClasses`; the wrappers of iframes and media
35495
+ // keep inline styles
35496
+ const alignClasses = (editor, elm)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, 'img') ? editor.o.imageAlignClasses : null;
35497
+ const currentAlign = (editor, elm)=>elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getHAlign)(elm, alignClasses(editor, elm)) : 'normal';
35415
35498
  const align = {
35416
35499
  name: 'left',
35417
35500
  childTemplate: (_, __, value)=>value,
@@ -35421,6 +35504,15 @@ const align = {
35421
35504
  'Center',
35422
35505
  'Normal'
35423
35506
  ],
35507
+ update: (editor, button)=>{
35508
+ const current = currentAlign(editor, button.target);
35509
+ button.state.icon.name = current === 'normal' ? 'left' : current;
35510
+ },
35511
+ isActive: (editor, button)=>currentAlign(editor, button.target) !== 'normal',
35512
+ isChildActive: (editor, button)=>{
35513
+ const [value] = button.control.args ?? [];
35514
+ return (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_1__.isString)(value) && currentAlign(editor, button.target) === value.toLowerCase();
35515
+ },
35424
35516
  exec: (editor, elm, { control })=>{
35425
35517
  if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
35426
35518
  'img',
@@ -35433,7 +35525,7 @@ const align = {
35433
35525
  if (!command) {
35434
35526
  return false;
35435
35527
  }
35436
- ;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command);
35528
+ ;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command, alignClasses(editor, elm));
35437
35529
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
35438
35530
  'jodit',
35439
35531
  'jodit-media'
@@ -41967,19 +42059,26 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
41967
42059
  onResize();
41968
42060
  this.onReady();
41969
42061
  };
42062
+ let loading = false;
41970
42063
  const initAceEditor = ()=>{
41971
42064
  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) {
41972
42065
  return;
41973
42066
  }
42067
+ // ACE (~400 KiB from the CDN) is only needed once the source view
42068
+ // is actually shown — a page that stays in WYSIWYG must not
42069
+ // download it.
42070
+ if (!this.aceExists()) {
42071
+ if (!loading) {
42072
+ loading = true;
42073
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.loadNext)(editor, editor.o.sourceEditorCDNUrlsJS).then(initAceEditor).catch(()=>null);
42074
+ }
42075
+ return;
42076
+ }
41974
42077
  this.fromWYSIWYG();
41975
42078
  tryInitAceEditor();
41976
42079
  };
41977
42080
  editor.e.on('afterSetMode', initAceEditor);
41978
42081
  initAceEditor();
41979
- // global add ace editor in browser
41980
- if (!this.aceExists()) {
41981
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.loadNext)(editor, editor.o.sourceEditorCDNUrlsJS).then(initAceEditor).catch(()=>null);
41982
- }
41983
42082
  }
41984
42083
  destruct() {
41985
42084
  this.instance.off('change', this.toWYSIWYG);
@@ -42517,7 +42616,24 @@ class SourceEditor {
42517
42616
  return false;
42518
42617
  };
42519
42618
  if (!addEventListener()) {
42520
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(addEventListener, ()=>null);
42619
+ // js-beautify is only needed once the source view is shown —
42620
+ // do not download it for a page that stays in WYSIWYG.
42621
+ let loading = false;
42622
+ const loadBeautify = ()=>{
42623
+ if (loading || editor.getMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_SOURCE && editor.getMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_SPLIT) {
42624
+ return;
42625
+ }
42626
+ loading = true;
42627
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(()=>{
42628
+ // The source view was filled before the
42629
+ // beautifier arrived — format it now.
42630
+ if (addEventListener()) {
42631
+ this.syncValueFromWYSIWYG(true);
42632
+ }
42633
+ }, ()=>null);
42634
+ };
42635
+ editor.e.on('afterSetMode.source', loadBeautify);
42636
+ loadBeautify();
42521
42637
  }
42522
42638
  }
42523
42639
  this.syncValueFromWYSIWYG(true);