jodit 4.15.17 → 4.15.18

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 (66) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +7 -7
  4. package/es2015/jodit.js +106 -34
  5. package/es2015/jodit.min.js +7 -7
  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 +4 -4
  13. package/es2018/jodit.min.js +7 -7
  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 +8 -8
  18. package/es2021/jodit.js +104 -34
  19. package/es2021/jodit.min.js +12 -12
  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 +8 -8
  28. package/es2021.en/jodit.js +104 -34
  29. package/es2021.en/jodit.min.js +8 -8
  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 +154 -64
  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/plugins/image-properties/readers/align.d.ts +5 -1
  57. package/esm/plugins/image-properties/readers/align.js +4 -18
  58. package/esm/plugins/image-properties/readers/index.js +1 -1
  59. package/esm/plugins/image-properties/writers/index.js +1 -1
  60. package/esm/plugins/inline-popup/config/items/img.js +17 -2
  61. package/esm/types/types.d.ts +4 -0
  62. package/package.json +1 -1
  63. package/types/config.d.ts +23 -0
  64. package/types/core/helpers/utils/align.d.ts +8 -3
  65. package/types/plugins/image-properties/readers/align.d.ts +5 -1
  66. 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.15.18
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.15.18";
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);
@@ -33472,7 +33540,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProperties
33472
33540
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
33473
33541
  /* harmony export */ readAlign: function() { return /* binding */ readAlign; }
33474
33542
  /* harmony export */ });
33475
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80991);
33543
+ /* harmony import */ var jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16849);
33476
33544
  /*!
33477
33545
  * Jodit Editor (https://xdsoft.net/jodit/)
33478
33546
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -33482,20 +33550,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProperties
33482
33550
  */
33483
33551
  /**
33484
33552
  * @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
- }
33553
+ */ function readAlign(image, values, classes) {
33554
+ const align = (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_0__.getHAlign)(image, classes);
33555
+ values.align = align === 'normal' ? '' : align;
33499
33556
  }
33500
33557
 
33501
33558
 
@@ -33531,7 +33588,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProperties
33531
33588
  * @private
33532
33589
  */ async function readValuesFromImage(j, state) {
33533
33590
  const { sourceImage: image, values } = state;
33534
- (0,_align__WEBPACK_IMPORTED_MODULE_2__.readAlign)(image, values);
33591
+ (0,_align__WEBPACK_IMPORTED_MODULE_2__.readAlign)(image, values, j.o.imageAlignClasses);
33535
33592
  // Border radius
33536
33593
  values.borderRadius = parseInt((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__.cssInline)(image, 'border-radius') || '0', 10) || 0;
33537
33594
  // Id
@@ -34572,7 +34629,7 @@ UIImagePositionTab = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__
34572
34629
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'id', id || null);
34573
34630
  }
34574
34631
  if (opt.image.editAlign) {
34575
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align);
34632
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align, j.o.imageAlignClasses);
34576
34633
  }
34577
34634
  }
34578
34635
 
@@ -35412,6 +35469,10 @@ const cmd = (control)=>control.args && (0,jodit_core_helpers_checker__WEBPACK_IM
35412
35469
 
35413
35470
 
35414
35471
 
35472
+ // Images align with `imageAlignClasses`; the wrappers of iframes and media
35473
+ // keep inline styles
35474
+ const alignClasses = (editor, elm)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, 'img') ? editor.o.imageAlignClasses : null;
35475
+ const currentAlign = (editor, elm)=>elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getHAlign)(elm, alignClasses(editor, elm)) : 'normal';
35415
35476
  const align = {
35416
35477
  name: 'left',
35417
35478
  childTemplate: (_, __, value)=>value,
@@ -35421,6 +35482,15 @@ const align = {
35421
35482
  'Center',
35422
35483
  'Normal'
35423
35484
  ],
35485
+ update: (editor, button)=>{
35486
+ const current = currentAlign(editor, button.target);
35487
+ button.state.icon.name = current === 'normal' ? 'left' : current;
35488
+ },
35489
+ isActive: (editor, button)=>currentAlign(editor, button.target) !== 'normal',
35490
+ isChildActive: (editor, button)=>{
35491
+ const [value] = button.control.args ?? [];
35492
+ return (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_1__.isString)(value) && currentAlign(editor, button.target) === value.toLowerCase();
35493
+ },
35424
35494
  exec: (editor, elm, { control })=>{
35425
35495
  if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
35426
35496
  'img',
@@ -35433,7 +35503,7 @@ const align = {
35433
35503
  if (!command) {
35434
35504
  return false;
35435
35505
  }
35436
- ;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command);
35506
+ ;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command, alignClasses(editor, elm));
35437
35507
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
35438
35508
  'jodit',
35439
35509
  'jodit-media'