jodit 4.18.4 → 4.18.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 (194) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/es2015/jodit.css +13 -34
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +11 -11
  5. package/es2015/jodit.js +1029 -205
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +11 -11
  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 +11 -11
  16. package/es2018/jodit.min.css +1 -1
  17. package/es2018/jodit.min.js +11 -11
  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 +13 -34
  21. package/es2021/jodit.fat.min.css +1 -1
  22. package/es2021/jodit.fat.min.js +15 -15
  23. package/es2021/jodit.js +1021 -203
  24. package/es2021/jodit.min.css +1 -1
  25. package/es2021/jodit.min.js +15 -15
  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 +13 -34
  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 +995 -177
  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 +14 -41
  45. package/es5/jodit.fat.min.css +1 -1
  46. package/es5/jodit.fat.min.js +2 -2
  47. package/es5/jodit.js +1152 -254
  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 +3 -0
  60. package/esm/core/constants.js +1 -1
  61. package/esm/core/helpers/html/apply-styles.js +3 -0
  62. package/esm/core/helpers/html/clean-from-word.js +3 -0
  63. package/esm/core/helpers/html/strip-tags.js +24 -6
  64. package/esm/core/helpers/html/word-lists.d.ts +29 -0
  65. package/esm/core/helpers/html/word-lists.js +158 -0
  66. package/esm/core/selection/helpers/index.d.ts +1 -0
  67. package/esm/core/selection/helpers/index.js +1 -0
  68. package/esm/core/selection/helpers/is-moved.d.ts +15 -0
  69. package/esm/core/selection/helpers/is-moved.js +22 -0
  70. package/esm/core/selection/style/api/list/toggle-ordered-list.js +40 -3
  71. package/esm/core/selection/style/transactions.js +5 -2
  72. package/esm/langs/ar.d.ts +3 -0
  73. package/esm/langs/ar.js +4 -1
  74. package/esm/langs/az.d.ts +3 -0
  75. package/esm/langs/az.js +4 -1
  76. package/esm/langs/cs_cz.d.ts +3 -0
  77. package/esm/langs/cs_cz.js +4 -1
  78. package/esm/langs/de.d.ts +3 -0
  79. package/esm/langs/de.js +4 -1
  80. package/esm/langs/es.d.ts +3 -0
  81. package/esm/langs/es.js +4 -1
  82. package/esm/langs/fa.d.ts +3 -0
  83. package/esm/langs/fa.js +4 -1
  84. package/esm/langs/fi.d.ts +3 -0
  85. package/esm/langs/fi.js +4 -1
  86. package/esm/langs/fr.d.ts +3 -0
  87. package/esm/langs/fr.js +4 -1
  88. package/esm/langs/he.d.ts +3 -0
  89. package/esm/langs/he.js +4 -1
  90. package/esm/langs/hu.d.ts +3 -0
  91. package/esm/langs/hu.js +4 -1
  92. package/esm/langs/id.d.ts +3 -0
  93. package/esm/langs/id.js +4 -1
  94. package/esm/langs/it.d.ts +3 -0
  95. package/esm/langs/it.js +4 -1
  96. package/esm/langs/ja.d.ts +3 -0
  97. package/esm/langs/ja.js +4 -1
  98. package/esm/langs/ko.d.ts +3 -0
  99. package/esm/langs/ko.js +4 -1
  100. package/esm/langs/mn.d.ts +3 -0
  101. package/esm/langs/mn.js +4 -1
  102. package/esm/langs/nl.d.ts +3 -0
  103. package/esm/langs/nl.js +4 -1
  104. package/esm/langs/no.d.ts +3 -0
  105. package/esm/langs/no.js +4 -1
  106. package/esm/langs/pl.d.ts +3 -0
  107. package/esm/langs/pl.js +4 -1
  108. package/esm/langs/pt_br.d.ts +3 -0
  109. package/esm/langs/pt_br.js +4 -1
  110. package/esm/langs/ru.d.ts +3 -0
  111. package/esm/langs/ru.js +4 -1
  112. package/esm/langs/sk.d.ts +3 -0
  113. package/esm/langs/sk.js +4 -1
  114. package/esm/langs/sv.d.ts +3 -0
  115. package/esm/langs/sv.js +4 -1
  116. package/esm/langs/tr.d.ts +3 -0
  117. package/esm/langs/tr.js +4 -1
  118. package/esm/langs/ua.d.ts +3 -0
  119. package/esm/langs/ua.js +4 -1
  120. package/esm/langs/zh_cn.d.ts +3 -0
  121. package/esm/langs/zh_cn.js +4 -1
  122. package/esm/langs/zh_tw.d.ts +3 -0
  123. package/esm/langs/zh_tw.js +4 -1
  124. package/esm/modules/dialog/dialog.d.ts +7 -0
  125. package/esm/modules/dialog/dialog.js +24 -6
  126. package/esm/modules/table/table.d.ts +6 -0
  127. package/esm/modules/table/table.js +18 -26
  128. package/esm/plugins/backspace/cases/check-join-neighbors.js +90 -3
  129. package/esm/plugins/clean-html/clean-html.d.ts +8 -0
  130. package/esm/plugins/clean-html/clean-html.js +21 -1
  131. package/esm/plugins/clean-html/helpers/index.d.ts +1 -0
  132. package/esm/plugins/clean-html/helpers/index.js +1 -0
  133. package/esm/plugins/clean-html/helpers/remove-placeholder-br.d.ts +16 -0
  134. package/esm/plugins/clean-html/helpers/remove-placeholder-br.js +51 -0
  135. package/esm/plugins/delete/delete.d.ts +11 -1
  136. package/esm/plugins/delete/delete.js +92 -16
  137. package/esm/plugins/focus/focus.js +12 -1
  138. package/esm/plugins/iframe/config.d.ts +3 -0
  139. package/esm/plugins/iframe/config.js +0 -27
  140. package/esm/plugins/iframe/iframe.js +8 -1
  141. package/esm/plugins/image-processor/image-processor.js +6 -1
  142. package/esm/plugins/inline-popup/inline-popup.d.ts +19 -0
  143. package/esm/plugins/inline-popup/inline-popup.js +70 -1
  144. package/esm/plugins/ordered-list/config.js +13 -2
  145. package/esm/plugins/ordered-list/start-dialog.d.ts +19 -0
  146. package/esm/plugins/ordered-list/start-dialog.js +58 -0
  147. package/esm/plugins/placeholder/placeholder.js +7 -1
  148. package/esm/plugins/resizer/resizer.d.ts +10 -0
  149. package/esm/plugins/resizer/resizer.js +76 -2
  150. package/esm/plugins/select-cells/select-cells.d.ts +23 -0
  151. package/esm/plugins/select-cells/select-cells.js +75 -1
  152. package/esm/plugins/table-keyboard-navigation/table-keyboard-navigation.js +3 -2
  153. package/package.json +1 -1
  154. package/types/config.d.ts +3 -0
  155. package/types/core/helpers/html/word-lists.d.ts +29 -0
  156. package/types/core/selection/helpers/index.d.ts +1 -0
  157. package/types/core/selection/helpers/is-moved.d.ts +15 -0
  158. package/types/langs/ar.d.ts +3 -0
  159. package/types/langs/az.d.ts +3 -0
  160. package/types/langs/cs_cz.d.ts +3 -0
  161. package/types/langs/de.d.ts +3 -0
  162. package/types/langs/es.d.ts +3 -0
  163. package/types/langs/fa.d.ts +3 -0
  164. package/types/langs/fi.d.ts +3 -0
  165. package/types/langs/fr.d.ts +3 -0
  166. package/types/langs/he.d.ts +3 -0
  167. package/types/langs/hu.d.ts +3 -0
  168. package/types/langs/id.d.ts +3 -0
  169. package/types/langs/it.d.ts +3 -0
  170. package/types/langs/ja.d.ts +3 -0
  171. package/types/langs/ko.d.ts +3 -0
  172. package/types/langs/mn.d.ts +3 -0
  173. package/types/langs/nl.d.ts +3 -0
  174. package/types/langs/no.d.ts +3 -0
  175. package/types/langs/pl.d.ts +3 -0
  176. package/types/langs/pt_br.d.ts +3 -0
  177. package/types/langs/ru.d.ts +3 -0
  178. package/types/langs/sk.d.ts +3 -0
  179. package/types/langs/sv.d.ts +3 -0
  180. package/types/langs/tr.d.ts +3 -0
  181. package/types/langs/ua.d.ts +3 -0
  182. package/types/langs/zh_cn.d.ts +3 -0
  183. package/types/langs/zh_tw.d.ts +3 -0
  184. package/types/modules/dialog/dialog.d.ts +7 -0
  185. package/types/modules/table/table.d.ts +6 -0
  186. package/types/plugins/clean-html/clean-html.d.ts +8 -0
  187. package/types/plugins/clean-html/helpers/index.d.ts +1 -0
  188. package/types/plugins/clean-html/helpers/remove-placeholder-br.d.ts +16 -0
  189. package/types/plugins/delete/delete.d.ts +11 -1
  190. package/types/plugins/iframe/config.d.ts +3 -0
  191. package/types/plugins/inline-popup/inline-popup.d.ts +19 -0
  192. package/types/plugins/ordered-list/start-dialog.d.ts +19 -0
  193. package/types/plugins/resizer/resizer.d.ts +10 -0
  194. package/types/plugins/select-cells/select-cells.d.ts +23 -0
@@ -18,6 +18,7 @@ import { Dom } from "../../core/dom/index.js";
18
18
  import { pluginSystem } from "../../core/global.js";
19
19
  import { camelCase, getMediaWrapper, getWrappedMedia, isArray, isFunction, isString, keys, position, splitArray, toArray } from "../../core/helpers/index.js";
20
20
  import { Plugin } from "../../core/plugin/index.js";
21
+ import { isMoved } from "../../core/selection/helpers/index.js";
21
22
  import { UIElement } from "../../core/ui/index.js";
22
23
  import { Popup } from "../../core/ui/popup/index.js";
23
24
  import { makeCollection } from "../../modules/toolbar/factory.js";
@@ -35,7 +36,14 @@ export class inlinePopup extends Plugin {
35
36
  * while the selection is still there. See #1238
36
37
  */
37
38
  this.__reopenSelectionPopup = false;
39
+ /**
40
+ * The alignment controls fire `recalcPositionPopup` once they have moved
41
+ * the element, and their button then fires `closeAllPopups`. The popup
42
+ * opens again beside the element, as the selection toolbar does
43
+ */
44
+ this.__reopenFor = null;
38
45
  this.snapRange = null;
46
+ this.__keyDownElement = null;
39
47
  this.elmsList = keys(this.j.o.popup, false).filter(s => !this.isExcludedTarget(s));
40
48
  }
41
49
  get popup() {
@@ -129,6 +137,38 @@ export class inlinePopup extends Plugin {
129
137
  onOutsideClick() {
130
138
  this.popup.close();
131
139
  }
140
+ /**
141
+ * A key that moves the caret off an element closes its popup, and one
142
+ * that moves the caret into an element with a popup (a link) opens it,
143
+ * as clicks do
144
+ */
145
+ onKeyUp() {
146
+ this.__followCaret();
147
+ }
148
+ __followCaret() {
149
+ if (!isMoved(this.j, this.snapRange)) {
150
+ return;
151
+ }
152
+ const { range } = this.j.s;
153
+ const target = this.previousTarget;
154
+ if (this.popup.isOpened &&
155
+ this.type !== 'selection' &&
156
+ target &&
157
+ !range.intersectsNode(target)) {
158
+ this.popup.close();
159
+ }
160
+ const node = range.startContainer;
161
+ const element = this.__elementAt(node);
162
+ if (range.collapsed && element && element !== this.__keyDownElement) {
163
+ this.onClick(node);
164
+ }
165
+ }
166
+ /**
167
+ * The element with a popup that holds `node`
168
+ */
169
+ __elementAt(node) {
170
+ return Dom.closest(node, this.elmsList, this.j.editor);
171
+ }
132
172
  /**
133
173
  * Can show popup for this type
134
174
  */
@@ -183,7 +223,15 @@ export class inlinePopup extends Plugin {
183
223
  .on('closeAllPopups', this.__onCloseAllPopups);
184
224
  this.addListenersForElements();
185
225
  }
226
+ onRecalcPositionPopup() {
227
+ if (this.popup.isOpened &&
228
+ this.type !== 'selection' &&
229
+ this.previousTarget) {
230
+ this.__reopenFor = this.previousTarget;
231
+ }
232
+ }
186
233
  __onDocumentMouseDown(e) {
234
+ this.__reopenFor = null;
187
235
  if (this.popup.isOpened &&
188
236
  this.type === 'selection' &&
189
237
  e.target &&
@@ -192,6 +240,16 @@ export class inlinePopup extends Plugin {
192
240
  }
193
241
  }
194
242
  __onCloseAllPopups() {
243
+ const target = this.__reopenFor;
244
+ if (target) {
245
+ this.__reopenFor = null;
246
+ // After the popup's own `closeAllPopups` handler, as below
247
+ this.j.async.setTimeout(() => {
248
+ if (this.j.editor.contains(target)) {
249
+ this.onClick(target);
250
+ }
251
+ }, 1);
252
+ }
195
253
  if (!this.__reopenSelectionPopup) {
196
254
  return;
197
255
  }
@@ -224,8 +282,13 @@ export class inlinePopup extends Plugin {
224
282
  }
225
283
  return { left, top, width: rect.width, height: rect.height };
226
284
  }
227
- onSelectionStart() {
285
+ onSelectionStart(event) {
286
+ // A key held down moves the caret on every repeat, with one keyup
287
+ if (event === null || event === void 0 ? void 0 : event.repeat) {
288
+ this.__followCaret();
289
+ }
228
290
  this.snapRange = this.j.s.range.cloneRange();
291
+ this.__keyDownElement = this.__elementAt(this.snapRange.startContainer);
229
292
  }
230
293
  onSelectionEnd(e) {
231
294
  if (e &&
@@ -339,6 +402,12 @@ __decorate([
339
402
  __decorate([
340
403
  watch(':outsideClick')
341
404
  ], inlinePopup.prototype, "onOutsideClick", null);
405
+ __decorate([
406
+ watch(':keyup')
407
+ ], inlinePopup.prototype, "onKeyUp", null);
408
+ __decorate([
409
+ watch(':recalcPositionPopup')
410
+ ], inlinePopup.prototype, "onRecalcPositionPopup", null);
342
411
  __decorate([
343
412
  autobind
344
413
  ], inlinePopup.prototype, "__onDocumentMouseDown", null);
@@ -8,10 +8,19 @@ import { Icon } from "../../core/ui/icon.js";
8
8
  import { Config } from "../../config.js";
9
9
  import olIcon from "./icons/ol.svg.js";
10
10
  import ulIcon from "./icons/ul.svg.js";
11
+ import { closestOrderedList, openStartDialog } from "./start-dialog.js";
12
+ /**
13
+ * The `ol` dropdown item that asks for the list's start number
14
+ */
15
+ const START = 'start';
11
16
  const memoExec = (jodit, _, { control }) => {
12
17
  var _a;
13
18
  const key = `button${control.command}`;
14
19
  const value = (_a = (control.args && control.args[0])) !== null && _a !== void 0 ? _a : dataBind(jodit, key);
20
+ if (value === START) {
21
+ openStartDialog(jodit);
22
+ return;
23
+ }
15
24
  dataBind(jodit, key, value);
16
25
  jodit.execCommand(control.command, false, value === 'default' ? null : value);
17
26
  };
@@ -38,7 +47,9 @@ Config.prototype.controls.ol = {
38
47
  'lower-greek': 'Lower Greek',
39
48
  'lower-roman': 'Lower Roman',
40
49
  'upper-alpha': 'Upper Alpha',
41
- 'upper-roman': 'Upper Roman'
50
+ 'upper-roman': 'Upper Roman',
51
+ [START]: 'Start at...'
42
52
  },
43
- exec: memoExec
53
+ exec: memoExec,
54
+ isChildDisabled: (jodit, button) => { var _a; return ((_a = button.control.args) === null || _a === void 0 ? void 0 : _a[0]) === START && !closestOrderedList(jodit); }
44
55
  };
@@ -0,0 +1,19 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ /**
7
+ * @module plugins/ordered-list
8
+ */
9
+ import type { IJodit, Nullable } from "../../types/index";
10
+ /**
11
+ * The numbered list the selection is in
12
+ */
13
+ export declare function closestOrderedList(jodit: IJodit): Nullable<HTMLOListElement>;
14
+ /**
15
+ * Asks for the number of the first item of the list the selection is in,
16
+ * and sets the list's `start`. The selection is put back when the dialog
17
+ * closes, however it closes.
18
+ */
19
+ export declare function openStartDialog(jodit: IJodit): void;
@@ -0,0 +1,58 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ import { Dom } from "../../core/dom/dom.js";
7
+ import { attr } from "../../core/helpers/utils/attr.js";
8
+ import { Button } from "../../core/ui/button/index.js";
9
+ import { UIBlock, UIForm, UIInput } from "../../core/ui/form/index.js";
10
+ /**
11
+ * The numbered list the selection is in
12
+ */
13
+ export function closestOrderedList(jodit) {
14
+ const current = jodit.s.current();
15
+ return current ? Dom.closest(current, 'ol', jodit.editor) : null;
16
+ }
17
+ /**
18
+ * Asks for the number of the first item of the list the selection is in,
19
+ * and sets the list's `start`. The selection is put back when the dialog
20
+ * closes, however it closes.
21
+ */
22
+ export function openStartDialog(jodit) {
23
+ const list = closestOrderedList(jodit);
24
+ if (!list) {
25
+ return;
26
+ }
27
+ const dialog = jodit.dlg({ resizable: false, closeOnClickOverlay: true });
28
+ const input = new UIInput(jodit, {
29
+ name: 'start',
30
+ type: 'number',
31
+ label: 'Number for the first item',
32
+ value: list.start
33
+ });
34
+ const form = new UIForm(jodit, [new UIBlock(jodit, [input])]);
35
+ form.container.classList.add('jodit-dialog_alert');
36
+ form.onSubmit(({ start }) => {
37
+ const value = start === '' ? 1 : parseInt(start, 10);
38
+ if (isNaN(value)) {
39
+ input.focus();
40
+ return false;
41
+ }
42
+ dialog.close();
43
+ attr(list, 'start', value === 1 ? null : value);
44
+ jodit.synchronizeValues();
45
+ });
46
+ jodit.s.save();
47
+ dialog.e.on(dialog, 'afterClose', () => {
48
+ jodit.s.focus();
49
+ jodit.s.restore();
50
+ });
51
+ dialog.setFooter([
52
+ Button(jodit, 'cancel', 'Cancel').onAction(() => dialog.close()),
53
+ Button(jodit, 'ok', 'Apply', 'primary').onAction(() => form.submit())
54
+ ]);
55
+ dialog.open(form, jodit.i18n('Start numbering at'), true, true);
56
+ input.focus();
57
+ input.nativeInput.select();
58
+ }
@@ -33,6 +33,10 @@ export function isEditorEmpty(root) {
33
33
  return true;
34
34
  }
35
35
  const first = root.firstChild;
36
+ // Firefox pads an empty editable body with a bare <br>
37
+ if (Dom.isTag(first, 'br') && !Dom.next(first, Boolean, root)) {
38
+ return true;
39
+ }
36
40
  if (INSEPARABLE_TAGS.has((_a = first.nodeName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) ||
37
41
  /^(TABLE)$/i.test(first.nodeName)) {
38
42
  return false;
@@ -69,7 +73,7 @@ export class placeholder extends Plugin {
69
73
  .on('changePlace.placeholder', this.addNativeListeners)
70
74
  .on('change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder ' +
71
75
  'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder ' +
72
- 'internalChange.placeholder afterCommand.placeholder', this.toggle)
76
+ 'internalChange.placeholder afterCommand.placeholder resize.placeholder', this.toggle)
73
77
  .on(window, 'load', this.toggle);
74
78
  this.addNativeListeners();
75
79
  this.toggle();
@@ -115,12 +119,14 @@ export class placeholder extends Plugin {
115
119
  marginTop = parseInt(style2.getPropertyValue('margin-top'), 10);
116
120
  marginLeft = parseInt(style2.getPropertyValue('margin-left'), 10);
117
121
  css(this.placeholderElm, {
122
+ fontFamily: style2.getPropertyValue('font-family'),
118
123
  fontSize: parseInt(style2.getPropertyValue('font-size'), 10),
119
124
  lineHeight: style2.getPropertyValue('line-height')
120
125
  });
121
126
  }
122
127
  else {
123
128
  css(this.placeholderElm, {
129
+ fontFamily: style.getPropertyValue('font-family'),
124
130
  fontSize: parseInt(style.getPropertyValue('font-size'), 10),
125
131
  lineHeight: style.getPropertyValue('line-height')
126
132
  });
@@ -46,6 +46,16 @@ export declare class resizer extends Plugin {
46
46
  private pointerX;
47
47
  private pointerY;
48
48
  private onResize;
49
+ private __keyDownRange;
50
+ private __keyDownTable;
51
+ private onEditorKeyDown;
52
+ private __caretTable;
53
+ /**
54
+ * Hide the frame once a key has moved the caret off its element, and
55
+ * frame a table the caret has moved into, as clicks do
56
+ */
57
+ protected onEditorKeyUp(): void;
58
+ private __followCaret;
49
59
  private isAltMode;
50
60
  private onKeyDown;
51
61
  private onKeyUp;
@@ -17,10 +17,13 @@ import * as consts from "../../core/constants.js";
17
17
  import { IS_ES_NEXT, IS_IE, KEY_ALT } from "../../core/constants.js";
18
18
  import { autobind, watch } from "../../core/decorators/index.js";
19
19
  import { Dom } from "../../core/dom/dom.js";
20
- import { eventEmitter, pluginSystem } from "../../core/global.js";
20
+ import { eventEmitter, getContainer, pluginSystem } from "../../core/global.js";
21
21
  import { $$, attr, css, dataBind, getWrappedMedia, innerWidth, markOwner, offset } from "../../core/helpers/index.js";
22
22
  import { cssInline } from "../../core/helpers/utils/css.js";
23
23
  import { Plugin } from "../../core/plugin/plugin.js";
24
+ import { isMoved } from "../../core/selection/helpers/index.js";
25
+ import { UIElement } from "../../core/ui/index.js";
26
+ import { Popup } from "../../core/ui/popup/index.js";
24
27
  import "./config.js";
25
28
  const keyBInd = '__jodit-resizer_binded';
26
29
  /**
@@ -45,6 +48,17 @@ function heightFollowsWidth(element) {
45
48
  !attr(element, 'height') &&
46
49
  !cssInline(element, 'height'));
47
50
  }
51
+ const IFRAME_WRAPPER = '[data-jodit_iframe_wrapper]';
52
+ /**
53
+ * A click on an embed lands on its wrapper, so it selects the embed, until the
54
+ * wrapper is active. While the editor is locked, as during resizing, the
55
+ * wrapper takes the mouse again.
56
+ */
57
+ const EMBED_WRAPPER_STYLE = `${IFRAME_WRAPPER}{position:relative;display:block;user-select:none}` +
58
+ `${IFRAME_WRAPPER} iframe{position:relative}` +
59
+ `${IFRAME_WRAPPER}::after{position:absolute;z-index:1;display:block;background:transparent;content:'';cursor:pointer;inset:0}` +
60
+ `${IFRAME_WRAPPER}[data-jodit-wrapper_active=true] iframe{z-index:2}` +
61
+ `.jodit_lock ${IFRAME_WRAPPER}[data-jodit-wrapper_active=true] iframe{z-index:1}`;
48
62
  /**
49
63
  * The module creates a supporting frame for resizing of the elements img and table
50
64
  */
@@ -72,6 +86,8 @@ export class resizer extends Plugin {
72
86
  this.sizeViewer = this.rect.getElementsByTagName('span')[0];
73
87
  this.pointerX = 0;
74
88
  this.pointerY = 0;
89
+ this.__keyDownRange = null;
90
+ this.__keyDownTable = null;
75
91
  this.isAltMode = false;
76
92
  this.onClickElement = (element) => {
77
93
  if (this.isResizeMode) {
@@ -123,6 +139,9 @@ export class resizer extends Plugin {
123
139
  }
124
140
  /** @override */
125
141
  afterInit(editor) {
142
+ // It goes in the editing document, so iframe mode has it whatever `iframeStyle` holds
143
+ getContainer(editor, 'resizer', 'style', true).textContent =
144
+ EMBED_WRAPPER_STYLE;
126
145
  $$('div', this.rect).forEach((resizeHandle) => {
127
146
  editor.e.on(resizeHandle, 'mousedown.resizer touchstart.resizer', this.onStartResizing.bind(this, resizeHandle));
128
147
  });
@@ -134,6 +153,9 @@ export class resizer extends Plugin {
134
153
  }
135
154
  })
136
155
  .on('afterInit changePlace', this.addEventListeners.bind(this))
156
+ // Handlers without a namespace run first, ahead of those that
157
+ // move the caret, as table-keyboard-navigation's do
158
+ .on('keydown', this.onEditorKeyDown, { top: true })
137
159
  .on('afterGetValueFromEditor.resizer', (data) => {
138
160
  const rgx = /<jodit[^>]+data-jodit_iframe_wrapper[^>]+>(.*?<iframe[^>]*>.*?<\/iframe>.*?)<\/jodit>/gi;
139
161
  if (rgx.test(data.value)) {
@@ -308,6 +330,43 @@ export class resizer extends Plugin {
308
330
  e.stopImmediatePropagation();
309
331
  }
310
332
  }
333
+ onEditorKeyDown(event) {
334
+ // A key held down moves the caret on every repeat, with one keyup
335
+ if (event === null || event === void 0 ? void 0 : event.repeat) {
336
+ this.__followCaret();
337
+ }
338
+ this.__keyDownRange = this.j.s.range.cloneRange();
339
+ this.__keyDownTable = this.__caretTable();
340
+ }
341
+ __caretTable() {
342
+ return Dom.closest(this.j.s.range.startContainer, 'table', this.j.editor);
343
+ }
344
+ /**
345
+ * Hide the frame once a key has moved the caret off its element, and
346
+ * frame a table the caret has moved into, as clicks do
347
+ */
348
+ onEditorKeyUp() {
349
+ this.__followCaret();
350
+ }
351
+ __followCaret() {
352
+ const before = this.__keyDownRange;
353
+ this.__keyDownRange = null;
354
+ if (!isMoved(this.j, before)) {
355
+ return;
356
+ }
357
+ if (this.isShown &&
358
+ this.element &&
359
+ !this.j.s.range.intersectsNode(this.element)) {
360
+ this.hide();
361
+ }
362
+ const table = this.__caretTable();
363
+ if (table &&
364
+ table !== this.__keyDownTable &&
365
+ this.j.o.allowResizeTags.has('table')) {
366
+ this.__bind(table);
367
+ this.onClickElement(table);
368
+ }
369
+ }
311
370
  onKeyDown(e) {
312
371
  this.isAltMode = e.key === KEY_ALT;
313
372
  if (!this.isAltMode && this.isResizeMode) {
@@ -329,6 +388,12 @@ export class resizer extends Plugin {
329
388
  return;
330
389
  }
331
390
  if (!this.isResizeMode) {
391
+ // A click in the element's popup, or in a list it opens, works on
392
+ // the element, so it keeps its frame
393
+ if ((e === null || e === void 0 ? void 0 : e.target) &&
394
+ UIElement.closestElement(e.target, Popup)) {
395
+ return;
396
+ }
332
397
  return this.hide();
333
398
  }
334
399
  e.stopImmediatePropagation();
@@ -512,7 +577,10 @@ export class resizer extends Plugin {
512
577
  this.hide();
513
578
  Dom.safeRemove(this.layer);
514
579
  eventEmitter.off('hideHelpers', this.hide);
515
- jodit.e.off(this.j.ow, '.resizer').off('.resizer');
580
+ jodit.e
581
+ .off(this.j.ow, '.resizer')
582
+ .off('.resizer')
583
+ .off('keydown', this.onEditorKeyDown);
516
584
  }
517
585
  }
518
586
  __decorate([
@@ -530,6 +598,12 @@ __decorate([
530
598
  __decorate([
531
599
  autobind
532
600
  ], resizer.prototype, "onResize", null);
601
+ __decorate([
602
+ autobind
603
+ ], resizer.prototype, "onEditorKeyDown", null);
604
+ __decorate([
605
+ watch(':keyup')
606
+ ], resizer.prototype, "onEditorKeyUp", null);
533
607
  __decorate([
534
608
  autobind
535
609
  ], resizer.prototype, "onKeyDown", null);
@@ -18,6 +18,29 @@ export declare class selectCells extends Plugin {
18
18
  */
19
19
  private get __tableModule();
20
20
  protected afterInit(jodit: IJodit): void;
21
+ /**
22
+ * The cell with the caret, and the selection, when a key went down
23
+ */
24
+ private __keyDownCell;
25
+ private __keyDownRange;
26
+ private __onKeyDown;
27
+ /**
28
+ * A link's popup replaces the cell's while the caret is in the link
29
+ */
30
+ private __keyDownInLink;
31
+ private __isInLink;
32
+ /**
33
+ * Where the selection starts rather than `s.current()`, which finds the
34
+ * first cell when the caret is just before the table
35
+ */
36
+ private __caretCell;
37
+ /**
38
+ * A key that moves the caret into a cell, from another cell or from
39
+ * outside the table, marks that cell and opens its popup, as a click on
40
+ * it does. One that moves the caret out of the table unmarks the cells
41
+ */
42
+ protected onKeyUp(): void;
43
+ private __followCaret;
21
44
  /**
22
45
  * First selected cell
23
46
  */
@@ -19,6 +19,7 @@ import { Dom } from "../../core/dom/dom.js";
19
19
  import { pluginSystem } from "../../core/global.js";
20
20
  import { $$, alignElement, position, toArray } from "../../core/helpers/index.js";
21
21
  import { Plugin } from "../../core/plugin/index.js";
22
+ import { isMoved } from "../../core/selection/helpers/index.js";
22
23
  import { Table } from "../../modules/table/table.js";
23
24
  import "./config.js";
24
25
  const key = 'table_processor_observer';
@@ -26,6 +27,15 @@ const MOUSE_MOVE_LABEL = 'onMoveTableSelectCell';
26
27
  export class selectCells extends Plugin {
27
28
  constructor() {
28
29
  super(...arguments);
30
+ /**
31
+ * The cell with the caret, and the selection, when a key went down
32
+ */
33
+ this.__keyDownCell = null;
34
+ this.__keyDownRange = null;
35
+ /**
36
+ * A link's popup replaces the cell's while the caret is in the link
37
+ */
38
+ this.__keyDownInLink = false;
29
39
  /**
30
40
  * First selected cell
31
41
  */
@@ -46,6 +56,9 @@ export class selectCells extends Plugin {
46
56
  return;
47
57
  }
48
58
  jodit.e
59
+ // Handlers without a namespace run first, ahead of those that
60
+ // move the caret, as table-keyboard-navigation's do
61
+ .on('keydown', this.__onKeyDown, { top: true })
49
62
  .on('keydown.select-cells', (event) => {
50
63
  if (event.key === KEY_TAB) {
51
64
  this.unselectCells();
@@ -76,6 +89,61 @@ export class selectCells extends Plugin {
76
89
  }
77
90
  });
78
91
  }
92
+ __onKeyDown(event) {
93
+ // A key held down moves the caret on every repeat, with one keyup
94
+ if (event === null || event === void 0 ? void 0 : event.repeat) {
95
+ this.__followCaret();
96
+ }
97
+ this.__keyDownCell = this.__caretCell();
98
+ this.__keyDownRange = this.j.s.range.cloneRange();
99
+ this.__keyDownInLink = this.__isInLink();
100
+ }
101
+ __isInLink() {
102
+ return Boolean(Dom.closest(this.j.s.range.startContainer, 'a', this.j.editor));
103
+ }
104
+ /**
105
+ * Where the selection starts rather than `s.current()`, which finds the
106
+ * first cell when the caret is just before the table
107
+ */
108
+ __caretCell() {
109
+ return Dom.closest(this.j.s.range.startContainer, Dom.isCell, this.j.editor);
110
+ }
111
+ /**
112
+ * A key that moves the caret into a cell, from another cell or from
113
+ * outside the table, marks that cell and opens its popup, as a click on
114
+ * it does. One that moves the caret out of the table unmarks the cells
115
+ */
116
+ onKeyUp() {
117
+ this.__followCaret();
118
+ }
119
+ __followCaret() {
120
+ const before = this.__keyDownRange;
121
+ this.__keyDownRange = null;
122
+ if (this.j.o.readonly || !isMoved(this.j, before)) {
123
+ return;
124
+ }
125
+ const cell = this.__caretCell();
126
+ const hasLeftLink = this.__keyDownInLink && !this.__isInLink();
127
+ if (cell === this.__keyDownCell && !(cell && hasLeftLink)) {
128
+ return;
129
+ }
130
+ const hadMarked = this.__tableModule.getAllSelectedCells().length > 0;
131
+ this.unselectCells();
132
+ if (!cell) {
133
+ if (hadMarked) {
134
+ this.j.e.fire('hidePopup', 'cells');
135
+ }
136
+ return;
137
+ }
138
+ const table = Dom.closest(cell, 'table', this.j.editor);
139
+ if (!table) {
140
+ return;
141
+ }
142
+ // As after a click, the first change to the cell keeps the mark
143
+ this.__selectedCell = cell;
144
+ this.__tableModule.addSelection(cell);
145
+ this.j.e.fire('showPopup', table, () => position(cell, this.j), 'cells');
146
+ }
79
147
  /**
80
148
  * Mouse click inside the table
81
149
  */
@@ -418,10 +486,16 @@ export class selectCells extends Plugin {
418
486
  /** @override */
419
487
  beforeDestruct(jodit) {
420
488
  this.__onRemoveSelection();
421
- jodit.e.off('.select-cells');
489
+ jodit.e.off('.select-cells').off('keydown', this.__onKeyDown);
422
490
  }
423
491
  }
424
492
  selectCells.requires = ['select'];
493
+ __decorate([
494
+ autobind
495
+ ], selectCells.prototype, "__onKeyDown", null);
496
+ __decorate([
497
+ watch(':keyup')
498
+ ], selectCells.prototype, "onKeyUp", null);
425
499
  __decorate([
426
500
  autobind
427
501
  ], selectCells.prototype, "onStartSelection", null);
@@ -36,7 +36,9 @@ export function tableKeyboardNavigation(editor) {
36
36
  case consts.KEY_TAB:
37
37
  case consts.KEY_LEFT: {
38
38
  next = getNextCell();
39
- if (!next) {
39
+ // Left in the first cell leaves the table, as Up in the
40
+ // top row does
41
+ if (!next && key === consts.KEY_TAB) {
40
42
  tableModule.appendRow(table, !isPrev
41
43
  ? false
42
44
  : Dom.first(table, node => Dom.isTag(node, 'tr')), !isPrev);
@@ -65,7 +67,6 @@ export function tableKeyboardNavigation(editor) {
65
67
  if (!next) {
66
68
  return;
67
69
  }
68
- editor.e.fire('hidePopup hideResizer');
69
70
  if (!next.firstChild) {
70
71
  const first = editor.createInside.element('br');
71
72
  Dom.append(next, first);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.18.4",
3
+ "version": "4.18.6",
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",
package/types/config.d.ts CHANGED
@@ -1404,6 +1404,9 @@ interface Config {
1404
1404
  iframeDoctype: string;
1405
1405
  /**
1406
1406
  * Custom style to be used inside the iframe to display content.
1407
+ * It goes in after `iframeCSSLinks`. The rules Jodit's own plugins need
1408
+ * in the editing document are added apart from it, so a value of your
1409
+ * own doesn't have to repeat them.
1407
1410
  *
1408
1411
  * ```javascript
1409
1412
  * Jodit.make('#editor', {
@@ -0,0 +1,29 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ /**
7
+ * A Word list paragraph, read before its `mso-list` style is lost
8
+ */
9
+ export interface WordListItem {
10
+ paragraph: HTMLElement;
11
+ list: string;
12
+ level: number;
13
+ tag: 'ul' | 'ol';
14
+ listStyleType: string | null;
15
+ start: number;
16
+ }
17
+ /**
18
+ * Finds Word's list paragraphs (`<p style="mso-list:l0 level1 lfo1">`), reads
19
+ * their list, level and type from the `mso-list:Ignore` marker, and removes the
20
+ * marker. Call it before anything strips the `mso-list` styles, then pass the
21
+ * result to {@link wrapWordListItems}
22
+ */
23
+ export declare function readWordListItems(root: HTMLElement): WordListItem[];
24
+ /**
25
+ * Turns the paragraphs found by {@link readWordListItems} into `<ul>`/`<ol>`
26
+ * lists, nesting them by level. Each paragraph becomes an `<li>` without Word's
27
+ * hanging indent
28
+ */
29
+ export declare function wrapWordListItems(items: WordListItem[]): void;
@@ -4,6 +4,7 @@
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  export * from "./composed-ranges";
7
+ export * from "./is-moved";
7
8
  export * from "./move-node-inside-start";
8
9
  export * from "./move-the-node-along-the-edge-outward";
9
10
  /**
@@ -0,0 +1,15 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ /**
7
+ * @module selection
8
+ */
9
+ import type { IJodit, Nullable } from "../../../types/index";
10
+ /**
11
+ * Whether the selection, `before` as it was when a key went down, has since
12
+ * moved to somewhere else in the editor
13
+ * @private
14
+ */
15
+ export declare function isMoved(jodit: IJodit, before: Nullable<Range>): boolean;
@@ -220,5 +220,8 @@ declare const _exports: {
220
220
  Loop: string;
221
221
  Muted: string;
222
222
  Controls: string;
223
+ 'Start at...': string;
224
+ 'Start numbering at': string;
225
+ 'Number for the first item': string;
223
226
  };
224
227
  export = _exports;