jodit 4.17.5 → 4.18.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 (105) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/es2015/jodit.css +87 -3
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +9 -9
  5. package/es2015/jodit.js +873 -163
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +16 -16
  8. package/es2015/plugins/debug/debug.css +1 -1
  9. package/es2015/plugins/debug/debug.js +1 -1
  10. package/es2015/plugins/debug/debug.min.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  12. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  13. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  14. package/es2018/jodit.fat.min.css +1 -1
  15. package/es2018/jodit.fat.min.js +9 -9
  16. package/es2018/jodit.min.css +1 -1
  17. package/es2018/jodit.min.js +9 -9
  18. package/es2018/plugins/debug/debug.min.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  20. package/es2021/jodit.css +87 -3
  21. package/es2021/jodit.fat.min.css +1 -1
  22. package/es2021/jodit.fat.min.js +16 -16
  23. package/es2021/jodit.js +851 -163
  24. package/es2021/jodit.min.css +1 -1
  25. package/es2021/jodit.min.js +16 -16
  26. package/es2021/plugins/debug/debug.css +1 -1
  27. package/es2021/plugins/debug/debug.js +1 -1
  28. package/es2021/plugins/debug/debug.min.js +1 -1
  29. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  30. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  31. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  32. package/es2021.en/jodit.css +87 -3
  33. package/es2021.en/jodit.fat.min.css +1 -1
  34. package/es2021.en/jodit.fat.min.js +15 -15
  35. package/es2021.en/jodit.js +851 -163
  36. package/es2021.en/jodit.min.css +1 -1
  37. package/es2021.en/jodit.min.js +15 -15
  38. package/es2021.en/plugins/debug/debug.css +1 -1
  39. package/es2021.en/plugins/debug/debug.js +1 -1
  40. package/es2021.en/plugins/debug/debug.min.js +1 -1
  41. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  42. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  44. package/es5/jodit.css +92 -6
  45. package/es5/jodit.fat.min.css +1 -1
  46. package/es5/jodit.fat.min.js +2 -2
  47. package/es5/jodit.js +1141 -223
  48. package/es5/jodit.min.css +3 -3
  49. package/es5/jodit.min.js +2 -2
  50. package/es5/plugins/debug/debug.css +1 -1
  51. package/es5/plugins/debug/debug.js +1 -1
  52. package/es5/plugins/debug/debug.min.js +1 -1
  53. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  56. package/es5/polyfills.fat.min.js +1 -1
  57. package/es5/polyfills.js +1 -1
  58. package/es5/polyfills.min.js +1 -1
  59. package/esm/config.d.ts +65 -2
  60. package/esm/config.js +29 -2
  61. package/esm/core/constants.js +1 -1
  62. package/esm/core/helpers/utils/align.d.ts +11 -5
  63. package/esm/core/helpers/utils/align.js +28 -8
  64. package/esm/core/helpers/utils/index.d.ts +1 -0
  65. package/esm/core/helpers/utils/index.js +1 -0
  66. package/esm/core/helpers/utils/media-wrapper.d.ts +29 -0
  67. package/esm/core/helpers/utils/media-wrapper.js +63 -0
  68. package/esm/core/selection/selection.js +34 -8
  69. package/esm/modules/history/history.js +20 -12
  70. package/esm/modules/toolbar/button/button.d.ts +18 -0
  71. package/esm/modules/toolbar/button/button.js +75 -5
  72. package/esm/plugins/font/config.d.ts +12 -0
  73. package/esm/plugins/font/config.js +25 -10
  74. package/esm/plugins/font/font-picker.d.ts +51 -0
  75. package/esm/plugins/font/font-picker.js +238 -0
  76. package/esm/plugins/font/font.js +12 -0
  77. package/esm/plugins/font/google-fonts.d.ts +65 -0
  78. package/esm/plugins/font/google-fonts.js +143 -0
  79. package/esm/plugins/image-properties/readers/index.js +2 -1
  80. package/esm/plugins/image-properties/writers/index.js +2 -2
  81. package/esm/plugins/inline-popup/config/items/img.js +10 -8
  82. package/esm/plugins/inline-popup/inline-popup.js +13 -6
  83. package/esm/plugins/line-height/line-height.js +1 -1
  84. package/esm/plugins/media/config.d.ts +26 -1
  85. package/esm/plugins/media/config.js +1 -3
  86. package/esm/plugins/media/media.js +12 -4
  87. package/esm/plugins/placeholder/placeholder.js +1 -1
  88. package/esm/plugins/source/editor/engines/ace.d.ts +2 -0
  89. package/esm/plugins/source/editor/engines/ace.js +35 -3
  90. package/esm/plugins/video/config.js +24 -4
  91. package/esm/types/toolbar.d.ts +2 -0
  92. package/esm/types/types.d.ts +13 -1
  93. package/package.json +1 -1
  94. package/types/config.d.ts +65 -2
  95. package/types/core/helpers/utils/align.d.ts +11 -5
  96. package/types/core/helpers/utils/index.d.ts +1 -0
  97. package/types/core/helpers/utils/media-wrapper.d.ts +29 -0
  98. package/types/modules/toolbar/button/button.d.ts +18 -0
  99. package/types/plugins/font/config.d.ts +12 -0
  100. package/types/plugins/font/font-picker.d.ts +51 -0
  101. package/types/plugins/font/google-fonts.d.ts +65 -0
  102. package/types/plugins/media/config.d.ts +26 -1
  103. package/types/plugins/source/editor/engines/ace.d.ts +2 -0
  104. package/types/types/toolbar.d.ts +2 -0
  105. package/types/types/types.d.ts +13 -1
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.17.5
4
+ * Version: v4.18.0
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -735,18 +735,43 @@ let ConfigPrototype = {};
735
735
  /**
736
736
  * Class names to align images with, instead of an inline `float` or
737
737
  * `margin`. Aligning an image removes every class listed here and adds the
738
- * chosen alignment's, which can be several separated by spaces.
738
+ * chosen alignment's, which can be several separated by spaces. An
739
+ * alignment can also list several such sets, to recognise each of them;
740
+ * aligning writes the first. `alignClasses.img` takes its place when set.
739
741
  *
740
742
  * ```javascript
741
743
  * Jodit.make('#editor', {
742
744
  * imageAlignClasses: {
743
745
  * left: 'align-left',
744
746
  * right: 'align-right',
745
- * center: 'align-center'
747
+ * center: ['align-center', 'centered']
746
748
  * }
747
749
  * });
748
750
  * ```
749
751
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "imageAlignClasses", null);
752
+ /**
753
+ * Class names to align elements with, by tag name, as `imageAlignClasses`
754
+ * does for images: `img`, and `video`, `audio` and `iframe` in the media
755
+ * popup. A media wrapper (see `mediaWrappers`), and Jodit's own `jodit` and
756
+ * `jodit-media` wrappers, are aligned with the classes for the media in
757
+ * them.
758
+ *
759
+ * ```javascript
760
+ * const media = {
761
+ * left: 'media-left',
762
+ * right: 'media-right',
763
+ * center: 'media-center'
764
+ * };
765
+ *
766
+ * Jodit.make('#editor', {
767
+ * alignClasses: { video: media, iframe: media }
768
+ * });
769
+ * ```
770
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "alignClasses", {});
771
+ /**
772
+ * Alignment given to the media the video popup inserts. `'normal'` leaves
773
+ * them unaligned
774
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "mediaDefaultAlign", 'normal');
750
775
  /**
751
776
  * Do not display these buttons that are on the list
752
777
  *
@@ -1805,7 +1830,7 @@ __webpack_require__.r(__webpack_exports__);
1805
1830
  * ```
1806
1831
  * @packageDocumentation
1807
1832
  * @module constants
1808
- */ const APP_VERSION = "4.17.5";
1833
+ */ const APP_VERSION = "4.18.0";
1809
1834
  // prettier-ignore
1810
1835
  const ES = "es2015";
1811
1836
  const IS_ES_MODERN = true;
@@ -7603,12 +7628,15 @@ function trimChars(value, chars) {
7603
7628
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7604
7629
  /* harmony export */ alignElement: function() { return /* binding */ alignElement; },
7605
7630
  /* harmony export */ clearAlign: function() { return /* binding */ clearAlign; },
7631
+ /* harmony export */ getAlignClasses: function() { return /* binding */ getAlignClasses; },
7606
7632
  /* harmony export */ getHAlign: function() { return /* binding */ getHAlign; },
7607
7633
  /* harmony export */ hAlignElement: function() { return /* binding */ hAlignElement; }
7608
7634
  /* harmony export */ });
7609
7635
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
7610
- /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7909);
7611
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80991);
7636
+ /* harmony import */ var jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17312);
7637
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7909);
7638
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(80991);
7639
+ /* harmony import */ var jodit_core_helpers_utils_media_wrapper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(83314);
7612
7640
  /*!
7613
7641
  * Jodit Editor (https://xdsoft.net/jodit/)
7614
7642
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -7618,32 +7646,55 @@ function trimChars(value, chars) {
7618
7646
  */
7619
7647
 
7620
7648
 
7621
- const classNames = (value)=>(value !== null && value !== void 0 ? value : '').split(/\s+/).filter(Boolean);
7649
+
7650
+
7651
+ // The sets of class names an alignment lists, the first being the one to write
7652
+ const classSets = (value)=>((0,jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_1__.isArray)(value) ? value : [
7653
+ value !== null && value !== void 0 ? value : ''
7654
+ ]).map((set)=>set.split(/\s+/).filter(Boolean)).filter((set)=>set.length);
7622
7655
  /**
7623
- * Align image, with `classes` (see `imageAlignClasses`) instead of inline
7624
- * styles when they are given
7656
+ * The class names to align `elm` with: `alignClasses` for its tag, or for the
7657
+ * media in it when it wraps media (a `mediaWrappers` wrapper, `jodit` or
7658
+ * `jodit-media`), falling back to `imageAlignClasses` for an image
7659
+ */ function getAlignClasses(jodit, elm) {
7660
+ var _ref;
7661
+ var _jodit_o_alignClasses;
7662
+ if (!elm) {
7663
+ return null;
7664
+ }
7665
+ const media = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
7666
+ 'jodit',
7667
+ 'jodit-media'
7668
+ ])) ? elm.firstElementChild : (0,jodit_core_helpers_utils_media_wrapper__WEBPACK_IMPORTED_MODULE_4__.getWrappedMedia)(jodit, elm);
7669
+ const tag = (media !== null && media !== void 0 ? media : elm).nodeName.toLowerCase();
7670
+ return (_ref = (_jodit_o_alignClasses = jodit.o.alignClasses) === null || _jodit_o_alignClasses === void 0 ? void 0 : _jodit_o_alignClasses[tag]) !== null && _ref !== void 0 ? _ref : tag === 'img' ? jodit.o.imageAlignClasses : null;
7671
+ }
7672
+ /**
7673
+ * Align image, with `classes` (see `alignClasses`) instead of inline styles
7674
+ * when they are given
7625
7675
  */ function hAlignElement(image, align, classes) {
7626
7676
  if (classes) {
7677
+ var _classSets_;
7627
7678
  hAlignElement(image, 'normal');
7628
- Object.values(classes).forEach((value)=>image.classList.remove(...classNames(value)));
7629
- image.classList.add(...classNames(classes[align || 'normal']));
7679
+ Object.values(classes).forEach((value)=>classSets(value).forEach((set)=>image.classList.remove(...set)));
7680
+ image.classList.add(...(_classSets_ = classSets(classes[align || 'normal'])[0]) !== null && _classSets_ !== void 0 ? _classSets_ : []);
7630
7681
  [
7631
7682
  'class',
7632
7683
  'style'
7633
7684
  ].forEach((name)=>{
7634
7685
  var _attr;
7635
- if (!((_attr = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, name)) === null || _attr === void 0 ? void 0 : _attr.trim())) {
7636
- (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, name, null);
7686
+ if (!((_attr = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(image, name)) === null || _attr === void 0 ? void 0 : _attr.trim())) {
7687
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(image, name, null);
7637
7688
  }
7638
7689
  });
7639
7690
  return;
7640
7691
  }
7641
7692
  if (align && align !== 'normal') {
7642
7693
  if (align !== 'center') {
7643
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float', align);
7644
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.clearCenterAlign)(image);
7694
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, 'float', align);
7695
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.clearCenterAlign)(image);
7645
7696
  } else {
7646
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(image, {
7697
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, {
7647
7698
  float: '',
7648
7699
  display: 'block',
7649
7700
  marginLeft: 'auto',
@@ -7651,13 +7702,13 @@ const classNames = (value)=>(value !== null && value !== void 0 ? value : '').sp
7651
7702
  });
7652
7703
  }
7653
7704
  } else {
7654
- if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float') && [
7705
+ if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, 'float') && [
7655
7706
  'right',
7656
7707
  'left'
7657
- ].indexOf((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float').toString().toLowerCase()) !== -1) {
7658
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float', '');
7708
+ ].indexOf((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, 'float').toString().toLowerCase()) !== -1) {
7709
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, 'float', '');
7659
7710
  }
7660
- ;(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.clearCenterAlign)(image);
7711
+ ;(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.clearCenterAlign)(image);
7661
7712
  }
7662
7713
  }
7663
7714
  /**
@@ -7670,17 +7721,16 @@ const classNames = (value)=>(value !== null && value !== void 0 ? value : '').sp
7670
7721
  'center',
7671
7722
  'normal'
7672
7723
  ]){
7673
- const names = classNames(classes[align]);
7674
- if (names.length && names.every((name)=>elm.classList.contains(name))) {
7724
+ if (classSets(classes[align]).some((set)=>set.every((name)=>elm.classList.contains(name)))) {
7675
7725
  return align;
7676
7726
  }
7677
7727
  }
7678
7728
  }
7679
- const float = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(elm, 'float').toLowerCase();
7729
+ const float = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.cssInline)(elm, 'float').toLowerCase();
7680
7730
  if (float === 'left' || float === 'right') {
7681
7731
  return float;
7682
7732
  }
7683
- 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') {
7733
+ if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(elm, 'display') === 'block' && (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.cssInline)(elm, 'margin-left') === 'auto' && (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.cssInline)(elm, 'margin-right') === 'auto') {
7684
7734
  return 'center';
7685
7735
  }
7686
7736
  return 'normal';
@@ -7690,10 +7740,10 @@ const classNames = (value)=>(value !== null && value !== void 0 ? value : '').sp
7690
7740
  */ function clearAlign(node) {
7691
7741
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.each(node, (elm)=>{
7692
7742
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isHTMLElement(elm)) {
7693
- if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(elm, 'textAlign')) {
7694
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(elm, 'textAlign', '');
7695
- if (!((0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'style') || '').trim().length) {
7696
- (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'style', null);
7743
+ if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.cssInline)(elm, 'textAlign')) {
7744
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(elm, 'textAlign', '');
7745
+ if (!((0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(elm, 'style') || '').trim().length) {
7746
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(elm, 'style', null);
7697
7747
  }
7698
7748
  }
7699
7749
  }
@@ -7724,7 +7774,7 @@ function alignElement(command, box) {
7724
7774
  clearAlign(box);
7725
7775
  const align = ALIGN_BY_COMMAND.get(command.toLowerCase());
7726
7776
  if (align) {
7727
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(box, 'textAlign', align);
7777
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(box, 'textAlign', align);
7728
7778
  }
7729
7779
  }
7730
7780
  }
@@ -8810,13 +8860,13 @@ const getClassName = (obj)=>{
8810
8860
  "use strict";
8811
8861
  __webpack_require__.r(__webpack_exports__);
8812
8862
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8813
- /* harmony export */ $$: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_24__.$$; },
8863
+ /* harmony export */ $$: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_25__.$$; },
8814
8864
  /* harmony export */ ConfigDeepFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigDeepFlatten; },
8815
8865
  /* harmony export */ ConfigFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigFlatten; },
8816
8866
  /* harmony export */ ConfigMerge: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigMerge; },
8817
8867
  /* harmony export */ ConfigProto: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigProto; },
8818
8868
  /* harmony export */ ConnectionError: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.ConnectionError; },
8819
- /* harmony export */ LimitedStack: function() { return /* reexport safe */ _stack__WEBPACK_IMPORTED_MODULE_26__.LimitedStack; },
8869
+ /* harmony export */ LimitedStack: function() { return /* reexport safe */ _stack__WEBPACK_IMPORTED_MODULE_27__.LimitedStack; },
8820
8870
  /* harmony export */ OptionsError: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.OptionsError; },
8821
8871
  /* harmony export */ UNSAFE_PROTO_KEYS: function() { return /* reexport safe */ _is_unsafe_proto_key__WEBPACK_IMPORTED_MODULE_18__.UNSAFE_PROTO_KEYS; },
8822
8872
  /* harmony export */ abort: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.abort; },
@@ -8828,58 +8878,63 @@ __webpack_require__.r(__webpack_exports__);
8828
8878
  /* harmony export */ attrRaw: function() { return /* reexport safe */ _attr__WEBPACK_IMPORTED_MODULE_3__.attrRaw; },
8829
8879
  /* harmony export */ browser: function() { return /* reexport safe */ _browser__WEBPACK_IMPORTED_MODULE_4__.browser; },
8830
8880
  /* harmony export */ buildQuery: function() { return /* reexport safe */ _build_query__WEBPACK_IMPORTED_MODULE_5__.buildQuery; },
8831
- /* harmony export */ call: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.call; },
8832
- /* harmony export */ callPromise: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.callPromise; },
8833
- /* harmony export */ callThis: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.callThis; },
8881
+ /* harmony export */ call: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.call; },
8882
+ /* harmony export */ callPromise: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.callPromise; },
8883
+ /* harmony export */ callThis: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.callThis; },
8834
8884
  /* harmony export */ clearAlign: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.clearAlign; },
8835
8885
  /* harmony export */ clearCenterAlign: function() { return /* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_9__.clearCenterAlign; },
8836
8886
  /* harmony export */ cns: function() { return /* reexport safe */ _mark_deprecated__WEBPACK_IMPORTED_MODULE_19__.cns; },
8837
8887
  /* harmony export */ completeUrl: function() { return /* reexport safe */ _complete_url__WEBPACK_IMPORTED_MODULE_6__.completeUrl; },
8838
8888
  /* harmony export */ connection: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.connection; },
8839
8889
  /* harmony export */ convertMediaUrlToVideoEmbed: function() { return /* reexport safe */ _convert_media_url_to_video_embed__WEBPACK_IMPORTED_MODULE_8__.convertMediaUrlToVideoEmbed; },
8890
+ /* harmony export */ createMediaWrapper: function() { return /* reexport safe */ _media_wrapper__WEBPACK_IMPORTED_MODULE_20__.createMediaWrapper; },
8840
8891
  /* harmony export */ css: function() { return /* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_9__.css; },
8841
8892
  /* harmony export */ cssInline: function() { return /* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_9__.cssInline; },
8842
- /* harmony export */ cssPath: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_24__.cssPath; },
8893
+ /* harmony export */ cssPath: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_25__.cssPath; },
8843
8894
  /* harmony export */ ctrlKey: function() { return /* reexport safe */ _ctrl_key__WEBPACK_IMPORTED_MODULE_10__.ctrlKey; },
8844
8895
  /* harmony export */ dataBind: function() { return /* reexport safe */ _data_bind__WEBPACK_IMPORTED_MODULE_11__.dataBind; },
8845
8896
  /* harmony export */ defaultLanguage: function() { return /* reexport safe */ _default_language__WEBPACK_IMPORTED_MODULE_12__.defaultLanguage; },
8846
8897
  /* harmony export */ error: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.error; },
8847
8898
  /* harmony export */ fastClone: function() { return /* reexport safe */ _extend__WEBPACK_IMPORTED_MODULE_14__.fastClone; },
8848
8899
  /* harmony export */ get: function() { return /* reexport safe */ _get__WEBPACK_IMPORTED_MODULE_15__.get; },
8900
+ /* harmony export */ getAlignClasses: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.getAlignClasses; },
8849
8901
  /* harmony export */ getClassName: function() { return /* reexport safe */ _get_class_name__WEBPACK_IMPORTED_MODULE_16__.getClassName; },
8850
- /* harmony export */ getDataTransfer: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.getDataTransfer; },
8902
+ /* harmony export */ getDataTransfer: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.getDataTransfer; },
8851
8903
  /* harmony export */ getHAlign: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.getHAlign; },
8852
- /* harmony export */ getPropertyDescriptor: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.getPropertyDescriptor; },
8853
- /* harmony export */ getXPathByElement: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_24__.getXPathByElement; },
8904
+ /* harmony export */ getMediaWrapper: function() { return /* reexport safe */ _media_wrapper__WEBPACK_IMPORTED_MODULE_20__.getMediaWrapper; },
8905
+ /* harmony export */ getPropertyDescriptor: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.getPropertyDescriptor; },
8906
+ /* harmony export */ getWrappedMedia: function() { return /* reexport safe */ _media_wrapper__WEBPACK_IMPORTED_MODULE_20__.getWrappedMedia; },
8907
+ /* harmony export */ getXPathByElement: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_25__.getXPathByElement; },
8854
8908
  /* harmony export */ hAlignElement: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.hAlignElement; },
8855
8909
  /* harmony export */ humanSizeToBytes: function() { return /* reexport safe */ _human_size_to_bytes__WEBPACK_IMPORTED_MODULE_17__.humanSizeToBytes; },
8856
- /* harmony export */ inView: function() { return /* reexport safe */ _scroll_into_view__WEBPACK_IMPORTED_MODULE_23__.inView; },
8910
+ /* harmony export */ inView: function() { return /* reexport safe */ _scroll_into_view__WEBPACK_IMPORTED_MODULE_24__.inView; },
8857
8911
  /* harmony export */ isAtom: function() { return /* reexport safe */ _extend__WEBPACK_IMPORTED_MODULE_14__.isAtom; },
8858
8912
  /* harmony export */ isUnsafeProtoKey: function() { return /* reexport safe */ _is_unsafe_proto_key__WEBPACK_IMPORTED_MODULE_18__.isUnsafeProtoKey; },
8859
8913
  /* harmony export */ keepNames: function() { return /* reexport safe */ _get_class_name__WEBPACK_IMPORTED_MODULE_16__.keepNames; },
8860
- /* harmony export */ keys: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.keys; },
8861
- /* harmony export */ loadImage: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.loadImage; },
8914
+ /* harmony export */ keys: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.keys; },
8915
+ /* harmony export */ loadImage: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.loadImage; },
8862
8916
  /* harmony export */ loadNext: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.loadNext; },
8863
8917
  /* harmony export */ loadNextStyle: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.loadNextStyle; },
8864
8918
  /* harmony export */ markAsAtomic: function() { return /* reexport safe */ _extend__WEBPACK_IMPORTED_MODULE_14__.markAsAtomic; },
8865
8919
  /* harmony export */ markDeprecated: function() { return /* reexport safe */ _mark_deprecated__WEBPACK_IMPORTED_MODULE_19__.markDeprecated; },
8866
- /* harmony export */ markOwner: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.markOwner; },
8867
- /* harmony export */ memorizeExec: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.memorizeExec; },
8920
+ /* harmony export */ markOwner: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.markOwner; },
8921
+ /* harmony export */ memorizeExec: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.memorizeExec; },
8868
8922
  /* harmony export */ options: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.options; },
8869
- /* harmony export */ parseQuery: function() { return /* reexport safe */ _parse_query__WEBPACK_IMPORTED_MODULE_20__.parseQuery; },
8870
- /* harmony export */ previewBox: function() { return /* reexport safe */ _print__WEBPACK_IMPORTED_MODULE_21__.previewBox; },
8871
- /* harmony export */ refs: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_24__.refs; },
8872
- /* harmony export */ reset: function() { return /* reexport safe */ _reset__WEBPACK_IMPORTED_MODULE_22__.reset; },
8873
- /* harmony export */ resolveElement: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_24__.resolveElement; },
8874
- /* harmony export */ scrollIntoViewIfNeeded: function() { return /* reexport safe */ _scroll_into_view__WEBPACK_IMPORTED_MODULE_23__.scrollIntoViewIfNeeded; },
8875
- /* harmony export */ set: function() { return /* reexport safe */ _set__WEBPACK_IMPORTED_MODULE_25__.set; }
8923
+ /* harmony export */ parseQuery: function() { return /* reexport safe */ _parse_query__WEBPACK_IMPORTED_MODULE_21__.parseQuery; },
8924
+ /* harmony export */ previewBox: function() { return /* reexport safe */ _print__WEBPACK_IMPORTED_MODULE_22__.previewBox; },
8925
+ /* harmony export */ refs: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_25__.refs; },
8926
+ /* harmony export */ reset: function() { return /* reexport safe */ _reset__WEBPACK_IMPORTED_MODULE_23__.reset; },
8927
+ /* harmony export */ resolveElement: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_25__.resolveElement; },
8928
+ /* harmony export */ scrollIntoViewIfNeeded: function() { return /* reexport safe */ _scroll_into_view__WEBPACK_IMPORTED_MODULE_24__.scrollIntoViewIfNeeded; },
8929
+ /* harmony export */ set: function() { return /* reexport safe */ _set__WEBPACK_IMPORTED_MODULE_26__.set; },
8930
+ /* harmony export */ wrapMedia: function() { return /* reexport safe */ _media_wrapper__WEBPACK_IMPORTED_MODULE_20__.wrapMedia; }
8876
8931
  /* harmony export */ });
8877
8932
  /* harmony import */ var _align__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16849);
8878
8933
  /* harmony import */ var _append_script__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(47760);
8879
8934
  /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28712);
8880
8935
  /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_assert__WEBPACK_IMPORTED_MODULE_2__);
8881
8936
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
8882
- /* 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__)
8937
+ /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _assert__WEBPACK_IMPORTED_MODULE_2__) if(["default","alignElement","clearAlign","getAlignClasses","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__)
8883
8938
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
8884
8939
  /* harmony import */ var _attr__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7909);
8885
8940
  /* harmony import */ var _browser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26136);
@@ -8898,14 +8953,15 @@ __webpack_require__.r(__webpack_exports__);
8898
8953
  /* harmony import */ var _human_size_to_bytes__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(37427);
8899
8954
  /* harmony import */ var _is_unsafe_proto_key__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(78048);
8900
8955
  /* harmony import */ var _mark_deprecated__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(49385);
8901
- /* harmony import */ var _parse_query__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(36310);
8902
- /* harmony import */ var _print__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(57075);
8903
- /* harmony import */ var _reset__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(43379);
8904
- /* harmony import */ var _scroll_into_view__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(60898);
8905
- /* harmony import */ var _selector__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(28723);
8906
- /* harmony import */ var _set__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(52144);
8907
- /* harmony import */ var _stack__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(42820);
8908
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(71125);
8956
+ /* harmony import */ var _media_wrapper__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(83314);
8957
+ /* harmony import */ var _parse_query__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(36310);
8958
+ /* harmony import */ var _print__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(57075);
8959
+ /* harmony import */ var _reset__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(43379);
8960
+ /* harmony import */ var _scroll_into_view__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(60898);
8961
+ /* harmony import */ var _selector__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(28723);
8962
+ /* harmony import */ var _set__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(52144);
8963
+ /* harmony import */ var _stack__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(42820);
8964
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(71125);
8909
8965
  /*!
8910
8966
  * Jodit Editor (https://xdsoft.net/jodit/)
8911
8967
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -8940,6 +8996,7 @@ __webpack_require__.r(__webpack_exports__);
8940
8996
 
8941
8997
 
8942
8998
 
8999
+
8943
9000
 
8944
9001
 
8945
9002
  /***/ }),
@@ -9012,6 +9069,79 @@ __webpack_require__.r(__webpack_exports__);
9012
9069
  /* harmony export */ ]);
9013
9070
 
9014
9071
 
9072
+ /***/ }),
9073
+
9074
+ /***/ 83314:
9075
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9076
+
9077
+ "use strict";
9078
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9079
+ /* harmony export */ createMediaWrapper: function() { return /* binding */ createMediaWrapper; },
9080
+ /* harmony export */ getMediaWrapper: function() { return /* binding */ getMediaWrapper; },
9081
+ /* harmony export */ getWrappedMedia: function() { return /* binding */ getWrappedMedia; },
9082
+ /* harmony export */ wrapMedia: function() { return /* binding */ wrapMedia; }
9083
+ /* harmony export */ });
9084
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
9085
+ /*!
9086
+ * Jodit Editor (https://xdsoft.net/jodit/)
9087
+ * Released under MIT see LICENSE.txt in the project root for license information.
9088
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
9089
+ */ /**
9090
+ * @module helpers/utils
9091
+ */
9092
+ const isWrapper = (node, wrapper)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isHTMLElement(node) && node.nodeName.toLowerCase() === wrapper.tag.toLowerCase() && node.classList.contains(wrapper.className);
9093
+ /**
9094
+ * The media in `elm` when `elm` is a wrapper media keep in the content (see
9095
+ * `mediaWrappers`): an element of a type `elm` is the wrapper for
9096
+ */ function getWrappedMedia(jodit, elm) {
9097
+ var _jodit_o_mediaWrappers;
9098
+ for (const [tag, wrapper] of Object.entries((_jodit_o_mediaWrappers = jodit.o.mediaWrappers) !== null && _jodit_o_mediaWrappers !== void 0 ? _jodit_o_mediaWrappers : {})){
9099
+ if (isWrapper(elm, wrapper)) {
9100
+ const media = elm.querySelector(tag);
9101
+ if (media) {
9102
+ return media;
9103
+ }
9104
+ }
9105
+ }
9106
+ return null;
9107
+ }
9108
+ /**
9109
+ * The wrapper media keep in the content (see `mediaWrappers`) that is or
9110
+ * holds `node`
9111
+ */ function getMediaWrapper(jodit, node) {
9112
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(node, (elm)=>Boolean(getWrappedMedia(jodit, elm)), jodit.editor);
9113
+ }
9114
+ /**
9115
+ * An empty wrapper for media of type `tag` to keep in the content (see
9116
+ * `mediaWrappers`), or null when there is none for it
9117
+ */ function createMediaWrapper(jodit, tag) {
9118
+ var _jodit_o_mediaWrappers;
9119
+ const wrapper = (_jodit_o_mediaWrappers = jodit.o.mediaWrappers) === null || _jodit_o_mediaWrappers === void 0 ? void 0 : _jodit_o_mediaWrappers[tag.toLowerCase()];
9120
+ if (!wrapper) {
9121
+ return null;
9122
+ }
9123
+ return jodit.createInside.element(wrapper.tag, {
9124
+ class: wrapper.className,
9125
+ contenteditable: false,
9126
+ draggable: true
9127
+ });
9128
+ }
9129
+ /**
9130
+ * Puts `element` in the wrapper for its type (see `mediaWrappers`), and
9131
+ * returns the wrapper, or `element` when there is none for it
9132
+ */ function wrapMedia(jodit, element) {
9133
+ const wrapper = createMediaWrapper(jodit, element.nodeName);
9134
+ if (!wrapper) {
9135
+ return element;
9136
+ }
9137
+ if (element.parentNode) {
9138
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.before(element, wrapper);
9139
+ }
9140
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.append(wrapper, element);
9141
+ return wrapper;
9142
+ }
9143
+
9144
+
9015
9145
  /***/ }),
9016
9146
 
9017
9147
  /***/ 36310:
@@ -10901,6 +11031,12 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
10901
11031
 
10902
11032
 
10903
11033
 
11034
+ /**
11035
+ * A text node that is empty or holds only invisible caret placeholders.
11036
+ */ function isBlankTextNode(node) {
11037
+ var _node_nodeValue;
11038
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) && ((_node_nodeValue = node.nodeValue) !== null && _node_nodeValue !== void 0 ? _node_nodeValue : '').replace(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.INVISIBLE_SPACE_REG_EXP(), '').length === 0;
11039
+ }
10904
11040
  class Selection {
10905
11041
  /**
10906
11042
  * Short alias for this.jodit
@@ -11152,10 +11288,22 @@ class Selection {
11152
11288
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(marker, this.j.createInside.text(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.INVISIBLE_SPACE));
11153
11289
  if (newRange) {
11154
11290
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.area, atStart ? newRange.startContainer : newRange.endContainer)) {
11155
- // Here need do unsafe inserting
11156
- // Deny Dom.safeInsertNode(newRange, marker);
11157
- // Apply style -> Test Style module -> Base apply -> For selection <p><strong>|test|</strong></p> apply style {"element":"em","style":{"fontStyle":"italic"}}
11158
- newRange.insertNode(marker);
11291
+ var _node_nodeValue;
11292
+ const { startContainer: node, startOffset: offset } = newRange;
11293
+ // At either end of a text node the marker goes beside it. Splitting
11294
+ // the node there would leave the selection's boundary in an empty
11295
+ // text node, and WebKit neither repaints a selection that leaves one
11296
+ // nor moves a selection that follows one when it's removed.
11297
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) && offset === 0) {
11298
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.before(node, marker);
11299
+ } else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) && offset === ((_node_nodeValue = node.nodeValue) === null || _node_nodeValue === void 0 ? void 0 : _node_nodeValue.length)) {
11300
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.after(node, marker);
11301
+ } else {
11302
+ // Here need do unsafe inserting
11303
+ // Deny Dom.safeInsertNode(newRange, marker);
11304
+ // Apply style -> Test Style module -> Base apply -> For selection <p><strong>|test|</strong></p> apply style {"element":"em","style":{"fontStyle":"italic"}}
11305
+ newRange.insertNode(marker);
11306
+ }
11159
11307
  }
11160
11308
  }
11161
11309
  return marker;
@@ -11485,7 +11633,9 @@ class Selection {
11485
11633
  }
11486
11634
  ].forEach((getChildNode)=>{
11487
11635
  const childNode = getChildNode();
11488
- if (childNode && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(childNode)) {
11636
+ // Only a text node left with nothing in it by the split
11637
+ // goes; one holding a space is content (`<b>a</b> |`).
11638
+ if (childNode && isBlankTextNode(childNode)) {
11489
11639
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeRemove(childNode);
11490
11640
  }
11491
11641
  });
@@ -11575,9 +11725,9 @@ class Selection {
11575
11725
  if (styles && typeof styles === 'object') {
11576
11726
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.css)(image, styles);
11577
11727
  }
11578
- const { imageDefaultAlign, imageAlignClasses } = this.j.o;
11728
+ const { imageDefaultAlign } = this.j.o;
11579
11729
  if (imageDefaultAlign && imageDefaultAlign !== 'normal') {
11580
- (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_7__.hAlignElement)(image, imageDefaultAlign, imageAlignClasses);
11730
+ (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_7__.hAlignElement)(image, imageDefaultAlign, (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_7__.getAlignClasses)(this.j, image));
11581
11731
  }
11582
11732
  const onload = ()=>{
11583
11733
  if (image.naturalHeight < image.offsetHeight || image.naturalWidth < image.offsetWidth) {
@@ -22499,19 +22649,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.history = {
22499
22649
  * Update history stack
22500
22650
  */ updateStack(replace = false) {
22501
22651
  const newValue = this.snapshot.make();
22502
- if (!_snapshot__WEBPACK_IMPORTED_MODULE_6__.Snapshot.equal(newValue, this.startValue)) {
22503
- const newCommand = new _command__WEBPACK_IMPORTED_MODULE_5__.Command(this.startValue, newValue, this, this.updateTick);
22504
- if (replace) {
22505
- const command = this.__stack.current();
22506
- if (command && this.updateTick === command.tick) {
22507
- this.__stack.replace(newCommand);
22508
- }
22509
- } else {
22510
- this.__stack.push(newCommand);
22511
- }
22652
+ if (_snapshot__WEBPACK_IMPORTED_MODULE_6__.Snapshot.equal(newValue, this.startValue)) {
22653
+ return;
22654
+ }
22655
+ // Only the selection moved, for example when the selection markers
22656
+ // went in before a switch to the source view. There is nothing to
22657
+ // undo, but the next change has to start from this selection.
22658
+ if (newValue.html === this.startValue.html) {
22512
22659
  this.startValue = newValue;
22513
- this.fireChangeStack();
22660
+ return;
22661
+ }
22662
+ const newCommand = new _command__WEBPACK_IMPORTED_MODULE_5__.Command(this.startValue, newValue, this, this.updateTick);
22663
+ if (replace) {
22664
+ const command = this.__stack.current();
22665
+ if (command && this.updateTick === command.tick) {
22666
+ this.__stack.replace(newCommand);
22667
+ }
22668
+ } else {
22669
+ this.__stack.push(newCommand);
22514
22670
  }
22671
+ this.startValue = newValue;
22672
+ this.fireChangeStack();
22515
22673
  }
22516
22674
  fireChangeStack() {
22517
22675
  var _this_j_events;
@@ -24740,6 +24898,7 @@ const INPUT_TAGS = new Set([
24740
24898
  'textarea',
24741
24899
  'select'
24742
24900
  ]);
24901
+ const TYPE_AHEAD_TIMEOUT = 1000;
24743
24902
  const FOCUSABLE_SELECTOR = [
24744
24903
  'button:not([disabled])',
24745
24904
  'a[href]',
@@ -25005,11 +25164,57 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
25005
25164
  items[(index + 1) % items.length].focus();
25006
25165
  break;
25007
25166
  default:
25008
- return;
25167
+ if (!this.control.list || !this.__typeAhead(e.key, items, index)) {
25168
+ return;
25169
+ }
25009
25170
  }
25010
25171
  e.preventDefault();
25011
25172
  e.stopPropagation();
25012
25173
  }
25174
+ /**
25175
+ * The mouse opens a dropdown without taking the focus out of the editor.
25176
+ * While a dropdown list is open, typing there searches the list, as in an
25177
+ * open `<select>`, instead of writing into the content
25178
+ */ __onEditorKeyDown(e) {
25179
+ if (!this.openedPopup || !this.control.list || e.altKey || e.ctrlKey || e.metaKey || !this.__typeAhead(e.key, this.__popupFocusables(), -1)) {
25180
+ return;
25181
+ }
25182
+ e.preventDefault();
25183
+ return false;
25184
+ }
25185
+ /**
25186
+ * Typing in a dropdown list focuses the next item whose label starts with
25187
+ * the typed text, whatever their case and accents, and repeating one letter
25188
+ * cycles through the items that start with it, like the WAI-ARIA menu
25189
+ * pattern's type-ahead. The typed text starts again after a pause, or once
25190
+ * the focus has moved on
25191
+ */ __typeAhead(key, items, index) {
25192
+ const now = Date.now();
25193
+ if (now - this.__typedAt > TYPE_AHEAD_TIMEOUT || items[index] !== this.__typedTo) {
25194
+ this.__typed = '';
25195
+ }
25196
+ if (key.length !== 1 || key === ' ' && !this.__typed) {
25197
+ return false;
25198
+ }
25199
+ this.__typedAt = now;
25200
+ this.__typed += key;
25201
+ this.__typedTo = items[index];
25202
+ const { compare } = new Intl.Collator(undefined, {
25203
+ usage: 'search',
25204
+ sensitivity: 'base'
25205
+ }), typed = this.__typed, cycle = Array.from(typed).every((char)=>compare(char, typed[0]) === 0), prefix = cycle ? typed[0] : typed, start = cycle ? index + 1 : Math.max(index, 0);
25206
+ for(let i = 0; i < items.length; i += 1){
25207
+ var _ref;
25208
+ var _item_textContent;
25209
+ const item = items[(start + i) % items.length], label = (_ref = (_item_textContent = item.textContent) === null || _item_textContent === void 0 ? void 0 : _item_textContent.trim()) !== null && _ref !== void 0 ? _ref : '';
25210
+ if (compare(label.slice(0, prefix.length), prefix) === 0) {
25211
+ item.focus();
25212
+ this.__typedTo = item;
25213
+ break;
25214
+ }
25215
+ }
25216
+ return true;
25217
+ }
25013
25218
  /**
25014
25219
  * Visible controls of the opened dropdown that can take the focus
25015
25220
  */ __popupFocusables() {
@@ -25022,12 +25227,17 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
25022
25227
  /**
25023
25228
  * Create an open popup list
25024
25229
  */ __openControlList(control) {
25025
- var _this_jodit_options_controls;
25230
+ var _this_jodit_options_controls, _ref, _ref1;
25231
+ var _this_toolbar, _control_popup;
25026
25232
  const controls = (_this_jodit_options_controls = this.jodit.options.controls) !== null && _this_jodit_options_controls !== void 0 ? _this_jodit_options_controls : {}, getControl = (key)=>(0,jodit_core_ui_helpers_get_control_type__WEBPACK_IMPORTED_MODULE_22__.findControlType)(key, controls);
25027
25233
  const list = control.list;
25028
25234
  const menu = this.openPopup();
25029
- const toolbar = (0,_factory__WEBPACK_IMPORTED_MODULE_25__.makeCollection)(this.j);
25030
25235
  menu.parentElement = this;
25236
+ const content = (_control_popup = control.popup) === null || _control_popup === void 0 ? void 0 : _control_popup.call(control, this.j, (_ref = (_ref1 = (_this_toolbar = this.toolbar) === null || _this_toolbar === void 0 ? void 0 : _this_toolbar.getTarget(this)) !== null && _ref1 !== void 0 ? _ref1 : this.target) !== null && _ref !== void 0 ? _ref : null, this.__closePopup, this);
25237
+ if (content) {
25238
+ return this.__openMenu(menu, content);
25239
+ }
25240
+ const toolbar = (0,_factory__WEBPACK_IMPORTED_MODULE_25__.makeCollection)(this.j);
25031
25241
  toolbar.parentElement = menu;
25032
25242
  toolbar.mode = 'vertical';
25033
25243
  const isListItem = (key)=>(0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_14__.isPlainObject)(key) && 'title' in key && 'value' in key;
@@ -25074,7 +25284,10 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
25074
25284
  return childControl;
25075
25285
  };
25076
25286
  toolbar.build((0,jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_11__.isArray)(list) ? list.map(getButton) : (0,jodit_core_helpers_utils_utils__WEBPACK_IMPORTED_MODULE_20__.keys)(list, false).map((key)=>getButton(key, list[key])), this.target);
25077
- menu.setContent(toolbar).open(()=>(0,jodit_core_helpers_size__WEBPACK_IMPORTED_MODULE_16__.position)(this.container), false, this.j.o.allowTabNavigation ? this.container : undefined);
25287
+ this.__openMenu(menu, toolbar);
25288
+ }
25289
+ __openMenu(menu, content) {
25290
+ menu.setContent(content).open(()=>(0,jodit_core_helpers_size__WEBPACK_IMPORTED_MODULE_16__.position)(this.container), false, this.j.o.allowTabNavigation ? this.container : undefined);
25078
25291
  this.state.activated = true;
25079
25292
  }
25080
25293
  onOutsideClick(e) {
@@ -25088,7 +25301,7 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
25088
25301
  openPopup() {
25089
25302
  this.__closePopup();
25090
25303
  this.openedPopup = new jodit_core_ui_popup_popup__WEBPACK_IMPORTED_MODULE_24__.Popup(this.j, false);
25091
- this.j.e.on(this.ow, 'mousedown touchstart', this.onOutsideClick).on('escape closeAllPopups', this.onOutsideClick).on(this.openedPopup.container, 'keydown', this.__onPopupKeyDown);
25304
+ this.j.e.on(this.ow, 'mousedown touchstart', this.onOutsideClick).on('escape closeAllPopups', this.onOutsideClick).on('keydown', this.__onEditorKeyDown).on(this.openedPopup.container, 'keydown', this.__onPopupKeyDown);
25092
25305
  return this.openedPopup;
25093
25306
  }
25094
25307
  __closePopup() {
@@ -25103,7 +25316,7 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
25103
25316
  // popup while the outer `removeChild` is still running and Chrome
25104
25317
  // throws NotFoundError. See #1458
25105
25318
  this.openedPopup = null;
25106
- this.j.e.off(this.ow, 'mousedown touchstart', this.onOutsideClick).off('escape closeAllPopups', this.onOutsideClick);
25319
+ this.j.e.off(this.ow, 'mousedown touchstart', this.onOutsideClick).off('escape closeAllPopups', this.onOutsideClick).off('keydown', this.__onEditorKeyDown);
25107
25320
  // The keyboard brought the focus into the dropdown: give it back to
25108
25321
  // the button, otherwise it would fall out to the document
25109
25322
  const { activeElement } = this.od, hadFocus = activeElement && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isOrContains(popup.container, activeElement);
@@ -25161,11 +25374,11 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
25161
25374
  return super.destruct();
25162
25375
  }
25163
25376
  constructor(jodit, control, target = null){
25164
- 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), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "state", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "trigger", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "openedPopup", void 0), this.control = control, this.target = target, this.state = (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_2__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_1__._)({}, (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.UIButtonState)()), {
25377
+ 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), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "state", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "trigger", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__typed", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__typedAt", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__typedTo", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "openedPopup", void 0), this.control = control, this.target = target, this.state = (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_2__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_1__._)({}, (0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.UIButtonState)()), {
25165
25378
  theme: 'toolbar',
25166
25379
  currentValue: '',
25167
25380
  hasTrigger: false
25168
- }), this.openedPopup = null;
25381
+ }), this.__typed = '', this.__typedAt = 0, this.__typedTo = null, this.openedPopup = null;
25169
25382
  const button = this.getElm('button');
25170
25383
  (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_18__.assert)(button, 'Element button should exists');
25171
25384
  this.button = button;
@@ -25214,6 +25427,9 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_21__.U
25214
25427
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
25215
25428
  jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_6__.autobind
25216
25429
  ], ToolbarButton.prototype, "__onPopupKeyDown", null);
25430
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
25431
+ jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_6__.autobind
25432
+ ], ToolbarButton.prototype, "__onEditorKeyDown", null);
25217
25433
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
25218
25434
  jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_6__.autobind
25219
25435
  ], ToolbarButton.prototype, "onOutsideClick", null);
@@ -32637,14 +32853,16 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_1__.pluginSystem.add('focus', focus);
32637
32853
  /* harmony import */ var _swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41411);
32638
32854
  /* harmony import */ var _swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15366);
32639
32855
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27795);
32640
- /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4040);
32641
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(80991);
32642
- /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(29434);
32643
- /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5266);
32644
- /* harmony import */ var _icons_font_svg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(48842);
32645
- /* harmony import */ var _icons_font_svg__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_icons_font_svg__WEBPACK_IMPORTED_MODULE_7__);
32646
- /* harmony import */ var _icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(25501);
32647
- /* harmony import */ var _icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_8__);
32856
+ /* harmony import */ var jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(17312);
32857
+ /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4040);
32858
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(80991);
32859
+ /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(29434);
32860
+ /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(5266);
32861
+ /* harmony import */ var _icons_font_svg__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(48842);
32862
+ /* harmony import */ var _icons_font_svg__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_icons_font_svg__WEBPACK_IMPORTED_MODULE_8__);
32863
+ /* harmony import */ var _icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(25501);
32864
+ /* harmony import */ var _icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_9__);
32865
+ /* harmony import */ var _font_picker__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(80045);
32648
32866
  /*!
32649
32867
  * Jodit Editor (https://xdsoft.net/jodit/)
32650
32868
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -32660,11 +32878,18 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_1__.pluginSystem.add('focus', focus);
32660
32878
 
32661
32879
 
32662
32880
 
32881
+
32882
+
32663
32883
  /**
32664
32884
  * Default font-size points
32665
- */ jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.prototype.defaultFontSizePoints = 'px';
32666
- jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_5__.Icon.set('font', (_icons_font_svg__WEBPACK_IMPORTED_MODULE_7___default())).set('fontsize', (_icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_8___default()));
32667
- jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.prototype.controls.fontsize = {
32885
+ */ jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.defaultFontSizePoints = 'px';
32886
+ jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.font = {
32887
+ googleFonts: {
32888
+ url: ''
32889
+ }
32890
+ };
32891
+ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_6__.Icon.set('font', (_icons_font_svg__WEBPACK_IMPORTED_MODULE_8___default())).set('fontsize', (_icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_9___default()));
32892
+ jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.controls.fontsize = {
32668
32893
  command: 'fontsize',
32669
32894
  data: {
32670
32895
  cssRule: 'font-size',
@@ -32710,7 +32935,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.prototype.controls.fontsize = {
32710
32935
  }
32711
32936
  const control = button.control;
32712
32937
  const cssKey = ((_control_data = control.data) === null || _control_data === void 0 ? void 0 : _control_data.cssRule) || 'font-size';
32713
- const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_4__.css)(box, cssKey);
32938
+ const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.css)(box, cssKey);
32714
32939
  if (cssKey === 'font-size') {
32715
32940
  const numValue = parseFloat(value.toString());
32716
32941
  if (editor.o.defaultFontSizePoints === 'pt') {
@@ -32744,11 +32969,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.prototype.controls.fontsize = {
32744
32969
  return keySet.has(normalize(value.toString()));
32745
32970
  }
32746
32971
  };
32747
- jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.prototype.controls.font = (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_1__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_0__._)({}, jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.prototype.controls.fontsize), {
32972
+ const hadSelection = new WeakSet();
32973
+ jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.controls.font = (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_1__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_0__._)({}, jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.controls.fontsize), {
32748
32974
  command: 'fontname',
32749
32975
  textTemplate: (j, value)=>{
32750
32976
  const [first] = value.split(',');
32751
- return (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_3__.trimChars)(first, '"\'');
32977
+ return (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_4__.trimChars)(first, '"\'');
32752
32978
  },
32753
32979
  list: {
32754
32980
  '': 'Default',
@@ -32770,6 +32996,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.prototype.controls.font = (0,_s
32770
32996
  } catch (unused) {}
32771
32997
  return `<span data-style="${key}" style="${isAvailable ? `font-family: ${key}!important;` : ''}">${value}</span>`;
32772
32998
  },
32999
+ popup: (editor, current, close, button)=>editor.o.font.googleFonts.url ? new _font_picker__WEBPACK_IMPORTED_MODULE_10__.UIFontPicker(editor, button, close) : false,
32773
33000
  data: {
32774
33001
  cssRule: 'font-family',
32775
33002
  normalize: (v)=>{
@@ -32778,19 +33005,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.prototype.controls.font = (0,_s
32778
33005
  },
32779
33006
  // When no font is explicitly set, the computed font-family equals the
32780
33007
  // editor's own default (e.g. `-apple-system, …`). Return '' so the
32781
- // button shows the `Default` list entry instead of that raw stack.
32782
- // See #1370
32783
- value: (editor)=>{
32784
- const current = editor.s.current();
32785
- if (!current) {
32786
- return;
32787
- }
32788
- const box = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isElement, editor.editor);
32789
- if (!box) {
33008
+ // button shows the list's `Default` entry, when it has one, instead of
33009
+ // that raw stack. See #1370
33010
+ value: (editor, button)=>{
33011
+ const current = editor.s.current(), box = current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isElement, editor.editor);
33012
+ // Until there is a selection the button shows the editor's own font,
33013
+ // and afterwards the font of the last one
33014
+ if (box) {
33015
+ hadSelection.add(button);
33016
+ } else if (hadSelection.has(button)) {
32790
33017
  return;
32791
33018
  }
32792
- const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_4__.css)(box, 'font-family').toString();
32793
- if (value === (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_4__.css)(editor.editor, 'font-family').toString()) {
33019
+ const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.css)(box || editor.editor, 'font-family').toString(), { list } = button.control;
33020
+ if (value === (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.css)(editor.editor, 'font-family').toString() && ((0,jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_3__.isArray)(list) ? list.includes('') : '' in (list !== null && list !== void 0 ? list : {}))) {
32794
33021
  return '';
32795
33022
  }
32796
33023
  return value;
@@ -32799,6 +33026,262 @@ jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.prototype.controls.font = (0,_s
32799
33026
  });
32800
33027
 
32801
33028
 
33029
+ /***/ }),
33030
+
33031
+ /***/ 80045:
33032
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
33033
+
33034
+ "use strict";
33035
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
33036
+ /* harmony export */ UIFontPicker: function() { return /* binding */ UIFontPicker; }
33037
+ /* harmony export */ });
33038
+ /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
33039
+ /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
33040
+ /* harmony import */ var jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(91672);
33041
+ /* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(68616);
33042
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
33043
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
33044
+ /* harmony import */ var jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(17312);
33045
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(7909);
33046
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(80991);
33047
+ /* harmony import */ var jodit_core_helpers_utils_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(71125);
33048
+ /* harmony import */ var jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(96007);
33049
+ /* harmony import */ var _google_fonts__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(24939);
33050
+ /*!
33051
+ * Jodit Editor (https://xdsoft.net/jodit/)
33052
+ * Released under MIT see LICENSE.txt in the project root for license information.
33053
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
33054
+ */ /**
33055
+ * @module plugins/font
33056
+ */
33057
+
33058
+
33059
+
33060
+
33061
+
33062
+
33063
+
33064
+
33065
+
33066
+
33067
+
33068
+
33069
+ const HEADINGS = [
33070
+ 'h1',
33071
+ 'h2',
33072
+ 'h3',
33073
+ 'h4',
33074
+ 'h5',
33075
+ 'h6'
33076
+ ];
33077
+ const GENERIC_FAMILIES = new Set([
33078
+ 'serif',
33079
+ 'sans-serif',
33080
+ 'monospace',
33081
+ 'cursive',
33082
+ 'fantasy',
33083
+ 'system-ui',
33084
+ 'ui-serif',
33085
+ 'ui-sans-serif',
33086
+ 'ui-monospace',
33087
+ 'ui-rounded'
33088
+ ]);
33089
+ /**
33090
+ * A family that names a font, not a generic family or a vendor keyword such
33091
+ * as `-apple-system`
33092
+ */ function isFontName(family) {
33093
+ return Boolean(family) && !family.startsWith('-') && !GENERIC_FAMILIES.has(family);
33094
+ }
33095
+ class UIFontPicker extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_10__.UIElement {
33096
+ className() {
33097
+ return 'UIFontPicker';
33098
+ }
33099
+ __render() {
33100
+ var _ref;
33101
+ var _control_value;
33102
+ const { control } = this.__button, { list = {} } = control, listed = (0,jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_6__.isArray)(list) ? list.map((key)=>({
33103
+ value: key.toString(),
33104
+ title: key.toString()
33105
+ })) : (0,jodit_core_helpers_utils_utils__WEBPACK_IMPORTED_MODULE_9__.keys)(list, false).map((key)=>({
33106
+ value: key,
33107
+ title: list[key].toString()
33108
+ })), google = Array.from(this.__googleFonts.fonts.values(), (font)=>({
33109
+ value: this.__googleFonts.value(font),
33110
+ title: font.family,
33111
+ font
33112
+ })), byFamily = new Map();
33113
+ [
33114
+ ...google,
33115
+ ...listed
33116
+ ].forEach((entry)=>byFamily.set((0,_google_fonts__WEBPACK_IMPORTED_MODULE_11__.firstFamily)(entry.value), entry));
33117
+ const theme = new Map(), used = new Map();
33118
+ // The theme's own fonts are listed too, so its body font can be chosen
33119
+ // to take a font off
33120
+ this.__themeFonts().forEach((fontFamily)=>{
33121
+ var _byFamily_get;
33122
+ const family = (0,_google_fonts__WEBPACK_IMPORTED_MODULE_11__.firstFamily)(fontFamily), title = fontFamily.split(',')[0].replace(/["']/g, '').trim(), entry = (_byFamily_get = byFamily.get(family)) !== null && _byFamily_get !== void 0 ? _byFamily_get : isFontName(family) ? {
33123
+ value: fontFamily,
33124
+ title
33125
+ } : undefined;
33126
+ entry && !theme.has(family) && theme.set(family, entry);
33127
+ });
33128
+ this.__usedFonts().forEach((fontFamily)=>{
33129
+ const family = (0,_google_fonts__WEBPACK_IMPORTED_MODULE_11__.firstFamily)(fontFamily), entry = byFamily.get(family);
33130
+ entry && !theme.has(family) && used.set(family, entry);
33131
+ });
33132
+ const defaultEntry = listed.find((entry)=>entry.value === ''), current = (0,_google_fonts__WEBPACK_IMPORTED_MODULE_11__.firstFamily)((_ref = (_control_value = control.value) === null || _control_value === void 0 ? void 0 : _control_value.call(control, this.j, this.__button)) !== null && _ref !== void 0 ? _ref : '');
33133
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.detach(this.container);
33134
+ this.__fonts.clear();
33135
+ defaultEntry && this.__append(current, [
33136
+ defaultEntry
33137
+ ]);
33138
+ this.__append(current, [
33139
+ ...theme.values()
33140
+ ], 'Theme fonts');
33141
+ this.__append(current, [
33142
+ ...used.values()
33143
+ ], 'Used fonts');
33144
+ this.__append(current, listed.filter((entry)=>entry !== defaultEntry), 'System fonts');
33145
+ this.__append(current, google, 'Google Fonts');
33146
+ this.__observeGoogleFonts();
33147
+ }
33148
+ /**
33149
+ * The fonts the editor's styles give text and each heading
33150
+ */ __themeFonts() {
33151
+ const { editor } = this.j, fonts = [
33152
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(editor, 'font-family').toString()
33153
+ ];
33154
+ HEADINGS.forEach((tag)=>{
33155
+ const heading = this.j.createInside.element(tag, {
33156
+ style: 'display: none'
33157
+ });
33158
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(editor, heading);
33159
+ fonts.push((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(heading, 'font-family').toString());
33160
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeRemove(heading);
33161
+ });
33162
+ return fonts;
33163
+ }
33164
+ /**
33165
+ * The fonts the content sets
33166
+ */ __usedFonts() {
33167
+ return Array.from(this.j.editor.querySelectorAll('[style*="font-family"]'), (element)=>element.style.fontFamily);
33168
+ }
33169
+ __append(current, entries, heading) {
33170
+ if (!entries.length) {
33171
+ return;
33172
+ }
33173
+ const { control } = this.__button, group = this.j.c.div(this.getFullElName('group'));
33174
+ if (heading) {
33175
+ const title = this.j.c.div(this.getFullElName('heading'), {
33176
+ id: `${this.getFullElName('heading')}-${(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.uniqueUid)()}`
33177
+ });
33178
+ title.textContent = this.i18n(heading);
33179
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__.attr)(group, {
33180
+ role: 'group',
33181
+ 'aria-labelledby': title.id
33182
+ });
33183
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(group, title);
33184
+ }
33185
+ entries.forEach((entry)=>{
33186
+ const item = this.j.c.element('button', {
33187
+ type: 'button',
33188
+ class: this.getFullElName('item'),
33189
+ 'data-value': entry.value,
33190
+ 'aria-pressed': (0,_google_fonts__WEBPACK_IMPORTED_MODULE_11__.firstFamily)(entry.value) === current
33191
+ });
33192
+ if (entry.font) {
33193
+ item.textContent = entry.title;
33194
+ this.__fonts.set(item, entry.font);
33195
+ } else {
33196
+ var _ref;
33197
+ var _control_childTemplate;
33198
+ item.innerHTML = (_ref = (_control_childTemplate = control.childTemplate) === null || _control_childTemplate === void 0 ? void 0 : _control_childTemplate.call(control, this.j, entry.value, entry.title, this.__button)) !== null && _ref !== void 0 ? _ref : entry.title;
33199
+ }
33200
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(group, item);
33201
+ });
33202
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(this.container, group);
33203
+ }
33204
+ /**
33205
+ * Shows the names of the Google Fonts in view, and those just below it,
33206
+ * in their own fonts. Setting every item's font up front would have the
33207
+ * browser look for each of the library's families among the installed
33208
+ * fonts the first time the list opens
33209
+ */ __observeGoogleFonts() {
33210
+ this.j.async.requestAnimationFrame(()=>{
33211
+ var _this___observer;
33212
+ (_this___observer = this.__observer) === null || _this___observer === void 0 ? void 0 : _this___observer.disconnect();
33213
+ if (this.isDestructed || !this.__fonts.size) {
33214
+ return;
33215
+ }
33216
+ const observer = new IntersectionObserver((entries)=>{
33217
+ const fonts = [];
33218
+ entries.forEach(({ isIntersecting, target })=>{
33219
+ const font = this.__fonts.get(target);
33220
+ if (isIntersecting && font) {
33221
+ fonts.push(font);
33222
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(target, {
33223
+ fontFamily: this.__googleFonts.value(font)
33224
+ });
33225
+ observer.unobserve(target);
33226
+ }
33227
+ });
33228
+ this.__googleFonts.preview(fonts);
33229
+ }, {
33230
+ root: this.container.parentElement,
33231
+ rootMargin: '0px 0px 400px 0px'
33232
+ });
33233
+ this.__fonts.forEach((_, item)=>observer.observe(item));
33234
+ this.__observer = observer;
33235
+ });
33236
+ }
33237
+ /**
33238
+ * Keeps the editor's selection, as the toolbar buttons do
33239
+ */ onMouseDown(e) {
33240
+ e.preventDefault();
33241
+ }
33242
+ onClick(e) {
33243
+ var _attr;
33244
+ const item = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.up(e.target, (node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isHTMLElement(node) && node.hasAttribute('data-value'), this.container);
33245
+ if (!item) {
33246
+ return;
33247
+ }
33248
+ const value = (_attr = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__.attr)(item, 'data-value')) !== null && _attr !== void 0 ? _attr : '', font = this.__googleFonts.find(value), // The font the text has anyway is taken off rather than written
33249
+ inherited = (0,_google_fonts__WEBPACK_IMPORTED_MODULE_11__.firstFamily)(value) === (0,_google_fonts__WEBPACK_IMPORTED_MODULE_11__.firstFamily)(this.__blockFont());
33250
+ font && !inherited && this.__googleFonts.load(font);
33251
+ this.j.execCommand('fontname', false, inherited ? '' : value);
33252
+ this.__close();
33253
+ }
33254
+ /**
33255
+ * The font the selected text has without a font of its own: its block's
33256
+ */ __blockFont() {
33257
+ const block = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.up(this.j.s.current(), jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock, this.j.editor);
33258
+ return (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(block !== null && block !== void 0 ? block : this.j.editor, 'font-family').toString();
33259
+ }
33260
+ destruct() {
33261
+ var _this___observer;
33262
+ (_this___observer = this.__observer) === null || _this___observer === void 0 ? void 0 : _this___observer.disconnect();
33263
+ super.destruct();
33264
+ }
33265
+ constructor(jodit, __button, __close){
33266
+ super(jodit), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__button", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__close", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__googleFonts", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__fonts", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__observer", void 0), this.__button = __button, this.__close = __close, this.__fonts = new Map(), this.__observer = null;
33267
+ this.__googleFonts = jodit.getInstance(_google_fonts__WEBPACK_IMPORTED_MODULE_11__.GoogleFonts);
33268
+ this.__render();
33269
+ if (!this.__googleFonts.fonts.size) {
33270
+ this.__googleFonts.ready.then(()=>!this.isDestructed && this.__render());
33271
+ }
33272
+ }
33273
+ }
33274
+ ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
33275
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_3__.watch)('container:mousedown')
33276
+ ], UIFontPicker.prototype, "onMouseDown", null);
33277
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
33278
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_3__.watch)('container:click')
33279
+ ], UIFontPicker.prototype, "onClick", null);
33280
+ UIFontPicker = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
33281
+ jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_2__.component
33282
+ ], UIFontPicker);
33283
+
33284
+
32802
33285
  /***/ }),
32803
33286
 
32804
33287
  /***/ 50294:
@@ -32809,6 +33292,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.prototype.controls.font = (0,_s
32809
33292
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28077);
32810
33293
  /* harmony import */ var jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
32811
33294
  /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7433);
33295
+ /* harmony import */ var _google_fonts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(24939);
32812
33296
  /*!
32813
33297
  * Jodit Editor (https://xdsoft.net/jodit/)
32814
33298
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -32820,6 +33304,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.prototype.controls.font = (0,_s
32820
33304
  */
32821
33305
 
32822
33306
 
33307
+
32823
33308
  /**
32824
33309
  * Process commands `fontsize` and `fontname`
32825
33310
  */ function font(editor) {
@@ -32830,6 +33315,18 @@ jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.prototype.controls.font = (0,_s
32830
33315
  name: 'fontsize',
32831
33316
  group: 'font'
32832
33317
  });
33318
+ if (editor.o.font.googleFonts.url) {
33319
+ const googleFonts = editor.getInstance(_google_fonts__WEBPACK_IMPORTED_MODULE_3__.GoogleFonts), loadUsed = editor.async.debounce(()=>googleFonts.loadUsed(), editor.defaultTimeout);
33320
+ googleFonts.ready.then(loadUsed);
33321
+ editor.e.on('afterInit afterSetMode change', loadUsed);
33322
+ }
33323
+ // An iframe's stylesheets can arrive after the toolbar first shows the
33324
+ // editor's font
33325
+ editor.e.on('afterInit', ()=>{
33326
+ editor.iframe && editor.e.on(editor.ed, 'load', ()=>editor.e.fire('updateToolbar'), {
33327
+ capture: true
33328
+ });
33329
+ });
32833
33330
  const callback = (command, second, third)=>{
32834
33331
  switch(command){
32835
33332
  case 'fontsize':
@@ -32859,6 +33356,162 @@ jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.prototype.controls.font = (0,_s
32859
33356
  jodit_core_global__WEBPACK_IMPORTED_MODULE_0__.pluginSystem.add('font', font);
32860
33357
 
32861
33358
 
33359
+ /***/ }),
33360
+
33361
+ /***/ 24939:
33362
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
33363
+
33364
+ "use strict";
33365
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
33366
+ /* harmony export */ GoogleFonts: function() { return /* binding */ GoogleFonts; },
33367
+ /* harmony export */ firstFamily: function() { return /* binding */ firstFamily; }
33368
+ /* harmony export */ });
33369
+ /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
33370
+ /* harmony import */ var jodit_core_component_view_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(59609);
33371
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(23211);
33372
+ /* harmony import */ var jodit_core_request_ajax__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(17338);
33373
+ /*!
33374
+ * Jodit Editor (https://xdsoft.net/jodit/)
33375
+ * Released under MIT see LICENSE.txt in the project root for license information.
33376
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
33377
+ */ /**
33378
+ * @module plugins/font
33379
+ */
33380
+
33381
+
33382
+
33383
+ const CSS_URL = 'https://fonts.googleapis.com/css2';
33384
+ // `cursive` and `fantasy` stand in badly for a handwriting or display font
33385
+ const GENERIC_FAMILIES = {
33386
+ serif: 'serif',
33387
+ monospace: 'monospace'
33388
+ };
33389
+ const libraries = new Map();
33390
+ /**
33391
+ * The fonts of the library at `url`, fetched once for every editor on the page
33392
+ */ function library(jodit, url) {
33393
+ let fonts = libraries.get(url);
33394
+ if (!fonts) {
33395
+ const ajax = new jodit_core_request_ajax__WEBPACK_IMPORTED_MODULE_3__.Ajax({
33396
+ url,
33397
+ method: 'GET'
33398
+ }, jodit.o.defaultAjaxOptions);
33399
+ fonts = ajax.send().then((response)=>response.json())// A font without a regular style can't be asked for by its name alone
33400
+ .then(({ items })=>items.filter((font)=>font.variants.includes('regular'))).catch(()=>{
33401
+ libraries.delete(url);
33402
+ return [];
33403
+ }).finally(()=>ajax.destruct());
33404
+ libraries.set(url, fonts);
33405
+ }
33406
+ return fonts;
33407
+ }
33408
+ /**
33409
+ * The first family of a `font-family` value, unquoted and in lower case for
33410
+ * comparing
33411
+ */ function firstFamily(fontFamily) {
33412
+ return fontFamily.split(',')[0].replace(/["']/g, '').trim().toLowerCase();
33413
+ }
33414
+ /**
33415
+ * Loads fonts from Google Fonts: the whole of each font the content uses into
33416
+ * the editor's document, and just the letters of its name for the font list
33417
+ */ class GoogleFonts extends jodit_core_component_view_component__WEBPACK_IMPORTED_MODULE_1__.ViewComponent {
33418
+ className() {
33419
+ return 'GoogleFonts';
33420
+ }
33421
+ /**
33422
+ * The library's font named first in a `font-family` value
33423
+ */ find(fontFamily) {
33424
+ return this.fonts.get(firstFamily(fontFamily));
33425
+ }
33426
+ /**
33427
+ * The `font-family` value that applies a font
33428
+ */ value(font) {
33429
+ var _GENERIC_FAMILIES_font_category;
33430
+ return `'${font.family}', ${(_GENERIC_FAMILIES_font_category = GENERIC_FAMILIES[font.category]) !== null && _GENERIC_FAMILIES_font_category !== void 0 ? _GENERIC_FAMILIES_font_category : 'sans-serif'}`;
33431
+ }
33432
+ /**
33433
+ * Loads the regular, italic, bold and bold italic styles that a font has
33434
+ * into the editor's document
33435
+ */ load(font) {
33436
+ const loaded = this.__loadedInto(this.j.ed);
33437
+ if (loaded.has(font.family)) {
33438
+ return;
33439
+ }
33440
+ loaded.add(font.family);
33441
+ const styles = [
33442
+ [
33443
+ 'regular',
33444
+ '0,400'
33445
+ ],
33446
+ [
33447
+ '700',
33448
+ '0,700'
33449
+ ],
33450
+ [
33451
+ 'italic',
33452
+ '1,400'
33453
+ ],
33454
+ [
33455
+ '700italic',
33456
+ '1,700'
33457
+ ]
33458
+ ].filter(([variant])=>font.variants.includes(variant)).map(([, style])=>style);
33459
+ this.__append(this.j.ed, `family=${this.__family(font)}:ital,wght@${styles.join(';')}`);
33460
+ }
33461
+ /**
33462
+ * Loads every font of the library that the content uses
33463
+ */ loadUsed() {
33464
+ this.j.editor.querySelectorAll('[style*="font-family"]').forEach((element)=>{
33465
+ const font = this.find(element.style.fontFamily);
33466
+ font && this.load(font);
33467
+ });
33468
+ }
33469
+ /**
33470
+ * Loads into the page just the letters of each font's name, so the font
33471
+ * list can show the name in its font
33472
+ */ preview(fonts) {
33473
+ const loaded = this.__loadedInto(this.j.od);
33474
+ fonts = fonts.filter((font)=>!this.__previewed.has(font.family) && !loaded.has(font.family));
33475
+ if (!fonts.length) {
33476
+ return;
33477
+ }
33478
+ fonts.forEach((font)=>this.__previewed.add(font.family));
33479
+ const families = fonts.map((font)=>`family=${this.__family(font)}`), letters = new Set(fonts.map((font)=>font.family).join(''));
33480
+ this.__append(this.j.od, `${families.join('&')}&text=${encodeURIComponent([
33481
+ ...letters
33482
+ ].join(''))}`);
33483
+ }
33484
+ __loadedInto(doc) {
33485
+ var _this___loaded_get;
33486
+ const loaded = (_this___loaded_get = this.__loaded.get(doc)) !== null && _this___loaded_get !== void 0 ? _this___loaded_get : new Set();
33487
+ this.__loaded.set(doc, loaded);
33488
+ return loaded;
33489
+ }
33490
+ __family(font) {
33491
+ return encodeURIComponent(font.family).replace(/%20/g, '+');
33492
+ }
33493
+ __append(doc, query) {
33494
+ const link = doc.createElement('link');
33495
+ link.rel = 'stylesheet';
33496
+ link.href = `${CSS_URL}?${query}&display=swap`;
33497
+ doc.head.appendChild(link);
33498
+ this.__links.push(link);
33499
+ }
33500
+ destruct() {
33501
+ this.__links.forEach((link)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(link));
33502
+ super.destruct();
33503
+ }
33504
+ constructor(jodit){
33505
+ super(jodit), /**
33506
+ * The library by lower-case family, empty until it arrives
33507
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "fonts", new Map()), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "ready", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__links", []), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__loaded", new WeakMap()), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__previewed", new Set());
33508
+ this.ready = library(jodit, jodit.o.font.googleFonts.url).then((fonts)=>{
33509
+ fonts.forEach((font)=>this.fonts.set(font.family.toLowerCase(), font));
33510
+ });
33511
+ }
33512
+ }
33513
+
33514
+
32862
33515
  /***/ }),
32863
33516
 
32864
33517
  /***/ 96863:
@@ -34129,12 +34782,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('imageProperties
34129
34782
  /* harmony export */ readValuesFromImage: function() { return /* binding */ readValuesFromImage; }
34130
34783
  /* harmony export */ });
34131
34784
  /* harmony import */ var _swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(49376);
34132
- /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7909);
34133
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80991);
34134
- /* harmony import */ var _align__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(26633);
34135
- /* harmony import */ var _link__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(79310);
34136
- /* harmony import */ var _margin__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(18380);
34137
- /* harmony import */ var _size__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(57339);
34785
+ /* harmony import */ var jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16849);
34786
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7909);
34787
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(80991);
34788
+ /* harmony import */ var _align__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26633);
34789
+ /* harmony import */ var _link__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(79310);
34790
+ /* harmony import */ var _margin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(18380);
34791
+ /* harmony import */ var _size__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(57339);
34138
34792
  /*!
34139
34793
  * Jodit Editor (https://xdsoft.net/jodit/)
34140
34794
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -34148,33 +34802,34 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('imageProperties
34148
34802
 
34149
34803
 
34150
34804
 
34805
+
34151
34806
  /**
34152
34807
  * Read values from image and set it to state
34153
34808
  * @private
34154
34809
  */ function readValuesFromImage(j, state) {
34155
34810
  return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function*() {
34156
34811
  const { sourceImage: image, values } = state;
34157
- (0,_align__WEBPACK_IMPORTED_MODULE_3__.readAlign)(image, values, j.o.imageAlignClasses);
34812
+ (0,_align__WEBPACK_IMPORTED_MODULE_4__.readAlign)(image, values, (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_1__.getAlignClasses)(j, image));
34158
34813
  // Border radius
34159
- values.borderRadius = parseInt((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(image, 'border-radius') || '0', 10) || 0;
34814
+ values.borderRadius = parseInt((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.cssInline)(image, 'border-radius') || '0', 10) || 0;
34160
34815
  // Id
34161
- values.id = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'id') || '';
34816
+ values.id = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'id') || '';
34162
34817
  // Title
34163
- values.imageTitle = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'title') || '';
34818
+ values.imageTitle = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'title') || '';
34164
34819
  // Alt
34165
- values.imageAlt = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'alt') || '';
34820
+ values.imageAlt = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'alt') || '';
34166
34821
  // Style
34167
- values.style = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'style') || '';
34822
+ values.style = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'style') || '';
34168
34823
  // Classes
34169
- values.classes = ((0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'class') || '').replace(/jodit_focused_image[\s]*/, '');
34824
+ values.classes = ((0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'class') || '').replace(/jodit_focused_image[\s]*/, '');
34170
34825
  // Margins
34171
- (0,_margin__WEBPACK_IMPORTED_MODULE_5__.readMargins)(image, values, state);
34826
+ (0,_margin__WEBPACK_IMPORTED_MODULE_6__.readMargins)(image, values, state);
34172
34827
  // Link
34173
- (0,_link__WEBPACK_IMPORTED_MODULE_4__.readLink)(state, j, values);
34828
+ (0,_link__WEBPACK_IMPORTED_MODULE_5__.readLink)(state, j, values);
34174
34829
  // Src
34175
- values.imageSrc = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'src') || '';
34830
+ values.imageSrc = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(image, 'src') || '';
34176
34831
  // Image size
34177
- return (0,_size__WEBPACK_IMPORTED_MODULE_6__.readSizes)(image, values, state);
34832
+ return (0,_size__WEBPACK_IMPORTED_MODULE_7__.readSizes)(image, values, state);
34178
34833
  })();
34179
34834
  }
34180
34835
 
@@ -35206,7 +35861,7 @@ UIImagePositionTab = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__
35206
35861
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'id', id || null);
35207
35862
  }
35208
35863
  if (opt.image.editAlign) {
35209
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align, j.o.imageAlignClasses);
35864
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align, (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.getAlignClasses)(j, image));
35210
35865
  }
35211
35866
  }
35212
35867
 
@@ -36039,6 +36694,7 @@ const cmd = (control)=>control.args && (0,jodit_core_helpers_checker__WEBPACK_IM
36039
36694
  /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85932);
36040
36695
  /* harmony import */ var jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16849);
36041
36696
  /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(80991);
36697
+ /* harmony import */ var jodit_core_helpers_utils_media_wrapper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(83314);
36042
36698
  /*!
36043
36699
  * Jodit Editor (https://xdsoft.net/jodit/)
36044
36700
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -36049,9 +36705,7 @@ const cmd = (control)=>control.args && (0,jodit_core_helpers_checker__WEBPACK_IM
36049
36705
 
36050
36706
 
36051
36707
 
36052
- // Images align with `imageAlignClasses`; the wrappers of iframes and media
36053
- // keep inline styles
36054
- const alignClasses = (editor, elm)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, 'img') ? editor.o.imageAlignClasses : null;
36708
+
36055
36709
  // A Normal image sits where the text of its line is aligned (#1531)
36056
36710
  const lineAlign = (editor, elm)=>{
36057
36711
  const block = elm && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(elm, jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock, editor.editor) || editor.editor;
@@ -36072,7 +36726,7 @@ const lineAlign = (editor, elm)=>{
36072
36726
  return 'left';
36073
36727
  }
36074
36728
  };
36075
- const currentAlign = (editor, elm)=>elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getHAlign)(elm, alignClasses(editor, elm)) : 'normal';
36729
+ const currentAlign = (editor, elm)=>elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getHAlign)(elm, (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getAlignClasses)(editor, elm)) : 'normal';
36076
36730
  const align = {
36077
36731
  name: 'left',
36078
36732
  childTemplate: (_, __, value)=>value,
@@ -36093,23 +36747,25 @@ const align = {
36093
36747
  return (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_1__.isString)(value) && currentAlign(editor, button.target) === value.toLowerCase();
36094
36748
  },
36095
36749
  exec: (editor, elm, { control })=>{
36096
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
36750
+ // A media wrapper kept in the content (`mediaWrappers`) is aligned itself
36751
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isHTMLElement(elm) || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
36097
36752
  'img',
36098
36753
  'jodit',
36099
36754
  'jodit-media'
36100
- ]))) {
36755
+ ])) && (0,jodit_core_helpers_utils_media_wrapper__WEBPACK_IMPORTED_MODULE_4__.getMediaWrapper)(editor, elm) !== elm) {
36101
36756
  return;
36102
36757
  }
36103
36758
  const command = control.args && (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_1__.isString)(control.args[0]) ? control.args[0].toLowerCase() : '';
36104
36759
  if (!command) {
36105
36760
  return false;
36106
36761
  }
36107
- ;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command, alignClasses(editor, elm));
36762
+ ;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command, (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getAlignClasses)(editor, elm));
36108
36763
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
36109
36764
  'jodit',
36110
36765
  'jodit-media'
36111
36766
  ])) && elm.firstElementChild) {
36112
- (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm.firstElementChild, command);
36767
+ const media = elm.firstElementChild;
36768
+ (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(media, command, (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getAlignClasses)(editor, media));
36113
36769
  }
36114
36770
  editor.synchronizeValues();
36115
36771
  editor.e.fire('recalcPositionPopup');
@@ -36261,9 +36917,11 @@ const align = {
36261
36917
  return (0,jodit_modules_toolbar_factory__WEBPACK_IMPORTED_MODULE_9__.makeCollection)(this.jodit, this.popup);
36262
36918
  }
36263
36919
  onClick(node) {
36264
- const elements = this.elmsList, target = jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(node, 'img') ? node : jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.closest(node, elements, this.j.editor);
36265
- if (target && this.canShowPopupForType(target.nodeName.toLowerCase())) {
36266
- this.showPopup(()=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(target, this.j), target.nodeName.toLowerCase(), target);
36920
+ const elements = this.elmsList, mediaWrapper = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.getMediaWrapper)(this.j, node), target = mediaWrapper !== null && mediaWrapper !== void 0 ? mediaWrapper : jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(node, 'img') ? node : jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.closest(node, elements, this.j.editor);
36921
+ // A media wrapper kept in the content gets the media popup
36922
+ const type = mediaWrapper ? 'jodit-media' : target === null || target === void 0 ? void 0 : target.nodeName.toLowerCase();
36923
+ if (target && type && this.canShowPopupForType(type)) {
36924
+ this.showPopup(()=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(target, this.j), type, target);
36267
36925
  return false;
36268
36926
  }
36269
36927
  }
@@ -36446,7 +37104,12 @@ const align = {
36446
37104
  this.removeListenersForElements();
36447
37105
  }
36448
37106
  _eventsList() {
36449
- const el = this.elmsList;
37107
+ var _this_j_o_mediaWrappers;
37108
+ // Clicks on a media wrapper kept in the content (`mediaWrappers`)
37109
+ const wrapperTags = Object.values((_this_j_o_mediaWrappers = this.j.o.mediaWrappers) !== null && _this_j_o_mediaWrappers !== void 0 ? _this_j_o_mediaWrappers : {}).map(({ tag })=>tag.toLowerCase());
37110
+ const el = [
37111
+ ...new Set(this.elmsList.concat(wrapperTags))
37112
+ ];
36450
37113
  return el.map((e)=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.camelCase)(`click_${e}`)).concat(el.map((e)=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.camelCase)(`touchstart_${e}`))).join(' ');
36451
37114
  }
36452
37115
  addListenersForElements() {
@@ -37372,7 +38035,7 @@ class lineHeight extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
37372
38035
  try {
37373
38036
  if (s.isCollapsed()) {
37374
38037
  const fake = c.fake();
37375
- s.insertNode(fake, false, false);
38038
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeInsertNode(s.range, fake);
37376
38039
  apply(fake);
37377
38040
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(fake);
37378
38041
  } else {
@@ -37988,6 +38651,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.mediaBlocks = [
37988
38651
  'video',
37989
38652
  'audio'
37990
38653
  ];
38654
+ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.mediaWrappers = {};
37991
38655
 
37992
38656
 
37993
38657
  /***/ }),
@@ -38021,11 +38685,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.mediaBlocks = [
38021
38685
  * Process `video` and `audio`
38022
38686
  */ function media(editor) {
38023
38687
  const keyFake = 'jodit_fake_wrapper';
38024
- const { mediaFakeTag, mediaBlocks, mediaInFakeBlock } = editor.options;
38688
+ const { mediaFakeTag, mediaBlocks, mediaInFakeBlock, mediaWrappers } = editor.options;
38025
38689
  const wrap = (element)=>{
38026
38690
  if (element.parentNode && (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(element.parentNode, 'data-jodit_iframe_wrapper')) {
38027
38691
  element = element.parentNode;
38028
- } else {
38692
+ } else if (mediaWrappers[element.nodeName.toLowerCase()]) {
38693
+ var _getMediaWrapper;
38694
+ element = (_getMediaWrapper = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.getMediaWrapper)(editor, element)) !== null && _getMediaWrapper !== void 0 ? _getMediaWrapper : (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.wrapMedia)(editor, element);
38695
+ } else if (mediaInFakeBlock) {
38029
38696
  const wrapper = editor.createInside.element(mediaFakeTag, {
38030
38697
  'data-jodit-temp': 1,
38031
38698
  contenteditable: false,
@@ -38043,12 +38710,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.mediaBlocks = [
38043
38710
  }
38044
38711
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(wrapper, element);
38045
38712
  element = wrapper;
38713
+ } else {
38714
+ return;
38046
38715
  }
38047
38716
  editor.e.off(element, 'mousedown.select touchstart.select').on(element, 'mousedown.select touchstart.select', ()=>{
38048
38717
  editor.s.setCursorAfter(element);
38049
38718
  });
38050
38719
  };
38051
- if (mediaInFakeBlock) {
38720
+ if (mediaInFakeBlock || Object.keys(mediaWrappers).length) {
38052
38721
  editor.e.on('afterGetValueFromEditor', (data)=>{
38053
38722
  const rxp = new RegExp(`<${mediaFakeTag}[^>]+data-${keyFake}[^>]+>([^]+?)</${mediaFakeTag}>`, 'ig');
38054
38723
  if (rxp.test(data.value)) {
@@ -39410,7 +40079,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.useInputsPlaceholder
39410
40079
  this.placeholderElm.innerHTML = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__.attr)(editor.element, 'placeholder') || '';
39411
40080
  }
39412
40081
  editor.e.fire('placeholder', this.placeholderElm.innerHTML);
39413
- editor.e.off('.placeholder').on('changePlace.placeholder', this.addNativeListeners).on('change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder ' + 'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder ' + 'internalChange.placeholder', this.toggle).on(window, 'load', this.toggle);
40082
+ editor.e.off('.placeholder').on('changePlace.placeholder', this.addNativeListeners).on('change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder ' + 'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder ' + 'internalChange.placeholder afterCommand.placeholder', this.toggle).on(window, 'load', this.toggle);
39414
40083
  this.addNativeListeners();
39415
40084
  this.toggle();
39416
40085
  });
@@ -42593,10 +43262,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.source = {
42593
43262
  /* harmony export */ AceEditor: function() { return /* binding */ AceEditor; }
42594
43263
  /* harmony export */ });
42595
43264
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
42596
- /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
42597
- /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(23211);
42598
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65946);
42599
- /* harmony import */ var jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(94193);
43265
+ /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
43266
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
43267
+ /* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49574);
43268
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
43269
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
43270
+ /* harmony import */ var jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(94193);
42600
43271
  /*!
42601
43272
  * Jodit Editor (https://xdsoft.net/jodit/)
42602
43273
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -42608,7 +43279,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.source = {
42608
43279
 
42609
43280
 
42610
43281
 
42611
- class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_4__.SourceEditor {
43282
+
43283
+
43284
+ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_6__.SourceEditor {
42612
43285
  aceExists() {
42613
43286
  return this.j.ow.ace !== undefined;
42614
43287
  }
@@ -42666,7 +43339,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42666
43339
  return;
42667
43340
  }
42668
43341
  const fakeMirror = this.j.c.div('jodit-source__mirror-fake');
42669
- jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(this.container, fakeMirror);
43342
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(this.container, fakeMirror);
42670
43343
  const ace = editor.ow.ace;
42671
43344
  this.instance = ace.edit(fakeMirror);
42672
43345
  if (editor.o.direction === 'rtl') {
@@ -42687,15 +43360,15 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42687
43360
  this.instance.setOption('wrap', editor.o.sourceEditorNativeOptions.wrap);
42688
43361
  this.instance.getSession().setUseWorker(false);
42689
43362
  this.instance.$blockScrolling = Infinity;
42690
- this.instance.on('change', this.toWYSIWYG);
43363
+ this.instance.on('change', this.__onChange);
42691
43364
  this.instance.on('focus', this.proxyOnFocus);
42692
43365
  this.instance.on('mousedown', this.proxyOnMouseDown);
42693
43366
  this.instance.on('blur', this.proxyOnBlur);
42694
- if (editor.getRealMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.MODE_WYSIWYG) {
43367
+ if (editor.getRealMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_WYSIWYG) {
42695
43368
  this.setValue(this.getValue());
42696
43369
  }
42697
43370
  const onResize = this.j.async.throttle(()=>{
42698
- if (editor.isInDestruct || editor.getMode() === jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.MODE_WYSIWYG) {
43371
+ if (editor.isInDestruct || editor.getMode() === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_WYSIWYG) {
42699
43372
  return;
42700
43373
  }
42701
43374
  const hasFocus = this.instance.isFocused();
@@ -42713,7 +43386,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42713
43386
  };
42714
43387
  let loading = false;
42715
43388
  const initAceEditor = ()=>{
42716
- 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) {
43389
+ if (editor.isInDestruct || editor.getRealMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_SOURCE && editor.getMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_SPLIT) {
42717
43390
  return;
42718
43391
  }
42719
43392
  // ACE (~400 KiB from the CDN) is only needed once the source view
@@ -42722,7 +43395,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42722
43395
  if (!this.aceExists()) {
42723
43396
  if (!loading) {
42724
43397
  loading = true;
42725
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.loadNext)(editor, editor.o.sourceEditorCDNUrlsJS).then(initAceEditor).catch(()=>null);
43398
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.loadNext)(editor, editor.o.sourceEditorCDNUrlsJS).then(initAceEditor).catch(()=>null);
42726
43399
  }
42727
43400
  return;
42728
43401
  }
@@ -42735,7 +43408,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42735
43408
  }
42736
43409
  destruct() {
42737
43410
  var _this_j_events, _this_j;
42738
- this.instance.off('change', this.toWYSIWYG);
43411
+ this.instance.off('change', this.__onChange);
42739
43412
  this.instance.off('focus', this.proxyOnFocus);
42740
43413
  this.instance.off('mousedown', this.proxyOnMouseDown);
42741
43414
  this.instance.destroy();
@@ -42744,13 +43417,29 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42744
43417
  setValue(value) {
42745
43418
  if (!this.j.o.editHTMLDocumentMode && this.j.o.beautifyHTML) {
42746
43419
  const html = this.j.e.fire('beautifyHTML', value);
42747
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isString)(html)) {
43420
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isString)(html)) {
42748
43421
  value = html;
42749
43422
  }
42750
43423
  }
42751
- this.instance.setValue(value);
43424
+ // ACE reports its own `setValue` as two changes, the removal of the
43425
+ // old text and the insertion of the new one. Fed back into the
43426
+ // editor they became two history entries, `content -> ''` and
43427
+ // `'' -> content`, so the first undo after a switch to the source
43428
+ // view and back emptied the editor. The text came from the editor
43429
+ // in the first place, so there is nothing to send back.
43430
+ this.__settingValue = true;
43431
+ try {
43432
+ this.instance.setValue(value);
43433
+ } finally{
43434
+ this.__settingValue = false;
43435
+ }
42752
43436
  this.instance.clearSelection();
42753
43437
  }
43438
+ __onChange() {
43439
+ if (!this.__settingValue) {
43440
+ this.toWYSIWYG();
43441
+ }
43442
+ }
42754
43443
  getValue() {
42755
43444
  return this.instance.getValue();
42756
43445
  }
@@ -42824,9 +43513,12 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42824
43513
  this.j.e.fire('focus', e);
42825
43514
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "proxyOnMouseDown", (e)=>{
42826
43515
  this.j.e.fire('mousedown', e);
42827
- });
43516
+ }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__settingValue", false);
42828
43517
  }
42829
43518
  }
43519
+ ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
43520
+ jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_3__.autobind
43521
+ ], AceEditor.prototype, "__onChange", null);
42830
43522
 
42831
43523
 
42832
43524
  /***/ }),
@@ -45751,15 +46443,33 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('toolbarNavigati
45751
46443
 
45752
46444
 
45753
46445
 
46446
+ // Media the popup inserts go in their wrapper (see `mediaWrappers`), aligned
46447
+ // with `mediaDefaultAlign`
46448
+ function prepareMedia(jodit, element) {
46449
+ const media = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.wrapMedia)(jodit, element);
46450
+ const { mediaDefaultAlign } = jodit.o;
46451
+ if (mediaDefaultAlign && mediaDefaultAlign !== 'normal') {
46452
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.hAlignElement)(media, mediaDefaultAlign, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.getAlignClasses)(jodit, media));
46453
+ }
46454
+ return media;
46455
+ }
45754
46456
  function insertVideos(data) {
45755
46457
  var _data_files;
45756
46458
  (_data_files = data.files) === null || _data_files === void 0 ? void 0 : _data_files.forEach((file)=>{
45757
- this.s.insertNode(this.createInside.element('video', {
46459
+ this.s.insertNode(prepareMedia(this, this.createInside.element('video', {
45758
46460
  controls: '',
45759
46461
  src: data.baseurl + file
45760
- }));
46462
+ })));
45761
46463
  });
45762
46464
  }
46465
+ // Embed code that is one element is prepared as media; other code goes in as
46466
+ // it is
46467
+ function prepareEmbedCode(jodit, code) {
46468
+ const box = jodit.createInside.div();
46469
+ box.innerHTML = code.trim();
46470
+ const element = box.firstElementChild;
46471
+ return element && box.childNodes.length === 1 ? prepareMedia(jodit, element) : code;
46472
+ }
45763
46473
  jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.video = {
45764
46474
  parseUrlToVideoEmbed: jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.convertMediaUrlToVideoEmbed,
45765
46475
  defaultWidth: 400,
@@ -45797,7 +46507,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.video = {
45797
46507
  ])
45798
46508
  ]), tabs = [], insertCode = (code)=>{
45799
46509
  jodit.s.restore();
45800
- jodit.s.insertHTML(code);
46510
+ jodit.s.insertHTML(prepareEmbedCode(jodit, code));
45801
46511
  close();
45802
46512
  };
45803
46513
  jodit.s.save();