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/es2015/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.15.17
4
+ * Version: v4.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
  *
@@ -1786,7 +1805,7 @@ __webpack_require__.r(__webpack_exports__);
1786
1805
  * ```
1787
1806
  * @packageDocumentation
1788
1807
  * @module constants
1789
- */ const APP_VERSION = "4.15.17";
1808
+ */ const APP_VERSION = "4.15.18";
1790
1809
  // prettier-ignore
1791
1810
  const ES = "es2015";
1792
1811
  const IS_ES_MODERN = true;
@@ -7562,6 +7581,7 @@ function trimChars(value, chars) {
7562
7581
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7563
7582
  /* harmony export */ alignElement: function() { return /* binding */ alignElement; },
7564
7583
  /* harmony export */ clearAlign: function() { return /* binding */ clearAlign; },
7584
+ /* harmony export */ getHAlign: function() { return /* binding */ getHAlign; },
7565
7585
  /* harmony export */ hAlignElement: function() { return /* binding */ hAlignElement; }
7566
7586
  /* harmony export */ });
7567
7587
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
@@ -7576,9 +7596,26 @@ function trimChars(value, chars) {
7576
7596
  */
7577
7597
 
7578
7598
 
7599
+ const classNames = (value)=>(value !== null && value !== void 0 ? value : '').split(/\s+/).filter(Boolean);
7579
7600
  /**
7580
- * Align image
7581
- */ function hAlignElement(image, align) {
7601
+ * Align image, with `classes` (see `imageAlignClasses`) instead of inline
7602
+ * styles when they are given
7603
+ */ function hAlignElement(image, align, classes) {
7604
+ if (classes) {
7605
+ hAlignElement(image, 'normal');
7606
+ Object.values(classes).forEach((value)=>image.classList.remove(...classNames(value)));
7607
+ image.classList.add(...classNames(classes[align || 'normal']));
7608
+ [
7609
+ 'class',
7610
+ 'style'
7611
+ ].forEach((name)=>{
7612
+ var _attr;
7613
+ if (!((_attr = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, name)) === null || _attr === void 0 ? void 0 : _attr.trim())) {
7614
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, name, null);
7615
+ }
7616
+ });
7617
+ return;
7618
+ }
7582
7619
  if (align && align !== 'normal') {
7583
7620
  if (align !== 'center') {
7584
7621
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float', align);
@@ -7601,6 +7638,31 @@ function trimChars(value, chars) {
7601
7638
  ;(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.clearCenterAlign)(image);
7602
7639
  }
7603
7640
  }
7641
+ /**
7642
+ * The alignment `hAlignElement` has set on an element
7643
+ */ function getHAlign(elm, classes) {
7644
+ if (classes) {
7645
+ for (const align of [
7646
+ 'left',
7647
+ 'right',
7648
+ 'center',
7649
+ 'normal'
7650
+ ]){
7651
+ const names = classNames(classes[align]);
7652
+ if (names.length && names.every((name)=>elm.classList.contains(name))) {
7653
+ return align;
7654
+ }
7655
+ }
7656
+ }
7657
+ const float = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(elm, 'float').toLowerCase();
7658
+ if (float === 'left' || float === 'right') {
7659
+ return float;
7660
+ }
7661
+ if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(elm, 'display') === 'block' && (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(elm, 'margin-left') === 'auto' && (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(elm, 'margin-right') === 'auto') {
7662
+ return 'center';
7663
+ }
7664
+ return 'normal';
7665
+ }
7604
7666
  /**
7605
7667
  * Remove text-align style for all selected children
7606
7668
  */ function clearAlign(node) {
@@ -8764,6 +8826,7 @@ __webpack_require__.r(__webpack_exports__);
8764
8826
  /* harmony export */ get: function() { return /* reexport safe */ _get__WEBPACK_IMPORTED_MODULE_15__.get; },
8765
8827
  /* harmony export */ getClassName: function() { return /* reexport safe */ _get_class_name__WEBPACK_IMPORTED_MODULE_16__.getClassName; },
8766
8828
  /* harmony export */ getDataTransfer: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.getDataTransfer; },
8829
+ /* harmony export */ getHAlign: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.getHAlign; },
8767
8830
  /* harmony export */ getPropertyDescriptor: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.getPropertyDescriptor; },
8768
8831
  /* harmony export */ getXPathByElement: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_24__.getXPathByElement; },
8769
8832
  /* harmony export */ hAlignElement: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.hAlignElement; },
@@ -8794,7 +8857,7 @@ __webpack_require__.r(__webpack_exports__);
8794
8857
  /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28712);
8795
8858
  /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_assert__WEBPACK_IMPORTED_MODULE_2__);
8796
8859
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
8797
- /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _assert__WEBPACK_IMPORTED_MODULE_2__) if(["default","alignElement","clearAlign","hAlignElement","alreadyLoadedList","appendScriptAsync","appendStyleAsync","loadNext","loadNextStyle"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = function(key) { return _assert__WEBPACK_IMPORTED_MODULE_2__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
8860
+ /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _assert__WEBPACK_IMPORTED_MODULE_2__) if(["default","alignElement","clearAlign","getHAlign","hAlignElement","alreadyLoadedList","appendScriptAsync","appendStyleAsync","loadNext","loadNextStyle"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = function(key) { return _assert__WEBPACK_IMPORTED_MODULE_2__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
8798
8861
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
8799
8862
  /* harmony import */ var _attr__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7909);
8800
8863
  /* harmony import */ var _browser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26136);
@@ -10721,11 +10784,12 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
10721
10784
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
10722
10785
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
10723
10786
  /* harmony import */ var jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(28686);
10724
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(28712);
10725
- /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_7__);
10726
- /* harmony import */ var jodit_core_selection_helpers_move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(7470);
10727
- /* harmony import */ var _style_commit_style__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(84578);
10728
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(42259);
10787
+ /* harmony import */ var jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(16849);
10788
+ /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(28712);
10789
+ /* harmony import */ var jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8__);
10790
+ /* harmony import */ var jodit_core_selection_helpers_move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(7470);
10791
+ /* harmony import */ var _style_commit_style__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(84578);
10792
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(42259);
10729
10793
  /*!
10730
10794
  * Jodit Editor (https://xdsoft.net/jodit/)
10731
10795
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -10747,6 +10811,7 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
10747
10811
 
10748
10812
 
10749
10813
 
10814
+
10750
10815
  class Selection {
10751
10816
  /**
10752
10817
  * Short alias for this.jodit
@@ -11187,7 +11252,7 @@ class Selection {
11187
11252
  return node;
11188
11253
  }
11189
11254
  if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node)) {
11190
- const ret = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.findCorrectCurrentNode)(node, range, rightMode, sel.isCollapsed, checkChild, child);
11255
+ const ret = (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.findCorrectCurrentNode)(node, range, rightMode, sel.isCollapsed, checkChild, child);
11191
11256
  node = ret.node;
11192
11257
  rightMode = ret.rightMode;
11193
11258
  }
@@ -11331,6 +11396,10 @@ class Selection {
11331
11396
  if (styles && typeof styles === 'object') {
11332
11397
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.css)(image, styles);
11333
11398
  }
11399
+ const { imageDefaultAlign, imageAlignClasses } = this.j.o;
11400
+ if (imageDefaultAlign && imageDefaultAlign !== 'normal') {
11401
+ (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_7__.hAlignElement)(image, imageDefaultAlign, imageAlignClasses);
11402
+ }
11334
11403
  const onload = ()=>{
11335
11404
  if (image.naturalHeight < image.offsetHeight || image.naturalWidth < image.offsetWidth) {
11336
11405
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.css)(image, {
@@ -11455,7 +11524,7 @@ class Selection {
11455
11524
  const isSignificant = (elm)=>Boolean(elm && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(elm, 'br') && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(elm) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTemporary(elm) && !(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(elm) && this.j.e.fire('isInvisibleForCursor', elm) === true));
11456
11525
  // check right offset
11457
11526
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(container)) {
11458
- if ((0,_helpers__WEBPACK_IMPORTED_MODULE_10__.cursorInTheEdgeOfString)(container, offset, start, end)) {
11527
+ if ((0,_helpers__WEBPACK_IMPORTED_MODULE_11__.cursorInTheEdgeOfString)(container, offset, start, end)) {
11459
11528
  return false;
11460
11529
  }
11461
11530
  } else {
@@ -11850,8 +11919,8 @@ class Selection {
11850
11919
  * }) // will remove `color:red` from `span`
11851
11920
  * ```
11852
11921
  */ commitStyle(options) {
11853
- ;(0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_7__.assert)((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.size)(options) > 0, 'Need to pass at least one option');
11854
- const styleElm = new _style_commit_style__WEBPACK_IMPORTED_MODULE_9__.CommitStyle(options);
11922
+ ;(0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8__.assert)((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.size)(options) > 0, 'Need to pass at least one option');
11923
+ const styleElm = new _style_commit_style__WEBPACK_IMPORTED_MODULE_10__.CommitStyle(options);
11855
11924
  styleElm.apply(this.j);
11856
11925
  }
11857
11926
  /**
@@ -11901,7 +11970,7 @@ class Selection {
11901
11970
  }
11902
11971
  const fragment = leftRange.extractContents();
11903
11972
  const clearEmpties = (node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.each(node, (node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(node) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeRemove(node));
11904
- (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_7__.assert)(currentBox.parentNode, 'Splitting fails');
11973
+ (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_8__.assert)(currentBox.parentNode, 'Splitting fails');
11905
11974
  try {
11906
11975
  clearEmpties(fragment);
11907
11976
  clearEmpties(currentBox);
@@ -11954,7 +12023,7 @@ class Selection {
11954
12023
  const r = range.cloneRange();
11955
12024
  r.collapse(start);
11956
12025
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeInsertNode(r, fake);
11957
- (0,jodit_core_selection_helpers_move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_8__.moveTheNodeAlongTheEdgeOutward)(fake, start, this.j.editor);
12026
+ (0,jodit_core_selection_helpers_move_the_node_along_the_edge_outward__WEBPACK_IMPORTED_MODULE_9__.moveTheNodeAlongTheEdgeOutward)(fake, start, this.j.editor);
11958
12027
  return fake;
11959
12028
  };
11960
12029
  const leftFake = moveMaxEdgeFake(true);
@@ -33718,7 +33787,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('imageProperties
33718
33787
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
33719
33788
  /* harmony export */ readAlign: function() { return /* binding */ readAlign; }
33720
33789
  /* harmony export */ });
33721
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(80991);
33790
+ /* harmony import */ var jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16849);
33722
33791
  /*!
33723
33792
  * Jodit Editor (https://xdsoft.net/jodit/)
33724
33793
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -33728,20 +33797,9 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('imageProperties
33728
33797
  */
33729
33798
  /**
33730
33799
  * @private
33731
- */ function readAlign(image, values) {
33732
- // Align
33733
- if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'float') && [
33734
- 'left',
33735
- 'right'
33736
- ].indexOf((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'float').toLowerCase()) !== -1) {
33737
- values.align = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, 'float');
33738
- } else {
33739
- if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, 'display') === 'block' && (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'margin-left') === 'auto' && (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, 'margin-right') === 'auto') {
33740
- values.align = 'center';
33741
- } else {
33742
- values.align = '';
33743
- }
33744
- }
33800
+ */ function readAlign(image, values, classes) {
33801
+ const align = (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_0__.getHAlign)(image, classes);
33802
+ values.align = align === 'normal' ? '' : align;
33745
33803
  }
33746
33804
 
33747
33805
 
@@ -33780,7 +33838,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('imageProperties
33780
33838
  */ function readValuesFromImage(j, state) {
33781
33839
  return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function*() {
33782
33840
  const { sourceImage: image, values } = state;
33783
- (0,_align__WEBPACK_IMPORTED_MODULE_3__.readAlign)(image, values);
33841
+ (0,_align__WEBPACK_IMPORTED_MODULE_3__.readAlign)(image, values, j.o.imageAlignClasses);
33784
33842
  // Border radius
33785
33843
  values.borderRadius = parseInt((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(image, 'border-radius') || '0', 10) || 0;
33786
33844
  // Id
@@ -34832,7 +34890,7 @@ UIImagePositionTab = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__
34832
34890
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'id', id || null);
34833
34891
  }
34834
34892
  if (opt.image.editAlign) {
34835
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align);
34893
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align, j.o.imageAlignClasses);
34836
34894
  }
34837
34895
  }
34838
34896
 
@@ -35675,6 +35733,10 @@ const cmd = (control)=>control.args && (0,jodit_core_helpers_checker__WEBPACK_IM
35675
35733
 
35676
35734
 
35677
35735
 
35736
+ // Images align with `imageAlignClasses`; the wrappers of iframes and media
35737
+ // keep inline styles
35738
+ const alignClasses = (editor, elm)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, 'img') ? editor.o.imageAlignClasses : null;
35739
+ const currentAlign = (editor, elm)=>elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getHAlign)(elm, alignClasses(editor, elm)) : 'normal';
35678
35740
  const align = {
35679
35741
  name: 'left',
35680
35742
  childTemplate: (_, __, value)=>value,
@@ -35684,6 +35746,16 @@ const align = {
35684
35746
  'Center',
35685
35747
  'Normal'
35686
35748
  ],
35749
+ update: (editor, button)=>{
35750
+ const current = currentAlign(editor, button.target);
35751
+ button.state.icon.name = current === 'normal' ? 'left' : current;
35752
+ },
35753
+ isActive: (editor, button)=>currentAlign(editor, button.target) !== 'normal',
35754
+ isChildActive: (editor, button)=>{
35755
+ var _button_control_args;
35756
+ const [value] = (_button_control_args = button.control.args) !== null && _button_control_args !== void 0 ? _button_control_args : [];
35757
+ return (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_1__.isString)(value) && currentAlign(editor, button.target) === value.toLowerCase();
35758
+ },
35687
35759
  exec: (editor, elm, { control })=>{
35688
35760
  if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
35689
35761
  'img',
@@ -35696,7 +35768,7 @@ const align = {
35696
35768
  if (!command) {
35697
35769
  return false;
35698
35770
  }
35699
- ;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command);
35771
+ ;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command, alignClasses(editor, elm));
35700
35772
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
35701
35773
  'jodit',
35702
35774
  'jodit-media'