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
@@ -43,15 +43,18 @@ export class source extends Plugin {
43
43
  this.tempMarkerEndReg = /{end-jodit-selection}/g;
44
44
  // override it for ace editors
45
45
  this.getSelectionStart = () => {
46
- return this.sourceEditor?.getSelectionStart() ?? 0;
46
+ var _a, _b;
47
+ return (_b = (_a = this.sourceEditor) === null || _a === void 0 ? void 0 : _a.getSelectionStart()) !== null && _b !== void 0 ? _b : 0;
47
48
  };
48
49
  this.getSelectionEnd = () => {
49
- return this.sourceEditor?.getSelectionEnd() ?? 0;
50
+ var _a, _b;
51
+ return (_b = (_a = this.sourceEditor) === null || _a === void 0 ? void 0 : _a.getSelectionEnd()) !== null && _b !== void 0 ? _b : 0;
50
52
  };
51
53
  }
52
54
  onInsertHTML(html) {
55
+ var _a;
53
56
  if (!this.j.o.readonly && !this.j.isEditorMode()) {
54
- this.sourceEditor?.insertRaw(html);
57
+ (_a = this.sourceEditor) === null || _a === void 0 ? void 0 : _a.insertRaw(html);
55
58
  this.toWYSIWYG();
56
59
  return false;
57
60
  }
@@ -114,20 +117,24 @@ export class source extends Plugin {
114
117
  return str.replace(consts.INVISIBLE_SPACE_REG_EXP(), '');
115
118
  }
116
119
  onSelectAll(command) {
120
+ var _a;
117
121
  if (command.toLowerCase() === 'selectall' &&
118
122
  this.j.getRealMode() === MODE_SOURCE) {
119
- this.sourceEditor?.selectAll();
123
+ (_a = this.sourceEditor) === null || _a === void 0 ? void 0 : _a.selectAll();
120
124
  return false;
121
125
  }
122
126
  }
123
127
  getMirrorValue() {
124
- return this.sourceEditor?.getValue() || '';
128
+ var _a;
129
+ return ((_a = this.sourceEditor) === null || _a === void 0 ? void 0 : _a.getValue()) || '';
125
130
  }
126
131
  setMirrorValue(value) {
127
- this.sourceEditor?.setValue(value);
132
+ var _a;
133
+ (_a = this.sourceEditor) === null || _a === void 0 ? void 0 : _a.setValue(value);
128
134
  }
129
135
  setFocusToMirror() {
130
- this.sourceEditor?.focus();
136
+ var _a;
137
+ (_a = this.sourceEditor) === null || _a === void 0 ? void 0 : _a.focus();
131
138
  }
132
139
  saveSelection() {
133
140
  if (this.j.getRealMode() === consts.MODE_WYSIWYG) {
@@ -202,10 +209,12 @@ export class source extends Plugin {
202
209
  this.setFocusToMirror(); // need for setting focus after change mode
203
210
  }
204
211
  setMirrorSelectionRange(start, end) {
205
- this.sourceEditor?.setSelectionRange(start, end);
212
+ var _a;
213
+ (_a = this.sourceEditor) === null || _a === void 0 ? void 0 : _a.setSelectionRange(start, end);
206
214
  }
207
215
  onReadonlyReact() {
208
- this.sourceEditor?.setReadOnly(this.j.o.readonly);
216
+ var _a;
217
+ (_a = this.sourceEditor) === null || _a === void 0 ? void 0 : _a.setReadOnly(this.j.o.readonly);
209
218
  }
210
219
  /** @override */
211
220
  afterInit(editor) {
@@ -216,27 +225,28 @@ export class source extends Plugin {
216
225
  });
217
226
  this.sourceEditor = createSourceEditor('area', editor, this.mirrorContainer, this.toWYSIWYG, this.fromWYSIWYG);
218
227
  editor.e.on(editor.ow, 'keydown', (e) => {
219
- if (e.key === KEY_ESC && this.sourceEditor?.isFocused) {
228
+ var _a;
229
+ if (e.key === KEY_ESC && ((_a = this.sourceEditor) === null || _a === void 0 ? void 0 : _a.isFocused)) {
220
230
  this.sourceEditor.blur();
221
231
  }
222
232
  });
223
233
  this.onReadonlyReact();
224
234
  editor.e
225
235
  .on('placeholder.source', (text) => {
226
- this.sourceEditor?.setPlaceHolder(text);
236
+ var _a;
237
+ (_a = this.sourceEditor) === null || _a === void 0 ? void 0 : _a.setPlaceHolder(text);
227
238
  })
228
239
  .on('change.source', this.syncValueFromWYSIWYG)
229
240
  .on('beautifyHTML', html => html);
230
241
  if (editor.o.beautifyHTML) {
231
242
  const addEventListener = () => {
243
+ var _a;
232
244
  if (editor.isInDestruct) {
233
245
  return false;
234
246
  }
235
247
  const html_beautify = editor.ow.html_beautify;
236
248
  if (html_beautify && !editor.isInDestruct) {
237
- editor.events
238
- ?.off('beautifyHTML')
239
- .on('beautifyHTML', html => html_beautify(html));
249
+ (_a = editor.events) === null || _a === void 0 ? void 0 : _a.off('beautifyHTML').on('beautifyHTML', html => html_beautify(html));
240
250
  return true;
241
251
  }
242
252
  return false;
@@ -256,19 +266,22 @@ export class source extends Plugin {
256
266
  }
257
267
  }
258
268
  initSourceEditor(editor) {
269
+ var _a;
259
270
  if (editor.o.sourceEditor !== 'area') {
260
271
  const sourceEditor = createSourceEditor(editor.o.sourceEditor, editor, this.mirrorContainer, this.toWYSIWYG, this.fromWYSIWYG);
261
272
  sourceEditor.onReadyAlways(() => {
262
- this.sourceEditor?.destruct();
273
+ var _a, _b;
274
+ (_a = this.sourceEditor) === null || _a === void 0 ? void 0 : _a.destruct();
263
275
  this.sourceEditor = sourceEditor;
264
276
  this.syncValueFromWYSIWYG(true);
265
- editor.events?.fire('sourceEditorReady', editor);
277
+ (_b = editor.events) === null || _b === void 0 ? void 0 : _b.fire('sourceEditorReady', editor);
266
278
  });
267
279
  }
268
280
  else {
269
- this.sourceEditor?.onReadyAlways(() => {
281
+ (_a = this.sourceEditor) === null || _a === void 0 ? void 0 : _a.onReadyAlways(() => {
282
+ var _a;
270
283
  this.syncValueFromWYSIWYG(true);
271
- editor.events?.fire('sourceEditorReady', editor);
284
+ (_a = editor.events) === null || _a === void 0 ? void 0 : _a.fire('sourceEditorReady', editor);
272
285
  });
273
286
  }
274
287
  }
@@ -38,12 +38,13 @@ Config.prototype.controls.speechRecognize = {
38
38
  },
39
39
  isActive(jodit, _) {
40
40
  const api = dataBind(jodit, 'speech');
41
- return Boolean(api?.isEnabled);
41
+ return Boolean(api === null || api === void 0 ? void 0 : api.isEnabled);
42
42
  },
43
43
  isDisabled(jodit) {
44
44
  return !jodit.o.speechRecognize.api;
45
45
  },
46
46
  exec(jodit, current, { button, control }) {
47
+ var _a;
47
48
  const { api: ApiConstructor, lang, continuous, interimResults, sound } = jodit.o.speechRecognize;
48
49
  if (!ApiConstructor) {
49
50
  jodit.alert('Speech recognize API unsupported in your browser');
@@ -55,7 +56,7 @@ Config.prototype.controls.speechRecognize = {
55
56
  api = new RecognizeManager(jodit.async, nativeApi);
56
57
  api.lang = isString(lang)
57
58
  ? lang
58
- : (attr(jodit.od.documentElement, 'lang') ?? undefined);
59
+ : ((_a = attr(jodit.od.documentElement, 'lang')) !== null && _a !== void 0 ? _a : undefined);
59
60
  api.continuous = continuous;
60
61
  api.interimResults = interimResults;
61
62
  api.sound = sound;
@@ -95,7 +96,8 @@ Config.prototype.controls.speechRecognize = {
95
96
  interimResults: 'Interim Results'
96
97
  },
97
98
  childTemplate(jodit, key, value) {
98
- const api = dataBind(jodit, 'speech'), checked = api?.[key] ?? jodit.o.speechRecognize[key];
99
+ var _a;
100
+ const api = dataBind(jodit, 'speech'), checked = (_a = api === null || api === void 0 ? void 0 : api[key]) !== null && _a !== void 0 ? _a : jodit.o.speechRecognize[key];
99
101
  return `<span class='jodit-speech-recognize__list-item'><input ${checked ? 'checked' : ''} class='jodit-checkbox' type='checkbox'>&nbsp;${value}</span>`;
100
102
  },
101
103
  mods: {
@@ -64,7 +64,7 @@ export class symbols extends Plugin {
64
64
  if (Dom.isTag(this, 'a')) {
65
65
  jodit.s.focus();
66
66
  jodit.s.insertHTML(this.innerHTML);
67
- if (!e?.shiftKey) {
67
+ if (!(e === null || e === void 0 ? void 0 : e.shiftKey)) {
68
68
  jodit.e.fire(this, 'close_dialog');
69
69
  }
70
70
  e && e.preventDefault();
@@ -58,10 +58,10 @@ Config.prototype.controls.video = {
58
58
  content: formCode.container
59
59
  });
60
60
  formLink.onSubmit(data => {
61
- insertCode(call(jodit.o.video?.parseUrlToVideoEmbed ??
62
- convertMediaUrlToVideoEmbed, data.url, {
63
- width: jodit.o.video?.defaultWidth,
64
- height: jodit.o.video?.defaultHeight
61
+ var _a, _b, _c, _d;
62
+ insertCode(call((_b = (_a = jodit.o.video) === null || _a === void 0 ? void 0 : _a.parseUrlToVideoEmbed) !== null && _b !== void 0 ? _b : convertMediaUrlToVideoEmbed, data.url, {
63
+ width: (_c = jodit.o.video) === null || _c === void 0 ? void 0 : _c.defaultWidth,
64
+ height: (_d = jodit.o.video) === null || _d === void 0 ? void 0 : _d.defaultHeight
65
65
  }));
66
66
  });
67
67
  formCode.onSubmit(data => {
@@ -28,12 +28,15 @@ class wrapNodes extends Plugin {
28
28
  /**
29
29
  * Found Node which should be wrapped
30
30
  */
31
- this.isSuitableStart = (n) => (Dom.isText(n) &&
32
- isString(n.nodeValue) &&
33
- (/[^\s]/.test(n.nodeValue) ||
34
- (n.parentNode?.firstChild === n &&
35
- this.isSuitable(n.nextSibling)))) ||
36
- (this.isNotWrapped(n) && !Dom.isTemporary(n));
31
+ this.isSuitableStart = (n) => {
32
+ var _a;
33
+ return (Dom.isText(n) &&
34
+ isString(n.nodeValue) &&
35
+ (/[^\s]/.test(n.nodeValue) ||
36
+ (((_a = n.parentNode) === null || _a === void 0 ? void 0 : _a.firstChild) === n &&
37
+ this.isSuitable(n.nextSibling)))) ||
38
+ (this.isNotWrapped(n) && !Dom.isTemporary(n));
39
+ };
37
40
  /**
38
41
  * Node should add in a block element
39
42
  */
@@ -61,7 +61,7 @@ class xpath extends Plugin {
61
61
  return false;
62
62
  }
63
63
  }
64
- catch { }
64
+ catch (_a) { }
65
65
  this.j.s.select(bindElement);
66
66
  return false;
67
67
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.5.3",
3
+ "version": "4.5.4",
4
4
  "description": "Jodit is an awesome and useful wysiwyg editor with filebrowser",
5
5
  "main": "esm/index.js",
6
6
  "types": "types/index.d.ts",