jodit 4.5.3 → 4.5.4

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 (158) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +2 -2
  4. package/es2015/jodit.js +2 -2
  5. package/es2015/jodit.min.js +2 -2
  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.css +1 -1
  13. package/es2018/jodit.fat.min.js +2 -2
  14. package/es2018/jodit.js +2 -2
  15. package/es2018/jodit.min.js +2 -2
  16. package/es2018/plugins/debug/debug.css +1 -1
  17. package/es2018/plugins/debug/debug.js +1 -1
  18. package/es2018/plugins/debug/debug.min.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
  20. package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
  21. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  22. package/es2021/jodit.css +1 -1
  23. package/es2021/jodit.fat.min.js +2 -2
  24. package/es2021/jodit.js +2 -2
  25. package/es2021/jodit.min.js +2 -2
  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 +1 -1
  33. package/es2021.en/jodit.fat.min.js +2 -2
  34. package/es2021.en/jodit.js +2 -2
  35. package/es2021.en/jodit.min.js +2 -2
  36. package/es2021.en/plugins/debug/debug.css +1 -1
  37. package/es2021.en/plugins/debug/debug.js +1 -1
  38. package/es2021.en/plugins/debug/debug.min.js +1 -1
  39. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  40. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  41. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  42. package/es5/5.fat.min.js +1 -1
  43. package/es5/5.min.js +1 -1
  44. package/es5/975.fat.min.js +1 -1
  45. package/es5/975.min.js +1 -1
  46. package/es5/jodit.css +2 -2
  47. package/es5/jodit.fat.min.js +2 -2
  48. package/es5/jodit.js +2 -2
  49. package/es5/jodit.min.css +2 -2
  50. package/es5/jodit.min.js +2 -2
  51. package/es5/plugins/debug/debug.css +1 -1
  52. package/es5/plugins/debug/debug.js +1 -1
  53. package/es5/plugins/debug/debug.min.js +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  56. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  57. package/esm/core/async/async.js +15 -16
  58. package/esm/core/component/component.js +1 -1
  59. package/esm/core/constants.js +1 -1
  60. package/esm/core/create/create.js +2 -1
  61. package/esm/core/decorators/cache/cache.js +2 -1
  62. package/esm/core/decorators/persistent/persistent.js +2 -1
  63. package/esm/core/decorators/watch/watch.js +3 -2
  64. package/esm/core/dom/dom.js +15 -11
  65. package/esm/core/dom/lazy-walker.js +6 -3
  66. package/esm/core/event-emitter/event-emitter.js +8 -6
  67. package/esm/core/event-emitter/eventify.js +6 -3
  68. package/esm/core/event-emitter/observable.js +1 -1
  69. package/esm/core/global.js +4 -6
  70. package/esm/core/helpers/array/to-array.js +2 -1
  71. package/esm/core/helpers/html/apply-styles.js +1 -1
  72. package/esm/core/helpers/size/position.js +3 -2
  73. package/esm/core/helpers/string/i18n.js +3 -3
  74. package/esm/core/helpers/utils/get-class-name.js +2 -1
  75. package/esm/core/helpers/utils/get.js +1 -1
  76. package/esm/core/helpers/utils/print.js +4 -3
  77. package/esm/core/helpers/utils/reset.js +3 -2
  78. package/esm/core/helpers/utils/selector.js +1 -1
  79. package/esm/core/helpers/utils/utils.js +6 -5
  80. package/esm/core/plugin/plugin-system.js +1 -1
  81. package/esm/core/plugin/plugin.js +3 -2
  82. package/esm/core/request/ajax.js +7 -4
  83. package/esm/core/selection/helpers/index.js +2 -1
  84. package/esm/core/selection/selection.js +27 -20
  85. package/esm/core/selection/style/api/is-suit-element.js +5 -3
  86. package/esm/core/selection/style/api/list/wrap-list.js +2 -2
  87. package/esm/core/selection/style/api/toggle-attributes.js +2 -1
  88. package/esm/core/selection/style/api/unwrap-children.js +2 -1
  89. package/esm/core/selection/style/apply-style.js +2 -1
  90. package/esm/core/selection/style/commit-style.js +2 -1
  91. package/esm/core/storage/engines/local-storage-provider.js +5 -5
  92. package/esm/core/traits/mods.js +2 -1
  93. package/esm/core/ui/button/group/group.js +5 -3
  94. package/esm/core/ui/element.js +3 -2
  95. package/esm/core/ui/form/form.js +3 -2
  96. package/esm/core/ui/form/inputs/area/area.js +1 -1
  97. package/esm/core/ui/form/inputs/input/input.js +8 -5
  98. package/esm/core/ui/form/inputs/select/select.js +2 -1
  99. package/esm/core/ui/group/group.js +2 -2
  100. package/esm/core/ui/group/list.js +5 -2
  101. package/esm/core/ui/helpers/buttons.js +2 -1
  102. package/esm/core/ui/icon.js +6 -5
  103. package/esm/core/view/view-with-toolbar.js +6 -6
  104. package/esm/core/view/view.js +7 -5
  105. package/esm/index.js +2 -1
  106. package/esm/jodit.js +6 -5
  107. package/esm/modules/context-menu/context-menu.js +2 -1
  108. package/esm/modules/file-browser/builders/context-menu.js +2 -1
  109. package/esm/modules/file-browser/data-provider.js +7 -4
  110. package/esm/modules/file-browser/file-browser.js +16 -9
  111. package/esm/modules/history/history.js +2 -1
  112. package/esm/modules/image-editor/image-editor.js +1 -1
  113. package/esm/modules/status-bar/status-bar.js +4 -2
  114. package/esm/modules/table/table.js +4 -2
  115. package/esm/modules/toolbar/button/button.js +26 -15
  116. package/esm/modules/toolbar/button/select/select.js +2 -1
  117. package/esm/modules/uploader/helpers/send.js +1 -1
  118. package/esm/modules/uploader/uploader.js +1 -1
  119. package/esm/plugins/ai-assistant/ai-assistant.js +3 -2
  120. package/esm/plugins/backspace/backspace.js +2 -1
  121. package/esm/plugins/backspace/cases/check-remove-char.js +6 -4
  122. package/esm/plugins/backspace/cases/check-unwrap-first-list-item.js +2 -1
  123. package/esm/plugins/clipboard/clipboard.js +7 -4
  124. package/esm/plugins/delete/delete.js +2 -1
  125. package/esm/plugins/drag-and-drop-element/drag-and-drop-element.js +3 -2
  126. package/esm/plugins/enter/enter.js +2 -2
  127. package/esm/plugins/font/config.js +7 -4
  128. package/esm/plugins/format-block/config.js +4 -2
  129. package/esm/plugins/fullsize/fullsize.js +4 -2
  130. package/esm/plugins/iframe/iframe.js +2 -1
  131. package/esm/plugins/image-processor/image-processor.js +3 -2
  132. package/esm/plugins/image-properties/image-properties.js +4 -3
  133. package/esm/plugins/inline-popup/inline-popup.js +1 -1
  134. package/esm/plugins/key-arrow-outside/key-arrow-outside.js +2 -1
  135. package/esm/plugins/link/link.js +9 -8
  136. package/esm/plugins/mobile/config.js +2 -2
  137. package/esm/plugins/mobile/mobile.js +3 -4
  138. package/esm/plugins/ordered-list/config.js +2 -1
  139. package/esm/plugins/ordered-list/ordered-list.js +1 -1
  140. package/esm/plugins/paste/paste.js +4 -4
  141. package/esm/plugins/paste-from-word/paste-from-word.js +2 -1
  142. package/esm/plugins/placeholder/placeholder.js +2 -1
  143. package/esm/plugins/print/lib/generate-critical-css.js +3 -3
  144. package/esm/plugins/search/helpers/highlight-text-ranges.js +1 -1
  145. package/esm/plugins/search/helpers/sentence-finder.js +2 -1
  146. package/esm/plugins/search/search.js +13 -7
  147. package/esm/plugins/search/ui/search.js +1 -1
  148. package/esm/plugins/select-cells/select-cells.js +8 -4
  149. package/esm/plugins/size/size.js +3 -2
  150. package/esm/plugins/source/editor/engines/ace.js +2 -1
  151. package/esm/plugins/source/editor/sourceEditor.js +2 -1
  152. package/esm/plugins/source/source.js +31 -18
  153. package/esm/plugins/speech-recognize/config.js +5 -3
  154. package/esm/plugins/symbols/symbols.js +1 -1
  155. package/esm/plugins/video/config.js +4 -4
  156. package/esm/plugins/wrap-nodes/wrap-nodes.js +9 -6
  157. package/esm/plugins/xpath/xpath.js +1 -1
  158. package/package.json +1 -1
@@ -56,6 +56,7 @@ export class Plugin extends ViewComponent {
56
56
  }
57
57
  }
58
58
  __beforeDestruct() {
59
+ var _a;
59
60
  if (this.isInDestruct) {
60
61
  return;
61
62
  }
@@ -69,8 +70,8 @@ export class Plugin extends ViewComponent {
69
70
  return super.destruct();
70
71
  }
71
72
  if (isJoditObject(j)) {
72
- this.buttons?.forEach(btn => {
73
- j?.unregisterButton(btn);
73
+ (_a = this.buttons) === null || _a === void 0 ? void 0 : _a.forEach(btn => {
74
+ j === null || j === void 0 ? void 0 : j.unregisterButton(btn);
74
75
  });
75
76
  }
76
77
  this.beforeDestruct(this.j);
@@ -60,7 +60,7 @@ export class Ajax {
60
60
  this.__isFulfilled = true;
61
61
  this.xhr.abort();
62
62
  }
63
- catch { }
63
+ catch (_a) { }
64
64
  return this;
65
65
  }
66
66
  send() {
@@ -68,6 +68,7 @@ export class Ajax {
68
68
  const { xhr, o } = this;
69
69
  const request = this.prepareRequest();
70
70
  return this.__async.promise(async (resolve, reject) => {
71
+ var _a;
71
72
  const onReject = () => {
72
73
  this.__isFulfilled = true;
73
74
  reject(error.connection('Connection error'));
@@ -87,14 +88,16 @@ export class Ajax {
87
88
  xhr.responseType = o.responseType;
88
89
  }
89
90
  xhr.onprogress = (e) => {
91
+ var _a, _b;
90
92
  let percentComplete = 0;
91
93
  if (e.lengthComputable) {
92
94
  percentComplete = (e.loaded / e.total) * 100;
93
95
  }
94
- this.options.onProgress?.(percentComplete);
96
+ (_b = (_a = this.options).onProgress) === null || _b === void 0 ? void 0 : _b.call(_a, percentComplete);
95
97
  };
96
98
  xhr.onreadystatechange = () => {
97
- this.options.onProgress?.(10);
99
+ var _a, _b;
100
+ (_b = (_a = this.options).onProgress) === null || _b === void 0 ? void 0 : _b.call(_a, 10);
98
101
  if (xhr.readyState === XMLHttpRequest.DONE) {
99
102
  if (o.successStatuses.includes(xhr.status)) {
100
103
  onResolve();
@@ -105,7 +108,7 @@ export class Ajax {
105
108
  }
106
109
  }
107
110
  };
108
- xhr.withCredentials = o.withCredentials ?? false;
111
+ xhr.withCredentials = (_a = o.withCredentials) !== null && _a !== void 0 ? _a : false;
109
112
  const { url, data, method } = request;
110
113
  xhr.open(method, url, true);
111
114
  if (o.contentType && xhr.setRequestHeader) {
@@ -15,7 +15,8 @@ export * from "./move-the-node-along-the-edge-outward.js";
15
15
  * @private
16
16
  */
17
17
  export function cursorInTheEdgeOfString(container, offset, start, end) {
18
- const text = container.nodeValue?.length ? container.nodeValue : '';
18
+ var _a;
19
+ const text = ((_a = container.nodeValue) === null || _a === void 0 ? void 0 : _a.length) ? container.nodeValue : '';
19
20
  if (end && text.replace(INV_END(), '').length > offset) {
20
21
  return true;
21
22
  }
@@ -85,7 +85,7 @@ export class Selection {
85
85
  */
86
86
  get isInsideArea() {
87
87
  const { sel } = this;
88
- const range = sel?.rangeCount ? sel.getRangeAt(0) : null;
88
+ const range = (sel === null || sel === void 0 ? void 0 : sel.rangeCount) ? sel.getRangeAt(0) : null;
89
89
  return !(!range || !Dom.isOrContains(this.area, range.startContainer));
90
90
  }
91
91
  /**
@@ -115,8 +115,9 @@ export class Selection {
115
115
  * Clear all selection
116
116
  */
117
117
  clear() {
118
- if (this.sel?.rangeCount) {
119
- this.sel?.removeAllRanges();
118
+ var _a, _b;
119
+ if ((_a = this.sel) === null || _a === void 0 ? void 0 : _a.rangeCount) {
120
+ (_b = this.sel) === null || _b === void 0 ? void 0 : _b.removeAllRanges();
120
121
  }
121
122
  }
122
123
  /**
@@ -158,7 +159,7 @@ export class Selection {
158
159
  this.selectRange(rng);
159
160
  return true;
160
161
  }
161
- catch { }
162
+ catch (_a) { }
162
163
  return false;
163
164
  }
164
165
  /**
@@ -267,6 +268,7 @@ export class Selection {
267
268
  return result;
268
269
  }
269
270
  restoreFakes(fakes) {
271
+ var _a, _b, _c, _d;
270
272
  const nodes = fakes.filter(n => n.isConnected);
271
273
  if (!nodes.length) {
272
274
  return;
@@ -278,11 +280,11 @@ export class Selection {
278
280
  range.setEndBefore(fakeRight);
279
281
  }
280
282
  this.selectRange(range);
281
- if (fakeLeft.parentNode?.firstChild !== fakeLeft.parentNode?.lastChild) {
283
+ if (((_a = fakeLeft.parentNode) === null || _a === void 0 ? void 0 : _a.firstChild) !== ((_b = fakeLeft.parentNode) === null || _b === void 0 ? void 0 : _b.lastChild)) {
282
284
  Dom.safeRemove(fakeLeft);
283
285
  }
284
- if (fakeRight?.parentNode?.firstChild !==
285
- fakeRight?.parentNode?.lastChild) {
286
+ if (((_c = fakeRight === null || fakeRight === void 0 ? void 0 : fakeRight.parentNode) === null || _c === void 0 ? void 0 : _c.firstChild) !==
287
+ ((_d = fakeRight === null || fakeRight === void 0 ? void 0 : fakeRight.parentNode) === null || _d === void 0 ? void 0 : _d.lastChild)) {
286
288
  Dom.safeRemove(fakeRight);
287
289
  }
288
290
  }
@@ -344,7 +346,7 @@ export class Selection {
344
346
  try {
345
347
  sel.addRange(ranges[i].cloneRange());
346
348
  }
347
- catch { }
349
+ catch (_a) { }
348
350
  }
349
351
  }
350
352
  return info;
@@ -355,8 +357,9 @@ export class Selection {
355
357
  focus(options = {
356
358
  preventScroll: true
357
359
  }) {
360
+ var _a, _b;
358
361
  if (!this.isFocused()) {
359
- const scrollParent = getScrollParent(this.j.container), scrollTop = scrollParent?.scrollTop;
362
+ const scrollParent = getScrollParent(this.j.container), scrollTop = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.scrollTop;
360
363
  if (this.j.iframe) {
361
364
  if (this.doc.readyState === 'complete') {
362
365
  this.j.iframe.focus(options);
@@ -364,10 +367,10 @@ export class Selection {
364
367
  }
365
368
  this.win.focus();
366
369
  this.area.focus(options);
367
- if (scrollTop && scrollParent?.scrollTo) {
370
+ if (scrollTop && (scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.scrollTo)) {
368
371
  scrollParent.scrollTo(0, scrollTop);
369
372
  }
370
- const sel = this.sel, range = sel?.rangeCount ? sel?.getRangeAt(0) : null;
373
+ const sel = this.sel, range = (sel === null || sel === void 0 ? void 0 : sel.rangeCount) ? sel === null || sel === void 0 ? void 0 : sel.getRangeAt(0) : null;
371
374
  if (!range || !Dom.isOrContains(this.area, range.startContainer)) {
372
375
  const range = this.createRange();
373
376
  range.setStart(this.area, 0);
@@ -375,7 +378,7 @@ export class Selection {
375
378
  this.selectRange(range, false);
376
379
  }
377
380
  if (!this.j.editorIsActive) {
378
- this.j?.events?.fire('focus');
381
+ (_b = (_a = this.j) === null || _a === void 0 ? void 0 : _a.events) === null || _b === void 0 ? void 0 : _b.fire('focus');
379
382
  }
380
383
  return true;
381
384
  }
@@ -482,7 +485,7 @@ export class Selection {
482
485
  }
483
486
  }
484
487
  if (this.j.o.scrollToPastedContent) {
485
- scrollIntoViewIfNeeded(child ?? node, this.j.editor, this.doc);
488
+ scrollIntoViewIfNeeded(child !== null && child !== void 0 ? child : node, this.j.editor, this.doc);
486
489
  }
487
490
  });
488
491
  if (fireChange && this.j.events) {
@@ -591,6 +594,7 @@ export class Selection {
591
594
  */
592
595
  // eslint-disable-next-line complexity
593
596
  eachSelection(callback) {
597
+ var _a;
594
598
  const sel = this.sel;
595
599
  if (!sel || !sel.rangeCount) {
596
600
  return;
@@ -612,7 +616,7 @@ export class Selection {
612
616
  : range.endContainer;
613
617
  if (Dom.isText(start) &&
614
618
  start === range.startContainer &&
615
- range.startOffset === start.nodeValue?.length &&
619
+ range.startOffset === ((_a = start.nodeValue) === null || _a === void 0 ? void 0 : _a.length) &&
616
620
  start.nextSibling) {
617
621
  start = start.nextSibling;
618
622
  }
@@ -678,8 +682,9 @@ export class Selection {
678
682
  * @returns true - the cursor is at the end(start) block, null - cursor somewhere outside
679
683
  */
680
684
  cursorInTheEdge(start, parentBlock, fake = null) {
681
- const end = !start, range = this.sel?.getRangeAt(0);
682
- fake ?? (fake = this.current(false));
685
+ var _a;
686
+ const end = !start, range = (_a = this.sel) === null || _a === void 0 ? void 0 : _a.getRangeAt(0);
687
+ fake !== null && fake !== void 0 ? fake : (fake = this.current(false));
683
688
  if (!range || !fake || !Dom.isOrContains(parentBlock, fake, true)) {
684
689
  return null;
685
690
  }
@@ -754,6 +759,7 @@ export class Selection {
754
759
  * Add fake node for new cursor position
755
760
  */
756
761
  setCursorNearWith(node, inStart) {
762
+ var _a, _b;
757
763
  this.errorNode(node);
758
764
  if (!Dom.up(node, (elm) => elm === this.area || (elm && elm.parentNode === this.area), this.area)) {
759
765
  throw error('Node element must be in editor');
@@ -772,7 +778,7 @@ export class Selection {
772
778
  range.setStart(node, 0);
773
779
  }
774
780
  else {
775
- range.setEnd(node, node.nodeValue?.length ?? 0);
781
+ range.setEnd(node, (_b = (_a = node.nodeValue) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0);
776
782
  }
777
783
  }
778
784
  range.collapse(inStart);
@@ -1031,7 +1037,7 @@ export class Selection {
1031
1037
  clearEmpties(fragment);
1032
1038
  clearEmpties(currentBox);
1033
1039
  currentBox.parentNode.insertBefore(fragment, currentBox);
1034
- if (!edge && cursorOnTheRight && br?.parentNode) {
1040
+ if (!edge && cursorOnTheRight && (br === null || br === void 0 ? void 0 : br.parentNode)) {
1035
1041
  const range = this.createRange();
1036
1042
  range.setStartBefore(br);
1037
1043
  this.selectRange(range);
@@ -1044,8 +1050,9 @@ export class Selection {
1044
1050
  }
1045
1051
  // After splitting some part can be empty
1046
1052
  const fillFakeParent = (fake) => {
1047
- if (fake?.parentNode?.firstChild === fake?.parentNode?.lastChild) {
1048
- fake?.parentNode?.appendChild(br.cloneNode());
1053
+ var _a, _b, _c;
1054
+ if (((_a = fake === null || fake === void 0 ? void 0 : fake.parentNode) === null || _a === void 0 ? void 0 : _a.firstChild) === ((_b = fake === null || fake === void 0 ? void 0 : fake.parentNode) === null || _b === void 0 ? void 0 : _b.lastChild)) {
1055
+ (_c = fake === null || fake === void 0 ? void 0 : fake.parentNode) === null || _c === void 0 ? void 0 : _c.appendChild(br.cloneNode());
1049
1056
  }
1050
1057
  };
1051
1058
  fillFakeParent(prevFake);
@@ -13,6 +13,7 @@ import { isNormalNode } from "./is-normal-node.js";
13
13
  * @private
14
14
  */
15
15
  export function isSuitElement(commitStyle, elm, strict, strictStyle = true) {
16
+ var _a;
16
17
  if (!elm || !isNormalNode(elm)) {
17
18
  return false;
18
19
  }
@@ -24,7 +25,7 @@ export function isSuitElement(commitStyle, elm, strict, strictStyle = true) {
24
25
  if (elmIsSame && !(elementIsDefault && strict)) {
25
26
  return true;
26
27
  }
27
- const elmHasSameStyle = Boolean(options.attributes?.style &&
28
+ const elmHasSameStyle = Boolean(((_a = options.attributes) === null || _a === void 0 ? void 0 : _a.style) &&
28
29
  (strictStyle
29
30
  ? hasSameStyle(elm, options.attributes.style)
30
31
  : hasSameStyleKeys(elm, options.attributes.style)));
@@ -50,12 +51,13 @@ export function suitableClosest(commitStyle, element, root) {
50
51
  * @private
51
52
  */
52
53
  export function isSameStyleChild(commitStyle, elm) {
54
+ var _a, _b;
53
55
  const { element, options } = commitStyle;
54
56
  if (!elm || !isNormalNode(elm)) {
55
57
  return false;
56
58
  }
57
59
  const elmIsSame = elm.nodeName.toLowerCase() === element;
58
- const elmHasSameStyle = Boolean(options.attributes?.style &&
59
- hasSameStyleKeys(elm, options.attributes?.style));
60
+ const elmHasSameStyle = Boolean(((_a = options.attributes) === null || _a === void 0 ? void 0 : _a.style) &&
61
+ hasSameStyleKeys(elm, (_b = options.attributes) === null || _b === void 0 ? void 0 : _b.style));
60
62
  return elmIsSame && elmHasSameStyle;
61
63
  }
@@ -13,11 +13,11 @@ import { _PREFIX, INITIAL, REPLACE, WRAP } from "../../constants.js";
13
13
  */
14
14
  export function wrapList(commitStyle, wrapper, jodit) {
15
15
  const result = jodit.e.fire(`${_PREFIX}BeforeWrapList`, REPLACE, wrapper, commitStyle);
16
- const newWrapper = result ?? Dom.replace(wrapper, 'li', jodit.createInside);
16
+ const newWrapper = result !== null && result !== void 0 ? result : Dom.replace(wrapper, 'li', jodit.createInside);
17
17
  const prev = newWrapper.previousElementSibling;
18
18
  const next = newWrapper.nextElementSibling;
19
19
  let list = Dom.isTag(prev, commitStyle.element) ? prev : null;
20
- list ?? (list = Dom.isTag(next, commitStyle.element) ? next : null);
20
+ list !== null && list !== void 0 ? list : (list = Dom.isTag(next, commitStyle.element) ? next : null);
21
21
  if (!Dom.isList(list) ||
22
22
  !isSameAttributes(list, commitStyle.options.attributes)) {
23
23
  list = jodit.createInside.element(commitStyle.element);
@@ -126,6 +126,7 @@ function removeExtraStyleAttribute(commitStyle, elm, mode) {
126
126
  * Creates an iframe into which elements will be inserted to test their default styles in the browser
127
127
  */
128
128
  function getShadowRoot(jodit) {
129
+ var _a;
129
130
  if (dataBind(jodit, 'shadowRoot') !== undefined) {
130
131
  return dataBind(jodit, 'shadowRoot');
131
132
  }
@@ -139,7 +140,7 @@ function getShadowRoot(jodit) {
139
140
  });
140
141
  iframe.src = 'about:blank';
141
142
  container.appendChild(iframe);
142
- const doc = iframe.contentWindow?.document;
143
+ const doc = (_a = iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.document;
143
144
  const shadowRoot = !doc ? jodit.od.body : doc.body;
144
145
  dataBind(jodit, 'shadowRoot', shadowRoot);
145
146
  return shadowRoot;
@@ -12,10 +12,11 @@ import { isSameStyleChild, isSuitElement } from "./is-suit-element.js";
12
12
  * @private
13
13
  */
14
14
  export function unwrapChildren(style, font) {
15
+ var _a;
15
16
  const needUnwrap = [];
16
17
  const needChangeStyle = [];
17
18
  let firstElementSuit;
18
- const cssStyle = style.options.attributes?.style;
19
+ const cssStyle = (_a = style.options.attributes) === null || _a === void 0 ? void 0 : _a.style;
19
20
  if (font.firstChild) {
20
21
  const gen = Dom.eachGen(font);
21
22
  let item = gen.next();
@@ -8,9 +8,10 @@ import { INITIAL } from "./constants.js";
8
8
  import { states, transactions } from "./transactions.js";
9
9
  /** @internal */
10
10
  export function ApplyStyle(jodit, cs) {
11
+ var _a;
11
12
  const { s: sel, editor } = jodit;
12
13
  // sel.save();
13
- editor.firstChild?.normalize(); // FF fix for test "commandsTest - Exec command "bold"
14
+ (_a = editor.firstChild) === null || _a === void 0 ? void 0 : _a.normalize(); // FF fix for test "commandsTest - Exec command "bold"
14
15
  const fakes = sel.fakes();
15
16
  const gen = jodit.s.wrapInTagGen(fakes);
16
17
  let font = gen.next();
@@ -16,7 +16,8 @@ export class CommitStyle {
16
16
  return data[key];
17
17
  }
18
18
  setApplied(elm, key) {
19
- const data = this.__applyMap.get(elm) ?? {};
19
+ var _a;
20
+ const data = (_a = this.__applyMap.get(elm)) !== null && _a !== void 0 ? _a : {};
20
21
  data[key] = true;
21
22
  this.__applyMap.set(elm, data);
22
23
  }
@@ -15,7 +15,7 @@ export const canUsePersistentStorage = (() => {
15
15
  localStorage.removeItem(tmpKey);
16
16
  return result;
17
17
  }
18
- catch { }
18
+ catch (_a) { }
19
19
  return false;
20
20
  };
21
21
  let result;
@@ -37,14 +37,14 @@ export class LocalStorageProvider {
37
37
  json[key] = value;
38
38
  localStorage.setItem(this.rootKey, JSON.stringify(json));
39
39
  }
40
- catch { }
40
+ catch (_a) { }
41
41
  return this;
42
42
  }
43
43
  delete(key) {
44
44
  try {
45
45
  localStorage.removeItem(this.rootKey);
46
46
  }
47
- catch { }
47
+ catch (_a) { }
48
48
  return this;
49
49
  }
50
50
  get(key) {
@@ -53,7 +53,7 @@ export class LocalStorageProvider {
53
53
  const json = buffer ? JSON.parse(buffer) : {};
54
54
  return json[key] !== undefined ? json[key] : null;
55
55
  }
56
- catch { }
56
+ catch (_a) { }
57
57
  }
58
58
  exists(key) {
59
59
  return this.get(key) != null;
@@ -65,7 +65,7 @@ export class LocalStorageProvider {
65
65
  try {
66
66
  localStorage.removeItem(this.rootKey);
67
67
  }
68
- catch { }
68
+ catch (_a) { }
69
69
  return this;
70
70
  }
71
71
  }
@@ -32,6 +32,7 @@ export class Mods {
32
32
  * Get BEM class modification value
33
33
  */
34
34
  getMod(name) {
35
- return this.mods[name] ?? null;
35
+ var _a;
36
+ return (_a = this.mods[name]) !== null && _a !== void 0 ? _a : null;
36
37
  }
37
38
  }
@@ -38,7 +38,8 @@ let UIButtonGroup = class UIButtonGroup extends UIGroup {
38
38
  constructor(jodit, options = {
39
39
  radio: true
40
40
  }) {
41
- super(jodit, options.options?.map(opt => {
41
+ var _a, _b;
42
+ super(jodit, (_a = options.options) === null || _a === void 0 ? void 0 : _a.map(opt => {
42
43
  const btn = new UIButton(jodit, {
43
44
  text: opt.text,
44
45
  value: opt.value,
@@ -50,9 +51,10 @@ let UIButtonGroup = class UIButtonGroup extends UIGroup {
50
51
  return btn;
51
52
  }), options);
52
53
  this.options = options;
53
- this.select(options.value ?? 0);
54
+ this.select((_b = options.value) !== null && _b !== void 0 ? _b : 0);
54
55
  }
55
56
  select(indexOrValue) {
57
+ var _a, _b;
56
58
  this.elements.forEach((elm, index) => {
57
59
  if (index === indexOrValue || elm.state.value === indexOrValue) {
58
60
  elm.state.activated = true;
@@ -68,7 +70,7 @@ let UIButtonGroup = class UIButtonGroup extends UIGroup {
68
70
  value: elm.state.value
69
71
  }));
70
72
  this.jodit.e.fire(this, 'select', result);
71
- this.options.onChange?.(result);
73
+ (_b = (_a = this.options).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, result);
72
74
  }
73
75
  };
74
76
  UIButtonGroup = __decorate([
@@ -41,7 +41,8 @@ let UIElement = UIElement_1 = class UIElement extends ViewComponent {
41
41
  return this;
42
42
  }
43
43
  updateParentElement(target) {
44
- this.__parentElement?.updateParentElement(target);
44
+ var _a;
45
+ (_a = this.__parentElement) === null || _a === void 0 ? void 0 : _a.updateParentElement(target);
45
46
  return this;
46
47
  }
47
48
  /** @override */
@@ -80,7 +81,7 @@ let UIElement = UIElement_1 = class UIElement extends ViewComponent {
80
81
  }
81
82
  return false;
82
83
  });
83
- return elm ? elm?.component : null;
84
+ return elm ? elm === null || elm === void 0 ? void 0 : elm.component : null;
84
85
  }
85
86
  /**
86
87
  * Update UI from state
@@ -65,9 +65,10 @@ let UIForm = class UIForm extends UIGroup {
65
65
  return form;
66
66
  }
67
67
  constructor(...args) {
68
+ var _a, _b;
68
69
  super(...args);
69
- if (this.options?.className) {
70
- this.container.classList.add(this.options?.className);
70
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.className) {
71
+ this.container.classList.add((_b = this.options) === null || _b === void 0 ? void 0 : _b.className);
71
72
  }
72
73
  }
73
74
  };
@@ -37,7 +37,7 @@ let UITextArea = UITextArea_1 = class UITextArea extends UIInput {
37
37
  onChangeStateSize() {
38
38
  const { size, resizable } = this.state;
39
39
  this.nativeInput.style.resize = resizable ? 'auto' : 'none';
40
- this.nativeInput.rows = size ?? 5;
40
+ this.nativeInput.rows = size !== null && size !== void 0 ? size : 5;
41
41
  }
42
42
  };
43
43
  /** @override */
@@ -66,11 +66,12 @@ let UIInput = UIInput_1 = class UIInput extends UIElement {
66
66
  this.updateValidators();
67
67
  }
68
68
  updateValidators() {
69
+ var _a;
69
70
  this.validators.clear();
70
71
  if (this.state.required) {
71
72
  this.validators.add(inputValidators.required);
72
73
  }
73
- this.state.validators?.forEach(name => {
74
+ (_a = this.state.validators) === null || _a === void 0 ? void 0 : _a.forEach(name => {
74
75
  const validator = inputValidators[name];
75
76
  validator && this.validators.add(validator);
76
77
  });
@@ -107,11 +108,12 @@ let UIInput = UIInput_1 = class UIInput extends UIElement {
107
108
  * Call on every native value changed
108
109
  */
109
110
  onChangeValue() {
111
+ var _a, _b;
110
112
  const { value } = this;
111
113
  if (this.state.value !== value) {
112
114
  this.state.value = value;
113
115
  this.j.e.fire(this, 'change', value);
114
- this.state.onChange?.(value);
116
+ (_b = (_a = this.state).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, value);
115
117
  }
116
118
  }
117
119
  validate() {
@@ -121,13 +123,14 @@ let UIInput = UIInput_1 = class UIInput extends UIElement {
121
123
  return validate;
122
124
  }
123
125
  __markInputInvalid() {
126
+ var _a, _b, _c, _d;
124
127
  if (this.error) {
125
128
  this.nativeInput.setAttribute('aria-invalid', 'true');
126
- this.nativeInput.setCustomValidity?.(this.error);
129
+ (_b = (_a = this.nativeInput).setCustomValidity) === null || _b === void 0 ? void 0 : _b.call(_a, this.error);
127
130
  }
128
131
  else {
129
132
  this.nativeInput.removeAttribute('aria-invalid');
130
- this.nativeInput.setCustomValidity?.('');
133
+ (_d = (_c = this.nativeInput).setCustomValidity) === null || _d === void 0 ? void 0 : _d.call(_c, '');
131
134
  }
132
135
  }
133
136
  /** @override **/
@@ -159,7 +162,7 @@ let UIInput = UIInput_1 = class UIInput extends UIElement {
159
162
  this.state = { ...UIInput_1.defaultState };
160
163
  this.__errorBox = this.j.c.span(this.getFullElName('error'));
161
164
  this.validators = new Set([]);
162
- if (options?.value !== undefined) {
165
+ if ((options === null || options === void 0 ? void 0 : options.value) !== undefined) {
163
166
  options.value = options.value.toString();
164
167
  }
165
168
  Object.assign(this.state, options);
@@ -25,6 +25,7 @@ let UISelect = UISelect_1 = class UISelect extends UIInput {
25
25
  }
26
26
  /** @override **/
27
27
  createContainer(state) {
28
+ var _a;
28
29
  const container = super.createContainer(state);
29
30
  const { j } = this, { nativeInput } = this;
30
31
  const opt = () => j.create.element('option');
@@ -34,7 +35,7 @@ let UISelect = UISelect_1 = class UISelect extends UIInput {
34
35
  option.text = j.i18n(state.placeholder);
35
36
  nativeInput.add(option);
36
37
  }
37
- state.options?.forEach(element => {
38
+ (_a = state.options) === null || _a === void 0 ? void 0 : _a.forEach(element => {
38
39
  const option = opt();
39
40
  option.value = element.value.toString();
40
41
  option.text = j.i18n(element.text);
@@ -120,8 +120,8 @@ let UIGroup = UIGroup_1 = class UIGroup extends UIElement {
120
120
  this.syncMod = false;
121
121
  this.elements = [];
122
122
  this.buttonSize = 'middle';
123
- elements?.forEach(elm => elm && this.append(elm));
124
- if (options?.name) {
123
+ elements === null || elements === void 0 ? void 0 : elements.forEach(elm => elm && this.append(elm));
124
+ if (options === null || options === void 0 ? void 0 : options.name) {
125
125
  this.name = options.name;
126
126
  }
127
127
  }
@@ -112,8 +112,11 @@ let UIList = class UIList extends UIGroup {
112
112
  group.append(elm);
113
113
  }
114
114
  };
115
- const isNotRemoved = (b) => !this.removeButtons.includes(b.name) &&
116
- (!b.isVisible || b.isVisible?.(this.j, b));
115
+ const isNotRemoved = (b) => {
116
+ var _a;
117
+ return !this.removeButtons.includes(b.name) &&
118
+ (!b.isVisible || ((_a = b.isVisible) === null || _a === void 0 ? void 0 : _a.call(b, this.j, b)));
119
+ };
117
120
  items.forEach(item => {
118
121
  if (isButtonGroup(item)) {
119
122
  const buttons = item.buttons.filter(b => b);
@@ -16,10 +16,11 @@ export const isButtonGroup = (item) => {
16
16
  export function flatButtonsSet(buttons, jodit) {
17
17
  const groups = jodit.getRegisteredButtonGroups();
18
18
  return new Set(buttons.reduce((acc, item) => {
19
+ var _a;
19
20
  if (isButtonGroup(item)) {
20
21
  acc = acc.concat([
21
22
  ...item.buttons,
22
- ...(groups[item.group] ?? [])
23
+ ...((_a = groups[item.group]) !== null && _a !== void 0 ? _a : [])
23
24
  ]);
24
25
  }
25
26
  else {
@@ -45,6 +45,7 @@ export class Icon {
45
45
  * Make icon html element
46
46
  */
47
47
  static makeIcon(jodit, icon) {
48
+ var _a, _b, _c, _d;
48
49
  if (!icon) {
49
50
  return;
50
51
  }
@@ -53,22 +54,22 @@ export class Icon {
53
54
  const clearName = name.replace(/[^a-zA-Z0-9]/g, '_');
54
55
  let iconFromEvent;
55
56
  if (!/<svg/.test(name)) {
56
- iconFromEvent = jodit.o.getIcon?.(name, clearName);
57
+ iconFromEvent = (_b = (_a = jodit.o).getIcon) === null || _b === void 0 ? void 0 : _b.call(_a, name, clearName);
57
58
  }
58
- const cacheKey = `${name}${iconURL}${fill}${iconFromEvent ?? ''}`;
59
+ const cacheKey = `${name}${iconURL}${fill}${iconFromEvent !== null && iconFromEvent !== void 0 ? iconFromEvent : ''}`;
59
60
  if (jodit.o.cache && this.__cache.has(cacheKey)) {
60
- return this.__cache.get(cacheKey)?.cloneNode(true);
61
+ return (_c = this.__cache.get(cacheKey)) === null || _c === void 0 ? void 0 : _c.cloneNode(true);
61
62
  }
62
63
  if (iconURL) {
63
64
  iconElement = jodit.c.span();
64
65
  css(iconElement, 'backgroundImage', 'url(' +
65
- iconURL.replace('{basePath}', jodit?.basePath || '') +
66
+ iconURL.replace('{basePath}', (jodit === null || jodit === void 0 ? void 0 : jodit.basePath) || '') +
66
67
  ')');
67
68
  }
68
69
  else {
69
70
  const svg = iconFromEvent ||
70
71
  Icon.get(name, '') ||
71
- jodit.o.extraIcons?.[name];
72
+ ((_d = jodit.o.extraIcons) === null || _d === void 0 ? void 0 : _d[name]);
72
73
  if (svg) {
73
74
  iconElement = jodit.c.fromHTML(svg.trim());
74
75
  if (!/^<svg/i.test(name)) {