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/es2021/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.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
  *
@@ -1799,7 +1824,7 @@ __webpack_require__.r(__webpack_exports__);
1799
1824
  * ```
1800
1825
  * @packageDocumentation
1801
1826
  * @module constants
1802
- */ const APP_VERSION = "4.17.5";
1827
+ */ const APP_VERSION = "4.18.0";
1803
1828
  // prettier-ignore
1804
1829
  const ES = "es2021";
1805
1830
  const IS_ES_MODERN = true;
@@ -7576,12 +7601,15 @@ function trimChars(value, chars) {
7576
7601
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7577
7602
  /* harmony export */ alignElement: function() { return /* binding */ alignElement; },
7578
7603
  /* harmony export */ clearAlign: function() { return /* binding */ clearAlign; },
7604
+ /* harmony export */ getAlignClasses: function() { return /* binding */ getAlignClasses; },
7579
7605
  /* harmony export */ getHAlign: function() { return /* binding */ getHAlign; },
7580
7606
  /* harmony export */ hAlignElement: function() { return /* binding */ hAlignElement; }
7581
7607
  /* harmony export */ });
7582
7608
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
7583
- /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7909);
7584
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80991);
7609
+ /* harmony import */ var jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17312);
7610
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7909);
7611
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(80991);
7612
+ /* harmony import */ var jodit_core_helpers_utils_media_wrapper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(83314);
7585
7613
  /*!
7586
7614
  * Jodit Editor (https://xdsoft.net/jodit/)
7587
7615
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -7591,31 +7619,51 @@ function trimChars(value, chars) {
7591
7619
  */
7592
7620
 
7593
7621
 
7594
- const classNames = (value)=>(value ?? '').split(/\s+/).filter(Boolean);
7622
+
7623
+
7624
+ // The sets of class names an alignment lists, the first being the one to write
7625
+ const classSets = (value)=>((0,jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_1__.isArray)(value) ? value : [
7626
+ value ?? ''
7627
+ ]).map((set)=>set.split(/\s+/).filter(Boolean)).filter((set)=>set.length);
7628
+ /**
7629
+ * The class names to align `elm` with: `alignClasses` for its tag, or for the
7630
+ * media in it when it wraps media (a `mediaWrappers` wrapper, `jodit` or
7631
+ * `jodit-media`), falling back to `imageAlignClasses` for an image
7632
+ */ function getAlignClasses(jodit, elm) {
7633
+ if (!elm) {
7634
+ return null;
7635
+ }
7636
+ const media = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
7637
+ 'jodit',
7638
+ 'jodit-media'
7639
+ ])) ? elm.firstElementChild : (0,jodit_core_helpers_utils_media_wrapper__WEBPACK_IMPORTED_MODULE_4__.getWrappedMedia)(jodit, elm);
7640
+ const tag = (media ?? elm).nodeName.toLowerCase();
7641
+ return jodit.o.alignClasses?.[tag] ?? (tag === 'img' ? jodit.o.imageAlignClasses : null);
7642
+ }
7595
7643
  /**
7596
- * Align image, with `classes` (see `imageAlignClasses`) instead of inline
7597
- * styles when they are given
7644
+ * Align image, with `classes` (see `alignClasses`) instead of inline styles
7645
+ * when they are given
7598
7646
  */ function hAlignElement(image, align, classes) {
7599
7647
  if (classes) {
7600
7648
  hAlignElement(image, 'normal');
7601
- Object.values(classes).forEach((value)=>image.classList.remove(...classNames(value)));
7602
- image.classList.add(...classNames(classes[align || 'normal']));
7649
+ Object.values(classes).forEach((value)=>classSets(value).forEach((set)=>image.classList.remove(...set)));
7650
+ image.classList.add(...classSets(classes[align || 'normal'])[0] ?? []);
7603
7651
  [
7604
7652
  'class',
7605
7653
  'style'
7606
7654
  ].forEach((name)=>{
7607
- if (!(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, name)?.trim()) {
7608
- (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, name, null);
7655
+ if (!(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(image, name)?.trim()) {
7656
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(image, name, null);
7609
7657
  }
7610
7658
  });
7611
7659
  return;
7612
7660
  }
7613
7661
  if (align && align !== 'normal') {
7614
7662
  if (align !== 'center') {
7615
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float', align);
7616
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.clearCenterAlign)(image);
7663
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, 'float', align);
7664
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.clearCenterAlign)(image);
7617
7665
  } else {
7618
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(image, {
7666
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, {
7619
7667
  float: '',
7620
7668
  display: 'block',
7621
7669
  marginLeft: 'auto',
@@ -7623,13 +7671,13 @@ const classNames = (value)=>(value ?? '').split(/\s+/).filter(Boolean);
7623
7671
  });
7624
7672
  }
7625
7673
  } else {
7626
- if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float') && [
7674
+ if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, 'float') && [
7627
7675
  'right',
7628
7676
  'left'
7629
- ].indexOf((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float').toString().toLowerCase()) !== -1) {
7630
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(image, 'float', '');
7677
+ ].indexOf((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, 'float').toString().toLowerCase()) !== -1) {
7678
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, 'float', '');
7631
7679
  }
7632
- ;(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.clearCenterAlign)(image);
7680
+ ;(0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.clearCenterAlign)(image);
7633
7681
  }
7634
7682
  }
7635
7683
  /**
@@ -7642,17 +7690,16 @@ const classNames = (value)=>(value ?? '').split(/\s+/).filter(Boolean);
7642
7690
  'center',
7643
7691
  'normal'
7644
7692
  ]){
7645
- const names = classNames(classes[align]);
7646
- if (names.length && names.every((name)=>elm.classList.contains(name))) {
7693
+ if (classSets(classes[align]).some((set)=>set.every((name)=>elm.classList.contains(name)))) {
7647
7694
  return align;
7648
7695
  }
7649
7696
  }
7650
7697
  }
7651
- const float = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(elm, 'float').toLowerCase();
7698
+ const float = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.cssInline)(elm, 'float').toLowerCase();
7652
7699
  if (float === 'left' || float === 'right') {
7653
7700
  return float;
7654
7701
  }
7655
- 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') {
7702
+ 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') {
7656
7703
  return 'center';
7657
7704
  }
7658
7705
  return 'normal';
@@ -7662,10 +7709,10 @@ const classNames = (value)=>(value ?? '').split(/\s+/).filter(Boolean);
7662
7709
  */ function clearAlign(node) {
7663
7710
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.each(node, (elm)=>{
7664
7711
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isHTMLElement(elm)) {
7665
- if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(elm, 'textAlign')) {
7666
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(elm, 'textAlign', '');
7667
- if (!((0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'style') || '').trim().length) {
7668
- (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'style', null);
7712
+ if ((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.cssInline)(elm, 'textAlign')) {
7713
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(elm, 'textAlign', '');
7714
+ if (!((0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(elm, 'style') || '').trim().length) {
7715
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(elm, 'style', null);
7669
7716
  }
7670
7717
  }
7671
7718
  }
@@ -7696,7 +7743,7 @@ function alignElement(command, box) {
7696
7743
  clearAlign(box);
7697
7744
  const align = ALIGN_BY_COMMAND.get(command.toLowerCase());
7698
7745
  if (align) {
7699
- (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(box, 'textAlign', align);
7746
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(box, 'textAlign', align);
7700
7747
  }
7701
7748
  }
7702
7749
  }
@@ -8781,13 +8828,13 @@ const getClassName = (obj)=>{
8781
8828
  "use strict";
8782
8829
  __webpack_require__.r(__webpack_exports__);
8783
8830
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8784
- /* harmony export */ $$: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_24__.$$; },
8831
+ /* harmony export */ $$: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_25__.$$; },
8785
8832
  /* harmony export */ ConfigDeepFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigDeepFlatten; },
8786
8833
  /* harmony export */ ConfigFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigFlatten; },
8787
8834
  /* harmony export */ ConfigMerge: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigMerge; },
8788
8835
  /* harmony export */ ConfigProto: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigProto; },
8789
8836
  /* harmony export */ ConnectionError: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.ConnectionError; },
8790
- /* harmony export */ LimitedStack: function() { return /* reexport safe */ _stack__WEBPACK_IMPORTED_MODULE_26__.LimitedStack; },
8837
+ /* harmony export */ LimitedStack: function() { return /* reexport safe */ _stack__WEBPACK_IMPORTED_MODULE_27__.LimitedStack; },
8791
8838
  /* harmony export */ OptionsError: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.OptionsError; },
8792
8839
  /* harmony export */ UNSAFE_PROTO_KEYS: function() { return /* reexport safe */ _is_unsafe_proto_key__WEBPACK_IMPORTED_MODULE_18__.UNSAFE_PROTO_KEYS; },
8793
8840
  /* harmony export */ abort: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.abort; },
@@ -8799,58 +8846,63 @@ __webpack_require__.r(__webpack_exports__);
8799
8846
  /* harmony export */ attrRaw: function() { return /* reexport safe */ _attr__WEBPACK_IMPORTED_MODULE_3__.attrRaw; },
8800
8847
  /* harmony export */ browser: function() { return /* reexport safe */ _browser__WEBPACK_IMPORTED_MODULE_4__.browser; },
8801
8848
  /* harmony export */ buildQuery: function() { return /* reexport safe */ _build_query__WEBPACK_IMPORTED_MODULE_5__.buildQuery; },
8802
- /* harmony export */ call: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.call; },
8803
- /* harmony export */ callPromise: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.callPromise; },
8804
- /* harmony export */ callThis: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.callThis; },
8849
+ /* harmony export */ call: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.call; },
8850
+ /* harmony export */ callPromise: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.callPromise; },
8851
+ /* harmony export */ callThis: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.callThis; },
8805
8852
  /* harmony export */ clearAlign: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.clearAlign; },
8806
8853
  /* harmony export */ clearCenterAlign: function() { return /* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_9__.clearCenterAlign; },
8807
8854
  /* harmony export */ cns: function() { return /* reexport safe */ _mark_deprecated__WEBPACK_IMPORTED_MODULE_19__.cns; },
8808
8855
  /* harmony export */ completeUrl: function() { return /* reexport safe */ _complete_url__WEBPACK_IMPORTED_MODULE_6__.completeUrl; },
8809
8856
  /* harmony export */ connection: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.connection; },
8810
8857
  /* harmony export */ convertMediaUrlToVideoEmbed: function() { return /* reexport safe */ _convert_media_url_to_video_embed__WEBPACK_IMPORTED_MODULE_8__.convertMediaUrlToVideoEmbed; },
8858
+ /* harmony export */ createMediaWrapper: function() { return /* reexport safe */ _media_wrapper__WEBPACK_IMPORTED_MODULE_20__.createMediaWrapper; },
8811
8859
  /* harmony export */ css: function() { return /* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_9__.css; },
8812
8860
  /* harmony export */ cssInline: function() { return /* reexport safe */ _css__WEBPACK_IMPORTED_MODULE_9__.cssInline; },
8813
- /* harmony export */ cssPath: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_24__.cssPath; },
8861
+ /* harmony export */ cssPath: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_25__.cssPath; },
8814
8862
  /* harmony export */ ctrlKey: function() { return /* reexport safe */ _ctrl_key__WEBPACK_IMPORTED_MODULE_10__.ctrlKey; },
8815
8863
  /* harmony export */ dataBind: function() { return /* reexport safe */ _data_bind__WEBPACK_IMPORTED_MODULE_11__.dataBind; },
8816
8864
  /* harmony export */ defaultLanguage: function() { return /* reexport safe */ _default_language__WEBPACK_IMPORTED_MODULE_12__.defaultLanguage; },
8817
8865
  /* harmony export */ error: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.error; },
8818
8866
  /* harmony export */ fastClone: function() { return /* reexport safe */ _extend__WEBPACK_IMPORTED_MODULE_14__.fastClone; },
8819
8867
  /* harmony export */ get: function() { return /* reexport safe */ _get__WEBPACK_IMPORTED_MODULE_15__.get; },
8868
+ /* harmony export */ getAlignClasses: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.getAlignClasses; },
8820
8869
  /* harmony export */ getClassName: function() { return /* reexport safe */ _get_class_name__WEBPACK_IMPORTED_MODULE_16__.getClassName; },
8821
- /* harmony export */ getDataTransfer: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.getDataTransfer; },
8870
+ /* harmony export */ getDataTransfer: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.getDataTransfer; },
8822
8871
  /* harmony export */ getHAlign: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.getHAlign; },
8823
- /* harmony export */ getPropertyDescriptor: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.getPropertyDescriptor; },
8824
- /* harmony export */ getXPathByElement: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_24__.getXPathByElement; },
8872
+ /* harmony export */ getMediaWrapper: function() { return /* reexport safe */ _media_wrapper__WEBPACK_IMPORTED_MODULE_20__.getMediaWrapper; },
8873
+ /* harmony export */ getPropertyDescriptor: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.getPropertyDescriptor; },
8874
+ /* harmony export */ getWrappedMedia: function() { return /* reexport safe */ _media_wrapper__WEBPACK_IMPORTED_MODULE_20__.getWrappedMedia; },
8875
+ /* harmony export */ getXPathByElement: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_25__.getXPathByElement; },
8825
8876
  /* harmony export */ hAlignElement: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.hAlignElement; },
8826
8877
  /* harmony export */ humanSizeToBytes: function() { return /* reexport safe */ _human_size_to_bytes__WEBPACK_IMPORTED_MODULE_17__.humanSizeToBytes; },
8827
- /* harmony export */ inView: function() { return /* reexport safe */ _scroll_into_view__WEBPACK_IMPORTED_MODULE_23__.inView; },
8878
+ /* harmony export */ inView: function() { return /* reexport safe */ _scroll_into_view__WEBPACK_IMPORTED_MODULE_24__.inView; },
8828
8879
  /* harmony export */ isAtom: function() { return /* reexport safe */ _extend__WEBPACK_IMPORTED_MODULE_14__.isAtom; },
8829
8880
  /* harmony export */ isUnsafeProtoKey: function() { return /* reexport safe */ _is_unsafe_proto_key__WEBPACK_IMPORTED_MODULE_18__.isUnsafeProtoKey; },
8830
8881
  /* harmony export */ keepNames: function() { return /* reexport safe */ _get_class_name__WEBPACK_IMPORTED_MODULE_16__.keepNames; },
8831
- /* harmony export */ keys: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.keys; },
8832
- /* harmony export */ loadImage: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.loadImage; },
8882
+ /* harmony export */ keys: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.keys; },
8883
+ /* harmony export */ loadImage: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.loadImage; },
8833
8884
  /* harmony export */ loadNext: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.loadNext; },
8834
8885
  /* harmony export */ loadNextStyle: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.loadNextStyle; },
8835
8886
  /* harmony export */ markAsAtomic: function() { return /* reexport safe */ _extend__WEBPACK_IMPORTED_MODULE_14__.markAsAtomic; },
8836
8887
  /* harmony export */ markDeprecated: function() { return /* reexport safe */ _mark_deprecated__WEBPACK_IMPORTED_MODULE_19__.markDeprecated; },
8837
- /* harmony export */ markOwner: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.markOwner; },
8838
- /* harmony export */ memorizeExec: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_27__.memorizeExec; },
8888
+ /* harmony export */ markOwner: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.markOwner; },
8889
+ /* harmony export */ memorizeExec: function() { return /* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_28__.memorizeExec; },
8839
8890
  /* harmony export */ options: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.options; },
8840
- /* harmony export */ parseQuery: function() { return /* reexport safe */ _parse_query__WEBPACK_IMPORTED_MODULE_20__.parseQuery; },
8841
- /* harmony export */ previewBox: function() { return /* reexport safe */ _print__WEBPACK_IMPORTED_MODULE_21__.previewBox; },
8842
- /* harmony export */ refs: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_24__.refs; },
8843
- /* harmony export */ reset: function() { return /* reexport safe */ _reset__WEBPACK_IMPORTED_MODULE_22__.reset; },
8844
- /* harmony export */ resolveElement: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_24__.resolveElement; },
8845
- /* harmony export */ scrollIntoViewIfNeeded: function() { return /* reexport safe */ _scroll_into_view__WEBPACK_IMPORTED_MODULE_23__.scrollIntoViewIfNeeded; },
8846
- /* harmony export */ set: function() { return /* reexport safe */ _set__WEBPACK_IMPORTED_MODULE_25__.set; }
8891
+ /* harmony export */ parseQuery: function() { return /* reexport safe */ _parse_query__WEBPACK_IMPORTED_MODULE_21__.parseQuery; },
8892
+ /* harmony export */ previewBox: function() { return /* reexport safe */ _print__WEBPACK_IMPORTED_MODULE_22__.previewBox; },
8893
+ /* harmony export */ refs: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_25__.refs; },
8894
+ /* harmony export */ reset: function() { return /* reexport safe */ _reset__WEBPACK_IMPORTED_MODULE_23__.reset; },
8895
+ /* harmony export */ resolveElement: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_25__.resolveElement; },
8896
+ /* harmony export */ scrollIntoViewIfNeeded: function() { return /* reexport safe */ _scroll_into_view__WEBPACK_IMPORTED_MODULE_24__.scrollIntoViewIfNeeded; },
8897
+ /* harmony export */ set: function() { return /* reexport safe */ _set__WEBPACK_IMPORTED_MODULE_26__.set; },
8898
+ /* harmony export */ wrapMedia: function() { return /* reexport safe */ _media_wrapper__WEBPACK_IMPORTED_MODULE_20__.wrapMedia; }
8847
8899
  /* harmony export */ });
8848
8900
  /* harmony import */ var _align__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16849);
8849
8901
  /* harmony import */ var _append_script__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(47760);
8850
8902
  /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28712);
8851
8903
  /* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_assert__WEBPACK_IMPORTED_MODULE_2__);
8852
8904
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
8853
- /* 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__)
8905
+ /* 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__)
8854
8906
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
8855
8907
  /* harmony import */ var _attr__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7909);
8856
8908
  /* harmony import */ var _browser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(26136);
@@ -8869,14 +8921,15 @@ __webpack_require__.r(__webpack_exports__);
8869
8921
  /* harmony import */ var _human_size_to_bytes__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(37427);
8870
8922
  /* harmony import */ var _is_unsafe_proto_key__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(78048);
8871
8923
  /* harmony import */ var _mark_deprecated__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(49385);
8872
- /* harmony import */ var _parse_query__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(36310);
8873
- /* harmony import */ var _print__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(57075);
8874
- /* harmony import */ var _reset__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(43379);
8875
- /* harmony import */ var _scroll_into_view__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(60898);
8876
- /* harmony import */ var _selector__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(28723);
8877
- /* harmony import */ var _set__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(52144);
8878
- /* harmony import */ var _stack__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(42820);
8879
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(71125);
8924
+ /* harmony import */ var _media_wrapper__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(83314);
8925
+ /* harmony import */ var _parse_query__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(36310);
8926
+ /* harmony import */ var _print__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(57075);
8927
+ /* harmony import */ var _reset__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(43379);
8928
+ /* harmony import */ var _scroll_into_view__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(60898);
8929
+ /* harmony import */ var _selector__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(28723);
8930
+ /* harmony import */ var _set__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(52144);
8931
+ /* harmony import */ var _stack__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(42820);
8932
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(71125);
8880
8933
  /*!
8881
8934
  * Jodit Editor (https://xdsoft.net/jodit/)
8882
8935
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -8911,6 +8964,7 @@ __webpack_require__.r(__webpack_exports__);
8911
8964
 
8912
8965
 
8913
8966
 
8967
+
8914
8968
 
8915
8969
 
8916
8970
  /***/ }),
@@ -8983,6 +9037,77 @@ __webpack_require__.r(__webpack_exports__);
8983
9037
  /* harmony export */ ]);
8984
9038
 
8985
9039
 
9040
+ /***/ }),
9041
+
9042
+ /***/ 83314:
9043
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9044
+
9045
+ "use strict";
9046
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9047
+ /* harmony export */ createMediaWrapper: function() { return /* binding */ createMediaWrapper; },
9048
+ /* harmony export */ getMediaWrapper: function() { return /* binding */ getMediaWrapper; },
9049
+ /* harmony export */ getWrappedMedia: function() { return /* binding */ getWrappedMedia; },
9050
+ /* harmony export */ wrapMedia: function() { return /* binding */ wrapMedia; }
9051
+ /* harmony export */ });
9052
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
9053
+ /*!
9054
+ * Jodit Editor (https://xdsoft.net/jodit/)
9055
+ * Released under MIT see LICENSE.txt in the project root for license information.
9056
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
9057
+ */ /**
9058
+ * @module helpers/utils
9059
+ */
9060
+ 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);
9061
+ /**
9062
+ * The media in `elm` when `elm` is a wrapper media keep in the content (see
9063
+ * `mediaWrappers`): an element of a type `elm` is the wrapper for
9064
+ */ function getWrappedMedia(jodit, elm) {
9065
+ for (const [tag, wrapper] of Object.entries(jodit.o.mediaWrappers ?? {})){
9066
+ if (isWrapper(elm, wrapper)) {
9067
+ const media = elm.querySelector(tag);
9068
+ if (media) {
9069
+ return media;
9070
+ }
9071
+ }
9072
+ }
9073
+ return null;
9074
+ }
9075
+ /**
9076
+ * The wrapper media keep in the content (see `mediaWrappers`) that is or
9077
+ * holds `node`
9078
+ */ function getMediaWrapper(jodit, node) {
9079
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(node, (elm)=>Boolean(getWrappedMedia(jodit, elm)), jodit.editor);
9080
+ }
9081
+ /**
9082
+ * An empty wrapper for media of type `tag` to keep in the content (see
9083
+ * `mediaWrappers`), or null when there is none for it
9084
+ */ function createMediaWrapper(jodit, tag) {
9085
+ const wrapper = jodit.o.mediaWrappers?.[tag.toLowerCase()];
9086
+ if (!wrapper) {
9087
+ return null;
9088
+ }
9089
+ return jodit.createInside.element(wrapper.tag, {
9090
+ class: wrapper.className,
9091
+ contenteditable: false,
9092
+ draggable: true
9093
+ });
9094
+ }
9095
+ /**
9096
+ * Puts `element` in the wrapper for its type (see `mediaWrappers`), and
9097
+ * returns the wrapper, or `element` when there is none for it
9098
+ */ function wrapMedia(jodit, element) {
9099
+ const wrapper = createMediaWrapper(jodit, element.nodeName);
9100
+ if (!wrapper) {
9101
+ return element;
9102
+ }
9103
+ if (element.parentNode) {
9104
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.before(element, wrapper);
9105
+ }
9106
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.append(wrapper, element);
9107
+ return wrapper;
9108
+ }
9109
+
9110
+
8986
9111
  /***/ }),
8987
9112
 
8988
9113
  /***/ 36310:
@@ -10845,6 +10970,11 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
10845
10970
 
10846
10971
 
10847
10972
 
10973
+ /**
10974
+ * A text node that is empty or holds only invisible caret placeholders.
10975
+ */ function isBlankTextNode(node) {
10976
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) && (node.nodeValue ?? '').replace(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.INVISIBLE_SPACE_REG_EXP(), '').length === 0;
10977
+ }
10848
10978
  class Selection {
10849
10979
  /**
10850
10980
  * Short alias for this.jodit
@@ -11089,10 +11219,21 @@ class Selection {
11089
11219
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(marker, this.j.createInside.text(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.INVISIBLE_SPACE));
11090
11220
  if (newRange) {
11091
11221
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.area, atStart ? newRange.startContainer : newRange.endContainer)) {
11092
- // Here need do unsafe inserting
11093
- // Deny Dom.safeInsertNode(newRange, marker);
11094
- // Apply style -> Test Style module -> Base apply -> For selection <p><strong>|test|</strong></p> apply style {"element":"em","style":{"fontStyle":"italic"}}
11095
- newRange.insertNode(marker);
11222
+ const { startContainer: node, startOffset: offset } = newRange;
11223
+ // At either end of a text node the marker goes beside it. Splitting
11224
+ // the node there would leave the selection's boundary in an empty
11225
+ // text node, and WebKit neither repaints a selection that leaves one
11226
+ // nor moves a selection that follows one when it's removed.
11227
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) && offset === 0) {
11228
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.before(node, marker);
11229
+ } else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) && offset === node.nodeValue?.length) {
11230
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.after(node, marker);
11231
+ } else {
11232
+ // Here need do unsafe inserting
11233
+ // Deny Dom.safeInsertNode(newRange, marker);
11234
+ // Apply style -> Test Style module -> Base apply -> For selection <p><strong>|test|</strong></p> apply style {"element":"em","style":{"fontStyle":"italic"}}
11235
+ newRange.insertNode(marker);
11236
+ }
11096
11237
  }
11097
11238
  }
11098
11239
  return marker;
@@ -11414,7 +11555,9 @@ class Selection {
11414
11555
  ()=>firstChild?.previousSibling?.lastChild
11415
11556
  ].forEach((getChildNode)=>{
11416
11557
  const childNode = getChildNode();
11417
- if (childNode && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(childNode)) {
11558
+ // Only a text node left with nothing in it by the split
11559
+ // goes; one holding a space is content (`<b>a</b> |`).
11560
+ if (childNode && isBlankTextNode(childNode)) {
11418
11561
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeRemove(childNode);
11419
11562
  }
11420
11563
  });
@@ -11504,9 +11647,9 @@ class Selection {
11504
11647
  if (styles && typeof styles === 'object') {
11505
11648
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.css)(image, styles);
11506
11649
  }
11507
- const { imageDefaultAlign, imageAlignClasses } = this.j.o;
11650
+ const { imageDefaultAlign } = this.j.o;
11508
11651
  if (imageDefaultAlign && imageDefaultAlign !== 'normal') {
11509
- (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_7__.hAlignElement)(image, imageDefaultAlign, imageAlignClasses);
11652
+ (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));
11510
11653
  }
11511
11654
  const onload = ()=>{
11512
11655
  if (image.naturalHeight < image.offsetHeight || image.naturalWidth < image.offsetWidth) {
@@ -22318,19 +22461,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.history = {
22318
22461
  * Update history stack
22319
22462
  */ updateStack(replace = false) {
22320
22463
  const newValue = this.snapshot.make();
22321
- if (!_snapshot__WEBPACK_IMPORTED_MODULE_6__.Snapshot.equal(newValue, this.startValue)) {
22322
- const newCommand = new _command__WEBPACK_IMPORTED_MODULE_5__.Command(this.startValue, newValue, this, this.updateTick);
22323
- if (replace) {
22324
- const command = this.__stack.current();
22325
- if (command && this.updateTick === command.tick) {
22326
- this.__stack.replace(newCommand);
22327
- }
22328
- } else {
22329
- this.__stack.push(newCommand);
22330
- }
22464
+ if (_snapshot__WEBPACK_IMPORTED_MODULE_6__.Snapshot.equal(newValue, this.startValue)) {
22465
+ return;
22466
+ }
22467
+ // Only the selection moved, for example when the selection markers
22468
+ // went in before a switch to the source view. There is nothing to
22469
+ // undo, but the next change has to start from this selection.
22470
+ if (newValue.html === this.startValue.html) {
22331
22471
  this.startValue = newValue;
22332
- this.fireChangeStack();
22472
+ return;
22473
+ }
22474
+ const newCommand = new _command__WEBPACK_IMPORTED_MODULE_5__.Command(this.startValue, newValue, this, this.updateTick);
22475
+ if (replace) {
22476
+ const command = this.__stack.current();
22477
+ if (command && this.updateTick === command.tick) {
22478
+ this.__stack.replace(newCommand);
22479
+ }
22480
+ } else {
22481
+ this.__stack.push(newCommand);
22333
22482
  }
22483
+ this.startValue = newValue;
22484
+ this.fireChangeStack();
22334
22485
  }
22335
22486
  fireChangeStack() {
22336
22487
  this.j && !this.j.isInDestruct && this.j.events?.fire('changeStack');
@@ -24550,6 +24701,7 @@ const INPUT_TAGS = new Set([
24550
24701
  'textarea',
24551
24702
  'select'
24552
24703
  ]);
24704
+ const TYPE_AHEAD_TIMEOUT = 1000;
24553
24705
  const FOCUSABLE_SELECTOR = [
24554
24706
  'button:not([disabled])',
24555
24707
  'a[href]',
@@ -24807,11 +24959,55 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
24807
24959
  items[(index + 1) % items.length].focus();
24808
24960
  break;
24809
24961
  default:
24810
- return;
24962
+ if (!this.control.list || !this.__typeAhead(e.key, items, index)) {
24963
+ return;
24964
+ }
24811
24965
  }
24812
24966
  e.preventDefault();
24813
24967
  e.stopPropagation();
24814
24968
  }
24969
+ /**
24970
+ * The mouse opens a dropdown without taking the focus out of the editor.
24971
+ * While a dropdown list is open, typing there searches the list, as in an
24972
+ * open `<select>`, instead of writing into the content
24973
+ */ __onEditorKeyDown(e) {
24974
+ if (!this.openedPopup || !this.control.list || e.altKey || e.ctrlKey || e.metaKey || !this.__typeAhead(e.key, this.__popupFocusables(), -1)) {
24975
+ return;
24976
+ }
24977
+ e.preventDefault();
24978
+ return false;
24979
+ }
24980
+ /**
24981
+ * Typing in a dropdown list focuses the next item whose label starts with
24982
+ * the typed text, whatever their case and accents, and repeating one letter
24983
+ * cycles through the items that start with it, like the WAI-ARIA menu
24984
+ * pattern's type-ahead. The typed text starts again after a pause, or once
24985
+ * the focus has moved on
24986
+ */ __typeAhead(key, items, index) {
24987
+ const now = Date.now();
24988
+ if (now - this.__typedAt > TYPE_AHEAD_TIMEOUT || items[index] !== this.__typedTo) {
24989
+ this.__typed = '';
24990
+ }
24991
+ if (key.length !== 1 || key === ' ' && !this.__typed) {
24992
+ return false;
24993
+ }
24994
+ this.__typedAt = now;
24995
+ this.__typed += key;
24996
+ this.__typedTo = items[index];
24997
+ const { compare } = new Intl.Collator(undefined, {
24998
+ usage: 'search',
24999
+ sensitivity: 'base'
25000
+ }), 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);
25001
+ for(let i = 0; i < items.length; i += 1){
25002
+ const item = items[(start + i) % items.length], label = item.textContent?.trim() ?? '';
25003
+ if (compare(label.slice(0, prefix.length), prefix) === 0) {
25004
+ item.focus();
25005
+ this.__typedTo = item;
25006
+ break;
25007
+ }
25008
+ }
25009
+ return true;
25010
+ }
24815
25011
  /**
24816
25012
  * Visible controls of the opened dropdown that can take the focus
24817
25013
  */ __popupFocusables() {
@@ -24827,8 +25023,12 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
24827
25023
  const controls = this.jodit.options.controls ?? {}, getControl = (key)=>(0,jodit_core_ui_helpers_get_control_type__WEBPACK_IMPORTED_MODULE_20__.findControlType)(key, controls);
24828
25024
  const list = control.list;
24829
25025
  const menu = this.openPopup();
24830
- const toolbar = (0,_factory__WEBPACK_IMPORTED_MODULE_23__.makeCollection)(this.j);
24831
25026
  menu.parentElement = this;
25027
+ const content = control.popup?.(this.j, this.toolbar?.getTarget(this) ?? this.target ?? null, this.__closePopup, this);
25028
+ if (content) {
25029
+ return this.__openMenu(menu, content);
25030
+ }
25031
+ const toolbar = (0,_factory__WEBPACK_IMPORTED_MODULE_23__.makeCollection)(this.j);
24832
25032
  toolbar.parentElement = menu;
24833
25033
  toolbar.mode = 'vertical';
24834
25034
  const isListItem = (key)=>(0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_12__.isPlainObject)(key) && 'title' in key && 'value' in key;
@@ -24876,7 +25076,10 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
24876
25076
  return childControl;
24877
25077
  };
24878
25078
  toolbar.build((0,jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_9__.isArray)(list) ? list.map(getButton) : (0,jodit_core_helpers_utils_utils__WEBPACK_IMPORTED_MODULE_18__.keys)(list, false).map((key)=>getButton(key, list[key])), this.target);
24879
- menu.setContent(toolbar).open(()=>(0,jodit_core_helpers_size__WEBPACK_IMPORTED_MODULE_14__.position)(this.container), false, this.j.o.allowTabNavigation ? this.container : undefined);
25079
+ this.__openMenu(menu, toolbar);
25080
+ }
25081
+ __openMenu(menu, content) {
25082
+ menu.setContent(content).open(()=>(0,jodit_core_helpers_size__WEBPACK_IMPORTED_MODULE_14__.position)(this.container), false, this.j.o.allowTabNavigation ? this.container : undefined);
24880
25083
  this.state.activated = true;
24881
25084
  }
24882
25085
  onOutsideClick(e) {
@@ -24890,7 +25093,7 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
24890
25093
  openPopup() {
24891
25094
  this.__closePopup();
24892
25095
  this.openedPopup = new jodit_core_ui_popup_popup__WEBPACK_IMPORTED_MODULE_22__.Popup(this.j, false);
24893
- this.j.e.on(this.ow, 'mousedown touchstart', this.onOutsideClick).on('escape closeAllPopups', this.onOutsideClick).on(this.openedPopup.container, 'keydown', this.__onPopupKeyDown);
25096
+ 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);
24894
25097
  return this.openedPopup;
24895
25098
  }
24896
25099
  __closePopup() {
@@ -24905,7 +25108,7 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
24905
25108
  // popup while the outer `removeChild` is still running and Chrome
24906
25109
  // throws NotFoundError. See #1458
24907
25110
  this.openedPopup = null;
24908
- this.j.e.off(this.ow, 'mousedown touchstart', this.onOutsideClick).off('escape closeAllPopups', this.onOutsideClick);
25111
+ this.j.e.off(this.ow, 'mousedown touchstart', this.onOutsideClick).off('escape closeAllPopups', this.onOutsideClick).off('keydown', this.__onEditorKeyDown);
24909
25112
  // The keyboard brought the focus into the dropdown: give it back to
24910
25113
  // the button, otherwise it would fall out to the document
24911
25114
  const { activeElement } = this.od, hadFocus = activeElement && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isOrContains(popup.container, activeElement);
@@ -24960,12 +25163,12 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
24960
25163
  return super.destruct();
24961
25164
  }
24962
25165
  constructor(jodit, control, target = null){
24963
- 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 = {
25166
+ 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 = {
24964
25167
  ...(0,jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.UIButtonState)(),
24965
25168
  theme: 'toolbar',
24966
25169
  currentValue: '',
24967
25170
  hasTrigger: false
24968
- }, this.openedPopup = null;
25171
+ }, this.__typed = '', this.__typedAt = 0, this.__typedTo = null, this.openedPopup = null;
24969
25172
  const button = this.getElm('button');
24970
25173
  (0,jodit_core_helpers_utils_assert__WEBPACK_IMPORTED_MODULE_16__.assert)(button, 'Element button should exists');
24971
25174
  this.button = button;
@@ -25014,6 +25217,9 @@ class ToolbarButton extends jodit_core_ui_button__WEBPACK_IMPORTED_MODULE_19__.U
25014
25217
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
25015
25218
  jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_4__.autobind
25016
25219
  ], ToolbarButton.prototype, "__onPopupKeyDown", null);
25220
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
25221
+ jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_4__.autobind
25222
+ ], ToolbarButton.prototype, "__onEditorKeyDown", null);
25017
25223
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
25018
25224
  jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_4__.autobind
25019
25225
  ], ToolbarButton.prototype, "onOutsideClick", null);
@@ -32406,14 +32612,16 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_1__.pluginSystem.add('focus', focus);
32406
32612
 
32407
32613
  "use strict";
32408
32614
  /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27795);
32409
- /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4040);
32410
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80991);
32411
- /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(29434);
32412
- /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5266);
32413
- /* harmony import */ var _icons_font_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(48842);
32414
- /* harmony import */ var _icons_font_svg__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_icons_font_svg__WEBPACK_IMPORTED_MODULE_5__);
32415
- /* harmony import */ var _icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(25501);
32416
- /* harmony import */ var _icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_6__);
32615
+ /* harmony import */ var jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(17312);
32616
+ /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4040);
32617
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(80991);
32618
+ /* harmony import */ var jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29434);
32619
+ /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5266);
32620
+ /* harmony import */ var _icons_font_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(48842);
32621
+ /* harmony import */ var _icons_font_svg__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_icons_font_svg__WEBPACK_IMPORTED_MODULE_6__);
32622
+ /* harmony import */ var _icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(25501);
32623
+ /* harmony import */ var _icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_7__);
32624
+ /* harmony import */ var _font_picker__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(80045);
32417
32625
  /*!
32418
32626
  * Jodit Editor (https://xdsoft.net/jodit/)
32419
32627
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -32427,11 +32635,18 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_1__.pluginSystem.add('focus', focus);
32427
32635
 
32428
32636
 
32429
32637
 
32638
+
32639
+
32430
32640
  /**
32431
32641
  * Default font-size points
32432
- */ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.defaultFontSizePoints = 'px';
32433
- jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('font', (_icons_font_svg__WEBPACK_IMPORTED_MODULE_5___default())).set('fontsize', (_icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_6___default()));
32434
- jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.fontsize = {
32642
+ */ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.defaultFontSizePoints = 'px';
32643
+ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.font = {
32644
+ googleFonts: {
32645
+ url: ''
32646
+ }
32647
+ };
32648
+ jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_4__.Icon.set('font', (_icons_font_svg__WEBPACK_IMPORTED_MODULE_6___default())).set('fontsize', (_icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_7___default()));
32649
+ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize = {
32435
32650
  command: 'fontsize',
32436
32651
  data: {
32437
32652
  cssRule: 'font-size',
@@ -32476,7 +32691,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.fontsize = {
32476
32691
  }
32477
32692
  const control = button.control;
32478
32693
  const cssKey = control.data?.cssRule || 'font-size';
32479
- const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(box, cssKey);
32694
+ const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(box, cssKey);
32480
32695
  if (cssKey === 'font-size') {
32481
32696
  const numValue = parseFloat(value.toString());
32482
32697
  if (editor.o.defaultFontSizePoints === 'pt') {
@@ -32506,12 +32721,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.fontsize = {
32506
32721
  return keySet.has(normalize(value.toString()));
32507
32722
  }
32508
32723
  };
32509
- jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.font = {
32510
- ...jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.fontsize,
32724
+ const hadSelection = new WeakSet();
32725
+ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.font = {
32726
+ ...jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize,
32511
32727
  command: 'fontname',
32512
32728
  textTemplate: (j, value)=>{
32513
32729
  const [first] = value.split(',');
32514
- return (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_1__.trimChars)(first, '"\'');
32730
+ return (0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_2__.trimChars)(first, '"\'');
32515
32731
  },
32516
32732
  list: {
32517
32733
  '': 'Default',
@@ -32533,6 +32749,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.font = {
32533
32749
  } catch {}
32534
32750
  return `<span data-style="${key}" style="${isAvailable ? `font-family: ${key}!important;` : ''}">${value}</span>`;
32535
32751
  },
32752
+ popup: (editor, current, close, button)=>editor.o.font.googleFonts.url ? new _font_picker__WEBPACK_IMPORTED_MODULE_8__.UIFontPicker(editor, button, close) : false,
32536
32753
  data: {
32537
32754
  cssRule: 'font-family',
32538
32755
  normalize: (v)=>{
@@ -32541,19 +32758,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.font = {
32541
32758
  },
32542
32759
  // When no font is explicitly set, the computed font-family equals the
32543
32760
  // editor's own default (e.g. `-apple-system, …`). Return '' so the
32544
- // button shows the `Default` list entry instead of that raw stack.
32545
- // See #1370
32546
- value: (editor)=>{
32547
- const current = editor.s.current();
32548
- if (!current) {
32549
- return;
32550
- }
32551
- const box = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement, editor.editor);
32552
- if (!box) {
32761
+ // button shows the list's `Default` entry, when it has one, instead of
32762
+ // that raw stack. See #1370
32763
+ value: (editor, button)=>{
32764
+ const current = editor.s.current(), box = current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement, editor.editor);
32765
+ // Until there is a selection the button shows the editor's own font,
32766
+ // and afterwards the font of the last one
32767
+ if (box) {
32768
+ hadSelection.add(button);
32769
+ } else if (hadSelection.has(button)) {
32553
32770
  return;
32554
32771
  }
32555
- const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(box, 'font-family').toString();
32556
- if (value === (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.css)(editor.editor, 'font-family').toString()) {
32772
+ const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(box || editor.editor, 'font-family').toString(), { list } = button.control;
32773
+ if (value === (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(editor.editor, 'font-family').toString() && ((0,jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_1__.isArray)(list) ? list.includes('') : '' in (list ?? {}))) {
32557
32774
  return '';
32558
32775
  }
32559
32776
  return value;
@@ -32562,6 +32779,254 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.font = {
32562
32779
  };
32563
32780
 
32564
32781
 
32782
+ /***/ }),
32783
+
32784
+ /***/ 80045:
32785
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
32786
+
32787
+ "use strict";
32788
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
32789
+ /* harmony export */ UIFontPicker: function() { return /* binding */ UIFontPicker; }
32790
+ /* harmony export */ });
32791
+ /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
32792
+ /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
32793
+ /* harmony import */ var jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(91672);
32794
+ /* harmony import */ var jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(68616);
32795
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
32796
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
32797
+ /* harmony import */ var jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(17312);
32798
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(7909);
32799
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(80991);
32800
+ /* harmony import */ var jodit_core_helpers_utils_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(71125);
32801
+ /* harmony import */ var jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(96007);
32802
+ /* harmony import */ var _google_fonts__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(24939);
32803
+ /*!
32804
+ * Jodit Editor (https://xdsoft.net/jodit/)
32805
+ * Released under MIT see LICENSE.txt in the project root for license information.
32806
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
32807
+ */ /**
32808
+ * @module plugins/font
32809
+ */
32810
+
32811
+
32812
+
32813
+
32814
+
32815
+
32816
+
32817
+
32818
+
32819
+
32820
+
32821
+
32822
+ const HEADINGS = [
32823
+ 'h1',
32824
+ 'h2',
32825
+ 'h3',
32826
+ 'h4',
32827
+ 'h5',
32828
+ 'h6'
32829
+ ];
32830
+ const GENERIC_FAMILIES = new Set([
32831
+ 'serif',
32832
+ 'sans-serif',
32833
+ 'monospace',
32834
+ 'cursive',
32835
+ 'fantasy',
32836
+ 'system-ui',
32837
+ 'ui-serif',
32838
+ 'ui-sans-serif',
32839
+ 'ui-monospace',
32840
+ 'ui-rounded'
32841
+ ]);
32842
+ /**
32843
+ * A family that names a font, not a generic family or a vendor keyword such
32844
+ * as `-apple-system`
32845
+ */ function isFontName(family) {
32846
+ return Boolean(family) && !family.startsWith('-') && !GENERIC_FAMILIES.has(family);
32847
+ }
32848
+ class UIFontPicker extends jodit_core_ui_element__WEBPACK_IMPORTED_MODULE_10__.UIElement {
32849
+ className() {
32850
+ return 'UIFontPicker';
32851
+ }
32852
+ __render() {
32853
+ const { control } = this.__button, { list = {} } = control, listed = (0,jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_6__.isArray)(list) ? list.map((key)=>({
32854
+ value: key.toString(),
32855
+ title: key.toString()
32856
+ })) : (0,jodit_core_helpers_utils_utils__WEBPACK_IMPORTED_MODULE_9__.keys)(list, false).map((key)=>({
32857
+ value: key,
32858
+ title: list[key].toString()
32859
+ })), google = Array.from(this.__googleFonts.fonts.values(), (font)=>({
32860
+ value: this.__googleFonts.value(font),
32861
+ title: font.family,
32862
+ font
32863
+ })), byFamily = new Map();
32864
+ [
32865
+ ...google,
32866
+ ...listed
32867
+ ].forEach((entry)=>byFamily.set((0,_google_fonts__WEBPACK_IMPORTED_MODULE_11__.firstFamily)(entry.value), entry));
32868
+ const theme = new Map(), used = new Map();
32869
+ // The theme's own fonts are listed too, so its body font can be chosen
32870
+ // to take a font off
32871
+ this.__themeFonts().forEach((fontFamily)=>{
32872
+ const family = (0,_google_fonts__WEBPACK_IMPORTED_MODULE_11__.firstFamily)(fontFamily), title = fontFamily.split(',')[0].replace(/["']/g, '').trim(), entry = byFamily.get(family) ?? (isFontName(family) ? {
32873
+ value: fontFamily,
32874
+ title
32875
+ } : undefined);
32876
+ entry && !theme.has(family) && theme.set(family, entry);
32877
+ });
32878
+ this.__usedFonts().forEach((fontFamily)=>{
32879
+ const family = (0,_google_fonts__WEBPACK_IMPORTED_MODULE_11__.firstFamily)(fontFamily), entry = byFamily.get(family);
32880
+ entry && !theme.has(family) && used.set(family, entry);
32881
+ });
32882
+ const defaultEntry = listed.find((entry)=>entry.value === ''), current = (0,_google_fonts__WEBPACK_IMPORTED_MODULE_11__.firstFamily)(control.value?.(this.j, this.__button) ?? '');
32883
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.detach(this.container);
32884
+ this.__fonts.clear();
32885
+ defaultEntry && this.__append(current, [
32886
+ defaultEntry
32887
+ ]);
32888
+ this.__append(current, [
32889
+ ...theme.values()
32890
+ ], 'Theme fonts');
32891
+ this.__append(current, [
32892
+ ...used.values()
32893
+ ], 'Used fonts');
32894
+ this.__append(current, listed.filter((entry)=>entry !== defaultEntry), 'System fonts');
32895
+ this.__append(current, google, 'Google Fonts');
32896
+ this.__observeGoogleFonts();
32897
+ }
32898
+ /**
32899
+ * The fonts the editor's styles give text and each heading
32900
+ */ __themeFonts() {
32901
+ const { editor } = this.j, fonts = [
32902
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(editor, 'font-family').toString()
32903
+ ];
32904
+ HEADINGS.forEach((tag)=>{
32905
+ const heading = this.j.createInside.element(tag, {
32906
+ style: 'display: none'
32907
+ });
32908
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(editor, heading);
32909
+ fonts.push((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(heading, 'font-family').toString());
32910
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeRemove(heading);
32911
+ });
32912
+ return fonts;
32913
+ }
32914
+ /**
32915
+ * The fonts the content sets
32916
+ */ __usedFonts() {
32917
+ return Array.from(this.j.editor.querySelectorAll('[style*="font-family"]'), (element)=>element.style.fontFamily);
32918
+ }
32919
+ __append(current, entries, heading) {
32920
+ if (!entries.length) {
32921
+ return;
32922
+ }
32923
+ const { control } = this.__button, group = this.j.c.div(this.getFullElName('group'));
32924
+ if (heading) {
32925
+ const title = this.j.c.div(this.getFullElName('heading'), {
32926
+ id: `${this.getFullElName('heading')}-${(0,jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.uniqueUid)()}`
32927
+ });
32928
+ title.textContent = this.i18n(heading);
32929
+ (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__.attr)(group, {
32930
+ role: 'group',
32931
+ 'aria-labelledby': title.id
32932
+ });
32933
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(group, title);
32934
+ }
32935
+ entries.forEach((entry)=>{
32936
+ const item = this.j.c.element('button', {
32937
+ type: 'button',
32938
+ class: this.getFullElName('item'),
32939
+ 'data-value': entry.value,
32940
+ 'aria-pressed': (0,_google_fonts__WEBPACK_IMPORTED_MODULE_11__.firstFamily)(entry.value) === current
32941
+ });
32942
+ if (entry.font) {
32943
+ item.textContent = entry.title;
32944
+ this.__fonts.set(item, entry.font);
32945
+ } else {
32946
+ item.innerHTML = control.childTemplate?.(this.j, entry.value, entry.title, this.__button) ?? entry.title;
32947
+ }
32948
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(group, item);
32949
+ });
32950
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(this.container, group);
32951
+ }
32952
+ /**
32953
+ * Shows the names of the Google Fonts in view, and those just below it,
32954
+ * in their own fonts. Setting every item's font up front would have the
32955
+ * browser look for each of the library's families among the installed
32956
+ * fonts the first time the list opens
32957
+ */ __observeGoogleFonts() {
32958
+ this.j.async.requestAnimationFrame(()=>{
32959
+ this.__observer?.disconnect();
32960
+ if (this.isDestructed || !this.__fonts.size) {
32961
+ return;
32962
+ }
32963
+ const observer = new IntersectionObserver((entries)=>{
32964
+ const fonts = [];
32965
+ entries.forEach(({ isIntersecting, target })=>{
32966
+ const font = this.__fonts.get(target);
32967
+ if (isIntersecting && font) {
32968
+ fonts.push(font);
32969
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(target, {
32970
+ fontFamily: this.__googleFonts.value(font)
32971
+ });
32972
+ observer.unobserve(target);
32973
+ }
32974
+ });
32975
+ this.__googleFonts.preview(fonts);
32976
+ }, {
32977
+ root: this.container.parentElement,
32978
+ rootMargin: '0px 0px 400px 0px'
32979
+ });
32980
+ this.__fonts.forEach((_, item)=>observer.observe(item));
32981
+ this.__observer = observer;
32982
+ });
32983
+ }
32984
+ /**
32985
+ * Keeps the editor's selection, as the toolbar buttons do
32986
+ */ onMouseDown(e) {
32987
+ e.preventDefault();
32988
+ }
32989
+ onClick(e) {
32990
+ 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);
32991
+ if (!item) {
32992
+ return;
32993
+ }
32994
+ const value = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__.attr)(item, 'data-value') ?? '', font = this.__googleFonts.find(value), // The font the text has anyway is taken off rather than written
32995
+ inherited = (0,_google_fonts__WEBPACK_IMPORTED_MODULE_11__.firstFamily)(value) === (0,_google_fonts__WEBPACK_IMPORTED_MODULE_11__.firstFamily)(this.__blockFont());
32996
+ font && !inherited && this.__googleFonts.load(font);
32997
+ this.j.execCommand('fontname', false, inherited ? '' : value);
32998
+ this.__close();
32999
+ }
33000
+ /**
33001
+ * The font the selected text has without a font of its own: its block's
33002
+ */ __blockFont() {
33003
+ 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);
33004
+ return (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_8__.css)(block ?? this.j.editor, 'font-family').toString();
33005
+ }
33006
+ destruct() {
33007
+ this.__observer?.disconnect();
33008
+ super.destruct();
33009
+ }
33010
+ constructor(jodit, __button, __close){
33011
+ 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;
33012
+ this.__googleFonts = jodit.getInstance(_google_fonts__WEBPACK_IMPORTED_MODULE_11__.GoogleFonts);
33013
+ this.__render();
33014
+ if (!this.__googleFonts.fonts.size) {
33015
+ this.__googleFonts.ready.then(()=>!this.isDestructed && this.__render());
33016
+ }
33017
+ }
33018
+ }
33019
+ ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
33020
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_3__.watch)('container:mousedown')
33021
+ ], UIFontPicker.prototype, "onMouseDown", null);
33022
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
33023
+ (0,jodit_core_decorators_watch_watch__WEBPACK_IMPORTED_MODULE_3__.watch)('container:click')
33024
+ ], UIFontPicker.prototype, "onClick", null);
33025
+ UIFontPicker = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
33026
+ jodit_core_decorators_component_component__WEBPACK_IMPORTED_MODULE_2__.component
33027
+ ], UIFontPicker);
33028
+
33029
+
32565
33030
  /***/ }),
32566
33031
 
32567
33032
  /***/ 50294:
@@ -32572,6 +33037,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.font = {
32572
33037
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28077);
32573
33038
  /* harmony import */ var jodit_core_helpers___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
32574
33039
  /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7433);
33040
+ /* harmony import */ var _google_fonts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(24939);
32575
33041
  /*!
32576
33042
  * Jodit Editor (https://xdsoft.net/jodit/)
32577
33043
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -32583,6 +33049,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.font = {
32583
33049
  */
32584
33050
 
32585
33051
 
33052
+
32586
33053
  /**
32587
33054
  * Process commands `fontsize` and `fontname`
32588
33055
  */ function font(editor) {
@@ -32593,6 +33060,18 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.font = {
32593
33060
  name: 'fontsize',
32594
33061
  group: 'font'
32595
33062
  });
33063
+ if (editor.o.font.googleFonts.url) {
33064
+ const googleFonts = editor.getInstance(_google_fonts__WEBPACK_IMPORTED_MODULE_3__.GoogleFonts), loadUsed = editor.async.debounce(()=>googleFonts.loadUsed(), editor.defaultTimeout);
33065
+ googleFonts.ready.then(loadUsed);
33066
+ editor.e.on('afterInit afterSetMode change', loadUsed);
33067
+ }
33068
+ // An iframe's stylesheets can arrive after the toolbar first shows the
33069
+ // editor's font
33070
+ editor.e.on('afterInit', ()=>{
33071
+ editor.iframe && editor.e.on(editor.ed, 'load', ()=>editor.e.fire('updateToolbar'), {
33072
+ capture: true
33073
+ });
33074
+ });
32596
33075
  const callback = (command, second, third)=>{
32597
33076
  switch(command){
32598
33077
  case 'fontsize':
@@ -32622,6 +33101,160 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.font = {
32622
33101
  jodit_core_global__WEBPACK_IMPORTED_MODULE_0__.pluginSystem.add('font', font);
32623
33102
 
32624
33103
 
33104
+ /***/ }),
33105
+
33106
+ /***/ 24939:
33107
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
33108
+
33109
+ "use strict";
33110
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
33111
+ /* harmony export */ GoogleFonts: function() { return /* binding */ GoogleFonts; },
33112
+ /* harmony export */ firstFamily: function() { return /* binding */ firstFamily; }
33113
+ /* harmony export */ });
33114
+ /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
33115
+ /* harmony import */ var jodit_core_component_view_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(59609);
33116
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(23211);
33117
+ /* harmony import */ var jodit_core_request_ajax__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(17338);
33118
+ /*!
33119
+ * Jodit Editor (https://xdsoft.net/jodit/)
33120
+ * Released under MIT see LICENSE.txt in the project root for license information.
33121
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
33122
+ */ /**
33123
+ * @module plugins/font
33124
+ */
33125
+
33126
+
33127
+
33128
+ const CSS_URL = 'https://fonts.googleapis.com/css2';
33129
+ // `cursive` and `fantasy` stand in badly for a handwriting or display font
33130
+ const GENERIC_FAMILIES = {
33131
+ serif: 'serif',
33132
+ monospace: 'monospace'
33133
+ };
33134
+ const libraries = new Map();
33135
+ /**
33136
+ * The fonts of the library at `url`, fetched once for every editor on the page
33137
+ */ function library(jodit, url) {
33138
+ let fonts = libraries.get(url);
33139
+ if (!fonts) {
33140
+ const ajax = new jodit_core_request_ajax__WEBPACK_IMPORTED_MODULE_3__.Ajax({
33141
+ url,
33142
+ method: 'GET'
33143
+ }, jodit.o.defaultAjaxOptions);
33144
+ fonts = ajax.send().then((response)=>response.json())// A font without a regular style can't be asked for by its name alone
33145
+ .then(({ items })=>items.filter((font)=>font.variants.includes('regular'))).catch(()=>{
33146
+ libraries.delete(url);
33147
+ return [];
33148
+ }).finally(()=>ajax.destruct());
33149
+ libraries.set(url, fonts);
33150
+ }
33151
+ return fonts;
33152
+ }
33153
+ /**
33154
+ * The first family of a `font-family` value, unquoted and in lower case for
33155
+ * comparing
33156
+ */ function firstFamily(fontFamily) {
33157
+ return fontFamily.split(',')[0].replace(/["']/g, '').trim().toLowerCase();
33158
+ }
33159
+ /**
33160
+ * Loads fonts from Google Fonts: the whole of each font the content uses into
33161
+ * the editor's document, and just the letters of its name for the font list
33162
+ */ class GoogleFonts extends jodit_core_component_view_component__WEBPACK_IMPORTED_MODULE_1__.ViewComponent {
33163
+ className() {
33164
+ return 'GoogleFonts';
33165
+ }
33166
+ /**
33167
+ * The library's font named first in a `font-family` value
33168
+ */ find(fontFamily) {
33169
+ return this.fonts.get(firstFamily(fontFamily));
33170
+ }
33171
+ /**
33172
+ * The `font-family` value that applies a font
33173
+ */ value(font) {
33174
+ return `'${font.family}', ${GENERIC_FAMILIES[font.category] ?? 'sans-serif'}`;
33175
+ }
33176
+ /**
33177
+ * Loads the regular, italic, bold and bold italic styles that a font has
33178
+ * into the editor's document
33179
+ */ load(font) {
33180
+ const loaded = this.__loadedInto(this.j.ed);
33181
+ if (loaded.has(font.family)) {
33182
+ return;
33183
+ }
33184
+ loaded.add(font.family);
33185
+ const styles = [
33186
+ [
33187
+ 'regular',
33188
+ '0,400'
33189
+ ],
33190
+ [
33191
+ '700',
33192
+ '0,700'
33193
+ ],
33194
+ [
33195
+ 'italic',
33196
+ '1,400'
33197
+ ],
33198
+ [
33199
+ '700italic',
33200
+ '1,700'
33201
+ ]
33202
+ ].filter(([variant])=>font.variants.includes(variant)).map(([, style])=>style);
33203
+ this.__append(this.j.ed, `family=${this.__family(font)}:ital,wght@${styles.join(';')}`);
33204
+ }
33205
+ /**
33206
+ * Loads every font of the library that the content uses
33207
+ */ loadUsed() {
33208
+ this.j.editor.querySelectorAll('[style*="font-family"]').forEach((element)=>{
33209
+ const font = this.find(element.style.fontFamily);
33210
+ font && this.load(font);
33211
+ });
33212
+ }
33213
+ /**
33214
+ * Loads into the page just the letters of each font's name, so the font
33215
+ * list can show the name in its font
33216
+ */ preview(fonts) {
33217
+ const loaded = this.__loadedInto(this.j.od);
33218
+ fonts = fonts.filter((font)=>!this.__previewed.has(font.family) && !loaded.has(font.family));
33219
+ if (!fonts.length) {
33220
+ return;
33221
+ }
33222
+ fonts.forEach((font)=>this.__previewed.add(font.family));
33223
+ const families = fonts.map((font)=>`family=${this.__family(font)}`), letters = new Set(fonts.map((font)=>font.family).join(''));
33224
+ this.__append(this.j.od, `${families.join('&')}&text=${encodeURIComponent([
33225
+ ...letters
33226
+ ].join(''))}`);
33227
+ }
33228
+ __loadedInto(doc) {
33229
+ const loaded = this.__loaded.get(doc) ?? new Set();
33230
+ this.__loaded.set(doc, loaded);
33231
+ return loaded;
33232
+ }
33233
+ __family(font) {
33234
+ return encodeURIComponent(font.family).replace(/%20/g, '+');
33235
+ }
33236
+ __append(doc, query) {
33237
+ const link = doc.createElement('link');
33238
+ link.rel = 'stylesheet';
33239
+ link.href = `${CSS_URL}?${query}&display=swap`;
33240
+ doc.head.appendChild(link);
33241
+ this.__links.push(link);
33242
+ }
33243
+ destruct() {
33244
+ this.__links.forEach((link)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(link));
33245
+ super.destruct();
33246
+ }
33247
+ constructor(jodit){
33248
+ super(jodit), /**
33249
+ * The library by lower-case family, empty until it arrives
33250
+ */ (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());
33251
+ this.ready = library(jodit, jodit.o.font.googleFonts.url).then((fonts)=>{
33252
+ fonts.forEach((font)=>this.fonts.set(font.family.toLowerCase(), font));
33253
+ });
33254
+ }
33255
+ }
33256
+
33257
+
32625
33258
  /***/ }),
32626
33259
 
32627
33260
  /***/ 96863:
@@ -33874,12 +34507,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProperties
33874
34507
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
33875
34508
  /* harmony export */ readValuesFromImage: function() { return /* binding */ readValuesFromImage; }
33876
34509
  /* harmony export */ });
33877
- /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7909);
33878
- /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(80991);
33879
- /* harmony import */ var _align__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(26633);
33880
- /* harmony import */ var _link__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(79310);
33881
- /* harmony import */ var _margin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(18380);
33882
- /* harmony import */ var _size__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(57339);
34510
+ /* harmony import */ var jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16849);
34511
+ /* harmony import */ var jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7909);
34512
+ /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80991);
34513
+ /* harmony import */ var _align__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(26633);
34514
+ /* harmony import */ var _link__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(79310);
34515
+ /* harmony import */ var _margin__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(18380);
34516
+ /* harmony import */ var _size__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(57339);
33883
34517
  /*!
33884
34518
  * Jodit Editor (https://xdsoft.net/jodit/)
33885
34519
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -33892,32 +34526,33 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProperties
33892
34526
 
33893
34527
 
33894
34528
 
34529
+
33895
34530
  /**
33896
34531
  * Read values from image and set it to state
33897
34532
  * @private
33898
34533
  */ async function readValuesFromImage(j, state) {
33899
34534
  const { sourceImage: image, values } = state;
33900
- (0,_align__WEBPACK_IMPORTED_MODULE_2__.readAlign)(image, values, j.o.imageAlignClasses);
34535
+ (0,_align__WEBPACK_IMPORTED_MODULE_3__.readAlign)(image, values, (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_0__.getAlignClasses)(j, image));
33901
34536
  // Border radius
33902
- values.borderRadius = parseInt((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_1__.cssInline)(image, 'border-radius') || '0', 10) || 0;
34537
+ values.borderRadius = parseInt((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_2__.cssInline)(image, 'border-radius') || '0', 10) || 0;
33903
34538
  // Id
33904
- values.id = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__.attr)(image, 'id') || '';
34539
+ values.id = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'id') || '';
33905
34540
  // Title
33906
- values.imageTitle = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__.attr)(image, 'title') || '';
34541
+ values.imageTitle = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'title') || '';
33907
34542
  // Alt
33908
- values.imageAlt = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__.attr)(image, 'alt') || '';
34543
+ values.imageAlt = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'alt') || '';
33909
34544
  // Style
33910
- values.style = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__.attr)(image, 'style') || '';
34545
+ values.style = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'style') || '';
33911
34546
  // Classes
33912
- values.classes = ((0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__.attr)(image, 'class') || '').replace(/jodit_focused_image[\s]*/, '');
34547
+ values.classes = ((0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'class') || '').replace(/jodit_focused_image[\s]*/, '');
33913
34548
  // Margins
33914
- (0,_margin__WEBPACK_IMPORTED_MODULE_4__.readMargins)(image, values, state);
34549
+ (0,_margin__WEBPACK_IMPORTED_MODULE_5__.readMargins)(image, values, state);
33915
34550
  // Link
33916
- (0,_link__WEBPACK_IMPORTED_MODULE_3__.readLink)(state, j, values);
34551
+ (0,_link__WEBPACK_IMPORTED_MODULE_4__.readLink)(state, j, values);
33917
34552
  // Src
33918
- values.imageSrc = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_0__.attr)(image, 'src') || '';
34553
+ values.imageSrc = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'src') || '';
33919
34554
  // Image size
33920
- return (0,_size__WEBPACK_IMPORTED_MODULE_5__.readSizes)(image, values, state);
34555
+ return (0,_size__WEBPACK_IMPORTED_MODULE_6__.readSizes)(image, values, state);
33921
34556
  }
33922
34557
 
33923
34558
 
@@ -34938,7 +35573,7 @@ UIImagePositionTab = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__
34938
35573
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(image, 'id', id || null);
34939
35574
  }
34940
35575
  if (opt.image.editAlign) {
34941
- (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align, j.o.imageAlignClasses);
35576
+ (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.hAlignElement)(image, align, (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.getAlignClasses)(j, image));
34942
35577
  }
34943
35578
  }
34944
35579
 
@@ -35768,6 +36403,7 @@ const cmd = (control)=>control.args && (0,jodit_core_helpers_checker__WEBPACK_IM
35768
36403
  /* harmony import */ var jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85932);
35769
36404
  /* harmony import */ var jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16849);
35770
36405
  /* harmony import */ var jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(80991);
36406
+ /* harmony import */ var jodit_core_helpers_utils_media_wrapper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(83314);
35771
36407
  /*!
35772
36408
  * Jodit Editor (https://xdsoft.net/jodit/)
35773
36409
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -35778,9 +36414,7 @@ const cmd = (control)=>control.args && (0,jodit_core_helpers_checker__WEBPACK_IM
35778
36414
 
35779
36415
 
35780
36416
 
35781
- // Images align with `imageAlignClasses`; the wrappers of iframes and media
35782
- // keep inline styles
35783
- const alignClasses = (editor, elm)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, 'img') ? editor.o.imageAlignClasses : null;
36417
+
35784
36418
  // A Normal image sits where the text of its line is aligned (#1531)
35785
36419
  const lineAlign = (editor, elm)=>{
35786
36420
  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;
@@ -35801,7 +36435,7 @@ const lineAlign = (editor, elm)=>{
35801
36435
  return 'left';
35802
36436
  }
35803
36437
  };
35804
- const currentAlign = (editor, elm)=>elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getHAlign)(elm, alignClasses(editor, elm)) : 'normal';
36438
+ 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';
35805
36439
  const align = {
35806
36440
  name: 'left',
35807
36441
  childTemplate: (_, __, value)=>value,
@@ -35821,23 +36455,25 @@ const align = {
35821
36455
  return (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_1__.isString)(value) && currentAlign(editor, button.target) === value.toLowerCase();
35822
36456
  },
35823
36457
  exec: (editor, elm, { control })=>{
35824
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
36458
+ // A media wrapper kept in the content (`mediaWrappers`) is aligned itself
36459
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isHTMLElement(elm) || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
35825
36460
  'img',
35826
36461
  'jodit',
35827
36462
  'jodit-media'
35828
- ]))) {
36463
+ ])) && (0,jodit_core_helpers_utils_media_wrapper__WEBPACK_IMPORTED_MODULE_4__.getMediaWrapper)(editor, elm) !== elm) {
35829
36464
  return;
35830
36465
  }
35831
36466
  const command = control.args && (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_1__.isString)(control.args[0]) ? control.args[0].toLowerCase() : '';
35832
36467
  if (!command) {
35833
36468
  return false;
35834
36469
  }
35835
- ;(0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm, command, alignClasses(editor, elm));
36470
+ ;(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));
35836
36471
  if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, new Set([
35837
36472
  'jodit',
35838
36473
  'jodit-media'
35839
36474
  ])) && elm.firstElementChild) {
35840
- (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.hAlignElement)(elm.firstElementChild, command);
36475
+ const media = elm.firstElementChild;
36476
+ (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));
35841
36477
  }
35842
36478
  editor.synchronizeValues();
35843
36479
  editor.e.fire('recalcPositionPopup');
@@ -35989,9 +36625,11 @@ const align = {
35989
36625
  return (0,jodit_modules_toolbar_factory__WEBPACK_IMPORTED_MODULE_9__.makeCollection)(this.jodit, this.popup);
35990
36626
  }
35991
36627
  onClick(node) {
35992
- 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);
35993
- if (target && this.canShowPopupForType(target.nodeName.toLowerCase())) {
35994
- this.showPopup(()=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(target, this.j), target.nodeName.toLowerCase(), target);
36628
+ const elements = this.elmsList, mediaWrapper = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.getMediaWrapper)(this.j, node), target = 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));
36629
+ // A media wrapper kept in the content gets the media popup
36630
+ const type = mediaWrapper ? 'jodit-media' : target?.nodeName.toLowerCase();
36631
+ if (target && type && this.canShowPopupForType(type)) {
36632
+ this.showPopup(()=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.position)(target, this.j), type, target);
35995
36633
  return false;
35996
36634
  }
35997
36635
  }
@@ -36174,7 +36812,11 @@ const align = {
36174
36812
  this.removeListenersForElements();
36175
36813
  }
36176
36814
  _eventsList() {
36177
- const el = this.elmsList;
36815
+ // Clicks on a media wrapper kept in the content (`mediaWrappers`)
36816
+ const wrapperTags = Object.values(this.j.o.mediaWrappers ?? {}).map(({ tag })=>tag.toLowerCase());
36817
+ const el = [
36818
+ ...new Set(this.elmsList.concat(wrapperTags))
36819
+ ];
36178
36820
  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(' ');
36179
36821
  }
36180
36822
  addListenersForElements() {
@@ -37099,7 +37741,7 @@ class lineHeight extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
37099
37741
  try {
37100
37742
  if (s.isCollapsed()) {
37101
37743
  const fake = c.fake();
37102
- s.insertNode(fake, false, false);
37744
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeInsertNode(s.range, fake);
37103
37745
  apply(fake);
37104
37746
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(fake);
37105
37747
  } else {
@@ -37712,6 +38354,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.mediaBlocks = [
37712
38354
  'video',
37713
38355
  'audio'
37714
38356
  ];
38357
+ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.mediaWrappers = {};
37715
38358
 
37716
38359
 
37717
38360
  /***/ }),
@@ -37745,11 +38388,13 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.mediaBlocks = [
37745
38388
  * Process `video` and `audio`
37746
38389
  */ function media(editor) {
37747
38390
  const keyFake = 'jodit_fake_wrapper';
37748
- const { mediaFakeTag, mediaBlocks, mediaInFakeBlock } = editor.options;
38391
+ const { mediaFakeTag, mediaBlocks, mediaInFakeBlock, mediaWrappers } = editor.options;
37749
38392
  const wrap = (element)=>{
37750
38393
  if (element.parentNode && (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(element.parentNode, 'data-jodit_iframe_wrapper')) {
37751
38394
  element = element.parentNode;
37752
- } else {
38395
+ } else if (mediaWrappers[element.nodeName.toLowerCase()]) {
38396
+ element = (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.getMediaWrapper)(editor, element) ?? (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.wrapMedia)(editor, element);
38397
+ } else if (mediaInFakeBlock) {
37753
38398
  const wrapper = editor.createInside.element(mediaFakeTag, {
37754
38399
  'data-jodit-temp': 1,
37755
38400
  contenteditable: false,
@@ -37767,12 +38412,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.mediaBlocks = [
37767
38412
  }
37768
38413
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(wrapper, element);
37769
38414
  element = wrapper;
38415
+ } else {
38416
+ return;
37770
38417
  }
37771
38418
  editor.e.off(element, 'mousedown.select touchstart.select').on(element, 'mousedown.select touchstart.select', ()=>{
37772
38419
  editor.s.setCursorAfter(element);
37773
38420
  });
37774
38421
  };
37775
- if (mediaInFakeBlock) {
38422
+ if (mediaInFakeBlock || Object.keys(mediaWrappers).length) {
37776
38423
  editor.e.on('afterGetValueFromEditor', (data)=>{
37777
38424
  const rxp = new RegExp(`<${mediaFakeTag}[^>]+data-${keyFake}[^>]+>([^]+?)</${mediaFakeTag}>`, 'ig');
37778
38425
  if (rxp.test(data.value)) {
@@ -39122,7 +39769,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.useInputsPlaceholder
39122
39769
  this.placeholderElm.innerHTML = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__.attr)(editor.element, 'placeholder') || '';
39123
39770
  }
39124
39771
  editor.e.fire('placeholder', this.placeholderElm.innerHTML);
39125
- 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);
39772
+ 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);
39126
39773
  this.addNativeListeners();
39127
39774
  this.toggle();
39128
39775
  });
@@ -42267,10 +42914,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.source = {
42267
42914
  /* harmony export */ AceEditor: function() { return /* binding */ AceEditor; }
42268
42915
  /* harmony export */ });
42269
42916
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
42270
- /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
42271
- /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(23211);
42272
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65946);
42273
- /* harmony import */ var jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(94193);
42917
+ /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
42918
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
42919
+ /* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49574);
42920
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
42921
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
42922
+ /* harmony import */ var jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(94193);
42274
42923
  /*!
42275
42924
  * Jodit Editor (https://xdsoft.net/jodit/)
42276
42925
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -42282,7 +42931,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.source = {
42282
42931
 
42283
42932
 
42284
42933
 
42285
- class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_4__.SourceEditor {
42934
+
42935
+
42936
+ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_6__.SourceEditor {
42286
42937
  aceExists() {
42287
42938
  return this.j.ow.ace !== undefined;
42288
42939
  }
@@ -42340,7 +42991,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42340
42991
  return;
42341
42992
  }
42342
42993
  const fakeMirror = this.j.c.div('jodit-source__mirror-fake');
42343
- jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(this.container, fakeMirror);
42994
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(this.container, fakeMirror);
42344
42995
  const ace = editor.ow.ace;
42345
42996
  this.instance = ace.edit(fakeMirror);
42346
42997
  if (editor.o.direction === 'rtl') {
@@ -42361,15 +43012,15 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42361
43012
  this.instance.setOption('wrap', editor.o.sourceEditorNativeOptions.wrap);
42362
43013
  this.instance.getSession().setUseWorker(false);
42363
43014
  this.instance.$blockScrolling = Infinity;
42364
- this.instance.on('change', this.toWYSIWYG);
43015
+ this.instance.on('change', this.__onChange);
42365
43016
  this.instance.on('focus', this.proxyOnFocus);
42366
43017
  this.instance.on('mousedown', this.proxyOnMouseDown);
42367
43018
  this.instance.on('blur', this.proxyOnBlur);
42368
- if (editor.getRealMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.MODE_WYSIWYG) {
43019
+ if (editor.getRealMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_WYSIWYG) {
42369
43020
  this.setValue(this.getValue());
42370
43021
  }
42371
43022
  const onResize = this.j.async.throttle(()=>{
42372
- if (editor.isInDestruct || editor.getMode() === jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.MODE_WYSIWYG) {
43023
+ if (editor.isInDestruct || editor.getMode() === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_WYSIWYG) {
42373
43024
  return;
42374
43025
  }
42375
43026
  const hasFocus = this.instance.isFocused();
@@ -42387,7 +43038,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42387
43038
  };
42388
43039
  let loading = false;
42389
43040
  const initAceEditor = ()=>{
42390
- 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) {
43041
+ 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) {
42391
43042
  return;
42392
43043
  }
42393
43044
  // ACE (~400 KiB from the CDN) is only needed once the source view
@@ -42396,7 +43047,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42396
43047
  if (!this.aceExists()) {
42397
43048
  if (!loading) {
42398
43049
  loading = true;
42399
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.loadNext)(editor, editor.o.sourceEditorCDNUrlsJS).then(initAceEditor).catch(()=>null);
43050
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.loadNext)(editor, editor.o.sourceEditorCDNUrlsJS).then(initAceEditor).catch(()=>null);
42400
43051
  }
42401
43052
  return;
42402
43053
  }
@@ -42408,7 +43059,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42408
43059
  initAceEditor();
42409
43060
  }
42410
43061
  destruct() {
42411
- this.instance.off('change', this.toWYSIWYG);
43062
+ this.instance.off('change', this.__onChange);
42412
43063
  this.instance.off('focus', this.proxyOnFocus);
42413
43064
  this.instance.off('mousedown', this.proxyOnMouseDown);
42414
43065
  this.instance.destroy();
@@ -42417,13 +43068,29 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42417
43068
  setValue(value) {
42418
43069
  if (!this.j.o.editHTMLDocumentMode && this.j.o.beautifyHTML) {
42419
43070
  const html = this.j.e.fire('beautifyHTML', value);
42420
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isString)(html)) {
43071
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isString)(html)) {
42421
43072
  value = html;
42422
43073
  }
42423
43074
  }
42424
- this.instance.setValue(value);
43075
+ // ACE reports its own `setValue` as two changes, the removal of the
43076
+ // old text and the insertion of the new one. Fed back into the
43077
+ // editor they became two history entries, `content -> ''` and
43078
+ // `'' -> content`, so the first undo after a switch to the source
43079
+ // view and back emptied the editor. The text came from the editor
43080
+ // in the first place, so there is nothing to send back.
43081
+ this.__settingValue = true;
43082
+ try {
43083
+ this.instance.setValue(value);
43084
+ } finally{
43085
+ this.__settingValue = false;
43086
+ }
42425
43087
  this.instance.clearSelection();
42426
43088
  }
43089
+ __onChange() {
43090
+ if (!this.__settingValue) {
43091
+ this.toWYSIWYG();
43092
+ }
43093
+ }
42427
43094
  getValue() {
42428
43095
  return this.instance.getValue();
42429
43096
  }
@@ -42497,9 +43164,12 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
42497
43164
  this.j.e.fire('focus', e);
42498
43165
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "proxyOnMouseDown", (e)=>{
42499
43166
  this.j.e.fire('mousedown', e);
42500
- });
43167
+ }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__settingValue", false);
42501
43168
  }
42502
43169
  }
43170
+ ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
43171
+ jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_3__.autobind
43172
+ ], AceEditor.prototype, "__onChange", null);
42503
43173
 
42504
43174
 
42505
43175
  /***/ }),
@@ -45405,14 +46075,32 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('toolbarNavigati
45405
46075
 
45406
46076
 
45407
46077
 
46078
+ // Media the popup inserts go in their wrapper (see `mediaWrappers`), aligned
46079
+ // with `mediaDefaultAlign`
46080
+ function prepareMedia(jodit, element) {
46081
+ const media = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.wrapMedia)(jodit, element);
46082
+ const { mediaDefaultAlign } = jodit.o;
46083
+ if (mediaDefaultAlign && mediaDefaultAlign !== 'normal') {
46084
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.hAlignElement)(media, mediaDefaultAlign, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.getAlignClasses)(jodit, media));
46085
+ }
46086
+ return media;
46087
+ }
45408
46088
  function insertVideos(data) {
45409
46089
  data.files?.forEach((file)=>{
45410
- this.s.insertNode(this.createInside.element('video', {
46090
+ this.s.insertNode(prepareMedia(this, this.createInside.element('video', {
45411
46091
  controls: '',
45412
46092
  src: data.baseurl + file
45413
- }));
46093
+ })));
45414
46094
  });
45415
46095
  }
46096
+ // Embed code that is one element is prepared as media; other code goes in as
46097
+ // it is
46098
+ function prepareEmbedCode(jodit, code) {
46099
+ const box = jodit.createInside.div();
46100
+ box.innerHTML = code.trim();
46101
+ const element = box.firstElementChild;
46102
+ return element && box.childNodes.length === 1 ? prepareMedia(jodit, element) : code;
46103
+ }
45416
46104
  jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.video = {
45417
46105
  parseUrlToVideoEmbed: jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.convertMediaUrlToVideoEmbed,
45418
46106
  defaultWidth: 400,
@@ -45450,7 +46138,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.video = {
45450
46138
  ])
45451
46139
  ]), tabs = [], insertCode = (code)=>{
45452
46140
  jodit.s.restore();
45453
- jodit.s.insertHTML(code);
46141
+ jodit.s.insertHTML(prepareEmbedCode(jodit, code));
45454
46142
  close();
45455
46143
  };
45456
46144
  jodit.s.save();