jodit 4.14.4 → 4.14.6

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 (187) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +9 -9
  4. package/es2015/jodit.js +49 -34
  5. package/es2015/jodit.min.js +9 -9
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +9 -9
  13. package/es2018/jodit.min.js +9 -9
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +10 -10
  18. package/es2021/jodit.js +49 -34
  19. package/es2021/jodit.min.js +10 -10
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +10 -10
  28. package/es2021.en/jodit.js +49 -34
  29. package/es2021.en/jodit.min.js +10 -10
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +49 -34
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/core/constants.js +1 -1
  51. package/esm/core/dom/dom.js +2 -2
  52. package/esm/core/global.js +1 -1
  53. package/esm/core/helpers/checker/has-browser-color-picker.js +1 -1
  54. package/esm/core/helpers/html/apply-styles.js +1 -1
  55. package/esm/core/helpers/string/fuzzy-search-index.js +1 -1
  56. package/esm/core/helpers/utils/set.js +2 -2
  57. package/esm/core/storage/async-storage.js +1 -3
  58. package/esm/core/ui/popup/popup.js +1 -1
  59. package/esm/modules/image-editor/image-editor.js +1 -1
  60. package/esm/modules/table/table.js +2 -2
  61. package/esm/modules/widget/file-selector/file-selector.js +0 -1
  62. package/esm/plugins/ai-assistant/langs/en.js +1 -1
  63. package/esm/plugins/ai-assistant/langs/es.js +1 -1
  64. package/esm/plugins/backspace/cases/check-remove-char.js +0 -1
  65. package/esm/plugins/clean-html/helpers/visitor/filters/replace-old-tags.js +0 -1
  66. package/esm/plugins/color/config.js +1 -1
  67. package/esm/plugins/copy-format/langs/ar.js +1 -1
  68. package/esm/plugins/copy-format/langs/cs_cz.js +1 -1
  69. package/esm/plugins/copy-format/langs/de.js +1 -1
  70. package/esm/plugins/copy-format/langs/es.js +1 -1
  71. package/esm/plugins/copy-format/langs/fa.js +1 -1
  72. package/esm/plugins/copy-format/langs/fi.js +1 -1
  73. package/esm/plugins/copy-format/langs/fr.js +1 -1
  74. package/esm/plugins/copy-format/langs/he.js +1 -1
  75. package/esm/plugins/copy-format/langs/hu.js +1 -1
  76. package/esm/plugins/copy-format/langs/id.js +1 -1
  77. package/esm/plugins/copy-format/langs/it.js +1 -1
  78. package/esm/plugins/copy-format/langs/ja.js +1 -1
  79. package/esm/plugins/copy-format/langs/ko.js +1 -1
  80. package/esm/plugins/copy-format/langs/mn.js +1 -1
  81. package/esm/plugins/copy-format/langs/nl.js +1 -1
  82. package/esm/plugins/copy-format/langs/pl.js +1 -1
  83. package/esm/plugins/copy-format/langs/pt_br.js +1 -1
  84. package/esm/plugins/copy-format/langs/ru.js +1 -1
  85. package/esm/plugins/copy-format/langs/tr.js +1 -1
  86. package/esm/plugins/copy-format/langs/zh_cn.js +1 -1
  87. package/esm/plugins/copy-format/langs/zh_tw.js +1 -1
  88. package/esm/plugins/iframe/iframe.js +28 -9
  89. package/esm/plugins/line-height/langs/ar.js +1 -1
  90. package/esm/plugins/line-height/langs/cs_cz.js +1 -1
  91. package/esm/plugins/line-height/langs/de.js +1 -1
  92. package/esm/plugins/line-height/langs/es.js +1 -1
  93. package/esm/plugins/line-height/langs/fa.js +1 -1
  94. package/esm/plugins/line-height/langs/fi.js +1 -1
  95. package/esm/plugins/line-height/langs/fr.js +1 -1
  96. package/esm/plugins/line-height/langs/he.js +1 -1
  97. package/esm/plugins/line-height/langs/hu.js +1 -1
  98. package/esm/plugins/line-height/langs/id.js +1 -1
  99. package/esm/plugins/line-height/langs/it.js +1 -1
  100. package/esm/plugins/line-height/langs/ja.js +1 -1
  101. package/esm/plugins/line-height/langs/ko.js +1 -1
  102. package/esm/plugins/line-height/langs/mn.js +1 -1
  103. package/esm/plugins/line-height/langs/nl.js +1 -1
  104. package/esm/plugins/line-height/langs/pl.js +1 -1
  105. package/esm/plugins/line-height/langs/pt_br.js +1 -1
  106. package/esm/plugins/line-height/langs/ru.js +1 -1
  107. package/esm/plugins/line-height/langs/sk.js +1 -1
  108. package/esm/plugins/line-height/langs/tr.js +1 -1
  109. package/esm/plugins/line-height/langs/ua.js +1 -1
  110. package/esm/plugins/line-height/langs/zh_cn.js +1 -1
  111. package/esm/plugins/line-height/langs/zh_tw.js +1 -1
  112. package/esm/plugins/resize-cells/resize-cells.js +2 -2
  113. package/esm/plugins/resizer/resizer.js +1 -1
  114. package/esm/plugins/search/helpers/sentence-finder.js +1 -1
  115. package/esm/plugins/source/source.js +1 -1
  116. package/esm/plugins/speech-recognize/langs/ar.js +1 -1
  117. package/esm/plugins/speech-recognize/langs/cs_cz.js +1 -1
  118. package/esm/plugins/speech-recognize/langs/de.js +1 -1
  119. package/esm/plugins/speech-recognize/langs/es.js +1 -1
  120. package/esm/plugins/speech-recognize/langs/fa.js +1 -1
  121. package/esm/plugins/speech-recognize/langs/fi.js +1 -1
  122. package/esm/plugins/speech-recognize/langs/fr.js +1 -1
  123. package/esm/plugins/speech-recognize/langs/he.js +1 -1
  124. package/esm/plugins/speech-recognize/langs/hu.js +1 -1
  125. package/esm/plugins/speech-recognize/langs/id.js +1 -1
  126. package/esm/plugins/speech-recognize/langs/it.js +1 -1
  127. package/esm/plugins/speech-recognize/langs/ja.js +1 -1
  128. package/esm/plugins/speech-recognize/langs/ko.js +1 -1
  129. package/esm/plugins/speech-recognize/langs/mn.js +1 -1
  130. package/esm/plugins/speech-recognize/langs/nl.js +1 -1
  131. package/esm/plugins/speech-recognize/langs/no.js +1 -1
  132. package/esm/plugins/speech-recognize/langs/pl.js +1 -1
  133. package/esm/plugins/speech-recognize/langs/pt_br.js +1 -1
  134. package/esm/plugins/speech-recognize/langs/ru.js +1 -1
  135. package/esm/plugins/speech-recognize/langs/sk.js +1 -1
  136. package/esm/plugins/speech-recognize/langs/tr.js +1 -1
  137. package/esm/plugins/speech-recognize/langs/ua.js +1 -1
  138. package/esm/plugins/speech-recognize/langs/zh_cn.js +1 -1
  139. package/esm/plugins/speech-recognize/langs/zh_tw.js +1 -1
  140. package/esm/plugins/spellcheck/langs/ar.js +1 -1
  141. package/esm/plugins/spellcheck/langs/cs_cz.js +1 -1
  142. package/esm/plugins/spellcheck/langs/de.js +1 -1
  143. package/esm/plugins/spellcheck/langs/es.js +1 -1
  144. package/esm/plugins/spellcheck/langs/fa.js +1 -1
  145. package/esm/plugins/spellcheck/langs/fi.js +1 -1
  146. package/esm/plugins/spellcheck/langs/fr.js +1 -1
  147. package/esm/plugins/spellcheck/langs/he.js +1 -1
  148. package/esm/plugins/spellcheck/langs/hu.js +1 -1
  149. package/esm/plugins/spellcheck/langs/id.js +1 -1
  150. package/esm/plugins/spellcheck/langs/it.js +1 -1
  151. package/esm/plugins/spellcheck/langs/ja.js +1 -1
  152. package/esm/plugins/spellcheck/langs/ko.js +1 -1
  153. package/esm/plugins/spellcheck/langs/mn.js +1 -1
  154. package/esm/plugins/spellcheck/langs/nl.js +1 -1
  155. package/esm/plugins/spellcheck/langs/no.js +1 -1
  156. package/esm/plugins/spellcheck/langs/pl.js +1 -1
  157. package/esm/plugins/spellcheck/langs/pt_br.js +1 -1
  158. package/esm/plugins/spellcheck/langs/ru.js +1 -1
  159. package/esm/plugins/spellcheck/langs/sk.js +1 -1
  160. package/esm/plugins/spellcheck/langs/tr.js +1 -1
  161. package/esm/plugins/spellcheck/langs/ua.js +1 -1
  162. package/esm/plugins/spellcheck/langs/zh_cn.js +1 -1
  163. package/esm/plugins/spellcheck/langs/zh_tw.js +1 -1
  164. package/esm/plugins/symbols/langs/ar.js +1 -1
  165. package/esm/plugins/symbols/langs/cs_cz.js +1 -1
  166. package/esm/plugins/symbols/langs/de.js +1 -1
  167. package/esm/plugins/symbols/langs/es.js +1 -1
  168. package/esm/plugins/symbols/langs/fa.js +1 -1
  169. package/esm/plugins/symbols/langs/fi.js +1 -1
  170. package/esm/plugins/symbols/langs/fr.js +1 -1
  171. package/esm/plugins/symbols/langs/he.js +1 -1
  172. package/esm/plugins/symbols/langs/hu.js +1 -1
  173. package/esm/plugins/symbols/langs/id.js +1 -1
  174. package/esm/plugins/symbols/langs/it.js +1 -1
  175. package/esm/plugins/symbols/langs/ja.js +1 -1
  176. package/esm/plugins/symbols/langs/ko.js +1 -1
  177. package/esm/plugins/symbols/langs/mn.js +1 -1
  178. package/esm/plugins/symbols/langs/nl.js +1 -1
  179. package/esm/plugins/symbols/langs/pl.js +1 -1
  180. package/esm/plugins/symbols/langs/pt_br.js +1 -1
  181. package/esm/plugins/symbols/langs/ru.js +1 -1
  182. package/esm/plugins/symbols/langs/tr.js +1 -1
  183. package/esm/plugins/symbols/langs/ua.js +1 -1
  184. package/esm/plugins/symbols/langs/zh_cn.js +1 -1
  185. package/esm/plugins/symbols/langs/zh_tw.js +1 -1
  186. package/esm/plugins/table/config.js +1 -1
  187. package/package.json +4 -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.14.4
4
+ * Version: v4.14.6
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1779,7 +1779,7 @@ __webpack_require__.r(__webpack_exports__);
1779
1779
  * ```
1780
1780
  * @packageDocumentation
1781
1781
  * @module constants
1782
- */ const APP_VERSION = "4.14.4";
1782
+ */ const APP_VERSION = "4.14.6";
1783
1783
  // prettier-ignore
1784
1784
  const ES = "es2021";
1785
1785
  const IS_ES_MODERN = true;
@@ -3075,7 +3075,7 @@ const TEMP_ELEMENT_REG_EXP = new RegExp(`<([a-z]+)[^>]+${jodit_core_constants__W
3075
3075
  const first = current;
3076
3076
  let last = current;
3077
3077
  editor.s.save();
3078
- let needFindNext = false;
3078
+ let needFindNext;
3079
3079
  do {
3080
3080
  needFindNext = false;
3081
3081
  tmp = last.nextSibling;
@@ -3110,7 +3110,7 @@ const TEMP_ELEMENT_REG_EXP = new RegExp(`<([a-z]+)[^>]+${jodit_core_constants__W
3110
3110
  let first = current;
3111
3111
  let last = current;
3112
3112
  editor.s.save();
3113
- let needFindNext = false;
3113
+ let needFindNext;
3114
3114
  do {
3115
3115
  needFindNext = false;
3116
3116
  tmp = first.previousSibling;
@@ -4778,7 +4778,7 @@ const boxes = new WeakMap();
4778
4778
  const name = (0,jodit_core_helpers_checker_is_string__WEBPACK_IMPORTED_MODULE_1__.isString)(classFunc) ? classFunc : classFunc ? (0,jodit_core_helpers_utils_get_class_name__WEBPACK_IMPORTED_MODULE_6__.getClassName)(classFunc.prototype) : 'jodit-utils';
4779
4779
  const data = boxes.get(jodit) || {}, key = name + tag;
4780
4780
  const view = (0,jodit_core_helpers_checker_is_view_object__WEBPACK_IMPORTED_MODULE_2__.isViewObject)(jodit) ? jodit : jodit.j;
4781
- let body = null;
4781
+ let body;
4782
4782
  if (!data[key]) {
4783
4783
  let c = view.c;
4784
4784
  body = getPopupViewRoot(view.o, view.container, jodit.od.body);
@@ -5025,7 +5025,7 @@ const boxes = new WeakMap();
5025
5025
  /**
5026
5026
  * Check if browser has a color picker (a new HTML5 attribute for input tag)
5027
5027
  */ function hasBrowserColorPicker() {
5028
- let supportsColor = true;
5028
+ let supportsColor;
5029
5029
  try {
5030
5030
  const a = jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.globalDocument.createElement('input');
5031
5031
  a.type = 'color';
@@ -5859,7 +5859,7 @@ function normalizeCSS(s) {
5859
5859
  const iframe = jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.globalDocument.createElement('iframe');
5860
5860
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_4__.css)(iframe, 'display', 'none');
5861
5861
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.globalDocument.body, iframe);
5862
- let convertedString = '', collection = [];
5862
+ let convertedString = '', collection;
5863
5863
  try {
5864
5864
  const iframeDoc = iframe.contentDocument || (iframe.contentWindow ? iframe.contentWindow.document : null);
5865
5865
  if (iframeDoc) {
@@ -7195,7 +7195,7 @@ function size(subject) {
7195
7195
  * Finds the position of the substring in the string, if any, and returns the length of the found subsequence.
7196
7196
  * Unlike `indexOf` ignores INVISIBLE_SPACE and may fail at `maxDistance` characters
7197
7197
  */ function fuzzySearchIndex(needle, haystack, offset = 0, maxDistance = 1) {
7198
- let i = 0, j = 0, startIndex = -1, len = 0, errorDistance = 0;
7198
+ let i = 0, j, startIndex = -1, len = 0, errorDistance = 0;
7199
7199
  for(j = offset; i < needle.length && j < haystack.length;){
7200
7200
  if (needle[i].toLowerCase() === haystack[j].toLowerCase()) {
7201
7201
  i++;
@@ -9420,9 +9420,9 @@ const $$temp = ()=>{
9420
9420
  if (parts.some(_is_unsafe_proto_key__WEBPACK_IMPORTED_MODULE_4__.isUnsafeProtoKey)) {
9421
9421
  return;
9422
9422
  }
9423
- let result = obj, key = parts[0];
9423
+ let result = obj;
9424
9424
  for(let i = 0; i < parts.length - 1; i += 1){
9425
- key = parts[i];
9425
+ const key = parts[i];
9426
9426
  if (!(0,jodit_core_helpers_checker_is_array__WEBPACK_IMPORTED_MODULE_0__.isArray)(result[key]) && !(0,jodit_core_helpers_checker_is_plain_object__WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(result[key])) {
9427
9427
  result[key] = (0,jodit_core_helpers_checker_is_numeric__WEBPACK_IMPORTED_MODULE_1__.isNumeric)(parts[i + 1]) ? [] : {};
9428
9428
  }
@@ -13467,7 +13467,6 @@ class AsyncStorage {
13467
13467
  }
13468
13468
  static makeStorage(persistentOrStrategy = false, suffix, options) {
13469
13469
  let provider = undefined;
13470
- let storage = null;
13471
13470
  // An explicit `defaultProvider` overrides the strategy-based selection
13472
13471
  // below and decides which provider backs the storage.
13473
13472
  const defaultProvider = options?.defaultProvider;
@@ -13492,8 +13491,7 @@ class AsyncStorage {
13492
13491
  if (!provider) {
13493
13492
  provider = new _engines_memory_storage_provider__WEBPACK_IMPORTED_MODULE_4__.MemoryStorageProvider();
13494
13493
  }
13495
- storage = new AsyncStorage(Promise.resolve(provider), suffix);
13496
- return storage;
13494
+ return new AsyncStorage(Promise.resolve(provider), suffix);
13497
13495
  }
13498
13496
  constructor(provider, suffix){
13499
13497
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "provider", void 0);
@@ -16689,7 +16687,7 @@ class Popup extends jodit_core_ui_group_group__WEBPACK_IMPORTED_MODULE_10__.UIGr
16689
16687
  };
16690
16688
  };
16691
16689
  const getMatchStrategy = (inBox)=>{
16692
- let strategy = null;
16690
+ let strategy;
16693
16691
  if (Popup.boxInView(getPointByStrategy(defaultStrategy), inBox)) {
16694
16692
  strategy = defaultStrategy;
16695
16693
  } else {
@@ -22656,7 +22654,7 @@ class ImageEditor extends jodit_core_component__WEBPACK_IMPORTED_MODULE_2__.View
22656
22654
  h: 0
22657
22655
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "calcCropBox", ()=>{
22658
22656
  const node = this.crop_box.parentNode, w = node.offsetWidth * 0.8, h = node.offsetHeight * 0.8;
22659
- let wn = w, hn = h;
22657
+ let wn, hn;
22660
22658
  const { naturalWidth: nw, naturalHeight: nh } = this;
22661
22659
  if (w > nw && h > nh) {
22662
22660
  wn = nw;
@@ -23855,8 +23853,8 @@ class Table extends jodit_core_component__WEBPACK_IMPORTED_MODULE_2__.ViewCompon
23855
23853
  }
23856
23854
  }
23857
23855
  static __removeExtraRowspans(box, marked) {
23858
- let i = 0;
23859
- let j = 0;
23856
+ let i;
23857
+ let j;
23860
23858
  for(i = 0; i < box.length; i += 1){
23861
23859
  let min = 1000000;
23862
23860
  let not = false;
@@ -25989,7 +25987,6 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
25989
25987
  button
25990
25988
  ])
25991
25989
  ]);
25992
- currentImage = null;
25993
25990
  if (elm && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isText(elm) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isComment(elm) && (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, 'img') || (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.$$)('img', elm).length)) {
25994
25991
  currentImage = elm.tagName === 'IMG' ? elm : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.$$)('img', elm)[0];
25995
25992
  val(form.container, 'url', (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(currentImage, 'src'));
@@ -27403,7 +27400,6 @@ function checkRemoveChar(jodit, fakeNode, backspace, mode) {
27403
27400
  }
27404
27401
  if (removeNeighbor) {
27405
27402
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(removeNeighbor);
27406
- removeNeighbor = null;
27407
27403
  }
27408
27404
  if (charRemoved) {
27409
27405
  removeEmptyForParent(fakeNode, 'a');
@@ -29003,7 +28999,6 @@ __webpack_require__.r(__webpack_exports__);
29003
28999
  */ function replaceOldTags(jodit, nodeElm, hadEffect) {
29004
29000
  const newNodeElm = replaceIfMatched(jodit, nodeElm, jodit.o.cleanHTML.replaceOldTags);
29005
29001
  if (nodeElm !== newNodeElm) {
29006
- nodeElm = newNodeElm;
29007
29002
  return true;
29008
29003
  }
29009
29004
  return hadEffect;
@@ -29661,7 +29656,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.brush = {
29661
29656
  button.state.activated = false;
29662
29657
  },
29663
29658
  popup: (editor, current, close, button)=>{
29664
- let colorHEX = '', bg_color = '', tabs = [], currentElement = null;
29659
+ let colorHEX = '', bg_color = '', tabs, currentElement = null;
29665
29660
  if (current && current !== editor.editor && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isNode(current)) {
29666
29661
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement(current) && editor.s.isCollapsed() && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(current, new Set([
29667
29662
  'br',
@@ -32631,6 +32626,25 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeSandbox = null;
32631
32626
  }
32632
32627
  return html;
32633
32628
  };
32629
+ /**
32630
+ * Replace the whole iframe document with the given HTML.
32631
+ *
32632
+ * The markup is parsed in an inert document first (no browsing
32633
+ * context: scripts do not run, sub-resources are not fetched),
32634
+ * sanitized there via `safeHTML`, and only then moved into the
32635
+ * live document. `document.write` on the live document would
32636
+ * execute inline scripts and event handlers while parsing,
32637
+ * before the sanitizer had a chance to strip them, and the
32638
+ * iframe is same-origin with the host page by default.
32639
+ * A `<script>` the cleaner is configured to keep still never
32640
+ * executes: nodes coming from an inert parser are flagged
32641
+ * "already started", exactly like `innerHTML`.
32642
+ * See GHSA-w3xv-x3fm-59ph.
32643
+ */ const replaceDocument = (html)=>{
32644
+ const inert = new DOMParser().parseFromString(html, 'text/html');
32645
+ editor.e.fire('safeHTML', inert.documentElement);
32646
+ doc.replaceChild(doc.adoptNode(inert.documentElement), doc.documentElement);
32647
+ };
32634
32648
  if (docMode) {
32635
32649
  const tag = editor.element.tagName;
32636
32650
  if (tag !== 'TEXTAREA' && tag !== 'INPUT') {
@@ -32643,19 +32657,20 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeSandbox = null;
32643
32657
  if (/<(html|body)/i.test(value)) {
32644
32658
  const old = doc.documentElement.outerHTML;
32645
32659
  if (clearMarkers(old) !== clearMarkers(value)) {
32646
- doc.open();
32647
- doc.write(editor.o.iframeDoctype + clearMarkers(value));
32648
- doc.close();
32660
+ replaceDocument(clearMarkers(value));
32649
32661
  editor.editor = doc.body;
32650
- editor.e.fire('safeHTML', editor.editor);
32651
32662
  toggleEditable();
32652
32663
  editor.e.fire('prepareWYSIWYGEditor');
32653
32664
  editor.e.stopPropagation('beforeSetNativeEditorValue');
32654
32665
  }
32655
- } else {
32656
- doc.body.innerHTML = value;
32666
+ return true;
32657
32667
  }
32658
- return true;
32668
+ // A partial value goes through the regular
32669
+ // path: `clean-html` sanitizes it and the
32670
+ // editor assigns it to `doc.body` via
32671
+ // `innerHTML`. Writing the raw value here
32672
+ // would fire its event handlers first.
32673
+ return false;
32659
32674
  }, {
32660
32675
  top: true
32661
32676
  });
@@ -38819,11 +38834,11 @@ const key = 'table_processor_observer-resize';
38819
38834
  this.startX = event.clientX;
38820
38835
  this.j.lock(key);
38821
38836
  this.resizeHandler.classList.add('jodit-table-resizer_moved');
38822
- let box, tableBox = this.workTable.getBoundingClientRect();
38837
+ let box;
38823
38838
  this.minX = 0;
38824
38839
  this.maxX = 1000000;
38825
38840
  if (this.wholeTable != null) {
38826
- tableBox = this.workTable.parentNode.getBoundingClientRect();
38841
+ const tableBox = this.workTable.parentNode.getBoundingClientRect();
38827
38842
  this.minX = tableBox.left;
38828
38843
  this.maxX = this.minX + tableBox.width;
38829
38844
  } else {
@@ -39359,7 +39374,7 @@ const keyBInd = '__jodit-resizer_binded';
39359
39374
  diff_y = this.pointerY - this.startY;
39360
39375
  }
39361
39376
  const className = this.handle.className;
39362
- let new_w = 0, new_h = 0;
39377
+ let new_w, new_h;
39363
39378
  const uar = this.j.o.resizer.useAspectRatio;
39364
39379
  if (!this.isAltMode && (uar === true || uar && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(this.element, uar))) {
39365
39380
  if (diff_x) {
@@ -39923,7 +39938,7 @@ class SentenceFinder {
39923
39938
  }
39924
39939
  ranges(needle, position = 0) {
39925
39940
  const results = [];
39926
- let index = position, len = 0, startQueueIndex = 0;
39941
+ let index = position, len, startQueueIndex = 0;
39927
39942
  // Find all ranges in substring
39928
39943
  do {
39929
39944
  [index, len] = this.searchIndex(needle, this.value, index);
@@ -42072,7 +42087,7 @@ class SourceEditor {
42072
42087
  return;
42073
42088
  }
42074
42089
  let value = this.getMirrorValue();
42075
- let selectionStart = 0, selectionEnd = 0;
42090
+ let selectionStart, selectionEnd;
42076
42091
  try {
42077
42092
  value = value.replace(/<span[^>]+data-jodit-selection_marker=(["'])start\1[^>]*>[<>]*?<\/span>/gim, this.tempMarkerStart).replace(/<span[^>]+data-jodit-selection_marker=(["'])end\1[^>]*>[<>]*?<\/span>/gim, this.tempMarkerEnd);
42078
42093
  if (!this.j.o.editHTMLDocumentMode && this.j.o.beautifyHTML) {
@@ -44316,7 +44331,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.table = {
44316
44331
  return;
44317
44332
  }
44318
44333
  const index = parseInt((0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_3__.attr)(e.target, '-index') || '0', 10), row = Math.floor(index / default_cols_count), col = index % default_cols_count;
44319
- let nextIndex = index;
44334
+ let nextIndex;
44320
44335
  switch(e.key){
44321
44336
  case jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.KEY_LEFT:
44322
44337
  nextIndex = col > 0 ? index - 1 : index;