jodit 4.18.8 → 4.18.10

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 (134) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +8 -8
  4. package/es2015/jodit.js +128 -33
  5. package/es2015/jodit.min.js +6 -6
  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 +6 -6
  13. package/es2018/jodit.min.js +6 -6
  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 +6 -6
  18. package/es2021/jodit.js +128 -33
  19. package/es2021/jodit.min.js +6 -6
  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 +6 -6
  28. package/es2021.en/jodit.js +102 -7
  29. package/es2021.en/jodit.min.js +6 -6
  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 +128 -33
  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/ui/button/tooltip/tooltip.js +7 -0
  52. package/esm/langs/ar.d.ts +1 -0
  53. package/esm/langs/ar.js +2 -1
  54. package/esm/langs/az.d.ts +1 -0
  55. package/esm/langs/az.js +2 -1
  56. package/esm/langs/cs_cz.d.ts +1 -0
  57. package/esm/langs/cs_cz.js +2 -1
  58. package/esm/langs/de.d.ts +1 -0
  59. package/esm/langs/de.js +2 -1
  60. package/esm/langs/es.d.ts +1 -0
  61. package/esm/langs/es.js +2 -1
  62. package/esm/langs/fa.d.ts +1 -0
  63. package/esm/langs/fa.js +2 -1
  64. package/esm/langs/fi.d.ts +1 -0
  65. package/esm/langs/fi.js +2 -1
  66. package/esm/langs/fr.d.ts +1 -0
  67. package/esm/langs/fr.js +2 -1
  68. package/esm/langs/he.d.ts +1 -0
  69. package/esm/langs/he.js +2 -1
  70. package/esm/langs/hu.d.ts +1 -0
  71. package/esm/langs/hu.js +2 -1
  72. package/esm/langs/id.d.ts +1 -0
  73. package/esm/langs/id.js +2 -1
  74. package/esm/langs/it.d.ts +1 -0
  75. package/esm/langs/it.js +2 -1
  76. package/esm/langs/ja.d.ts +1 -0
  77. package/esm/langs/ja.js +2 -1
  78. package/esm/langs/ko.d.ts +1 -0
  79. package/esm/langs/ko.js +2 -1
  80. package/esm/langs/mn.d.ts +1 -0
  81. package/esm/langs/mn.js +2 -1
  82. package/esm/langs/nl.d.ts +1 -0
  83. package/esm/langs/nl.js +2 -1
  84. package/esm/langs/no.d.ts +1 -0
  85. package/esm/langs/no.js +2 -1
  86. package/esm/langs/pl.d.ts +1 -0
  87. package/esm/langs/pl.js +2 -1
  88. package/esm/langs/pt_br.d.ts +1 -0
  89. package/esm/langs/pt_br.js +2 -1
  90. package/esm/langs/ru.d.ts +1 -0
  91. package/esm/langs/ru.js +2 -1
  92. package/esm/langs/sk.d.ts +1 -0
  93. package/esm/langs/sk.js +2 -1
  94. package/esm/langs/sv.d.ts +1 -0
  95. package/esm/langs/sv.js +2 -1
  96. package/esm/langs/tr.d.ts +1 -0
  97. package/esm/langs/tr.js +2 -1
  98. package/esm/langs/ua.d.ts +1 -0
  99. package/esm/langs/ua.js +2 -1
  100. package/esm/langs/zh_cn.d.ts +1 -0
  101. package/esm/langs/zh_cn.js +2 -1
  102. package/esm/langs/zh_tw.d.ts +1 -0
  103. package/esm/langs/zh_tw.js +2 -1
  104. package/esm/modules/dialog/dialog.js +1 -0
  105. package/esm/plugins/ai-assistant/ui/ui-ai-assistant.js +11 -2
  106. package/esm/plugins/backspace/cases/check-join-neighbors.js +92 -0
  107. package/esm/plugins/bold/config.js +2 -2
  108. package/package.json +1 -1
  109. package/types/langs/ar.d.ts +1 -0
  110. package/types/langs/az.d.ts +1 -0
  111. package/types/langs/cs_cz.d.ts +1 -0
  112. package/types/langs/de.d.ts +1 -0
  113. package/types/langs/es.d.ts +1 -0
  114. package/types/langs/fa.d.ts +1 -0
  115. package/types/langs/fi.d.ts +1 -0
  116. package/types/langs/fr.d.ts +1 -0
  117. package/types/langs/he.d.ts +1 -0
  118. package/types/langs/hu.d.ts +1 -0
  119. package/types/langs/id.d.ts +1 -0
  120. package/types/langs/it.d.ts +1 -0
  121. package/types/langs/ja.d.ts +1 -0
  122. package/types/langs/ko.d.ts +1 -0
  123. package/types/langs/mn.d.ts +1 -0
  124. package/types/langs/nl.d.ts +1 -0
  125. package/types/langs/no.d.ts +1 -0
  126. package/types/langs/pl.d.ts +1 -0
  127. package/types/langs/pt_br.d.ts +1 -0
  128. package/types/langs/ru.d.ts +1 -0
  129. package/types/langs/sk.d.ts +1 -0
  130. package/types/langs/sv.d.ts +1 -0
  131. package/types/langs/tr.d.ts +1 -0
  132. package/types/langs/ua.d.ts +1 -0
  133. package/types/langs/zh_cn.d.ts +1 -0
  134. package/types/langs/zh_tw.d.ts +1 -0
@@ -11,6 +11,12 @@ import { getMoveFilter } from "../helpers.js";
11
11
  * @private
12
12
  */
13
13
  export function checkJoinNeighbors(jodit, fakeNode, backspace) {
14
+ return joinNeighbors(jodit, fakeNode, backspace, false);
15
+ }
16
+ /**
17
+ * `moved` is set on the one re-entrant pass after `moveToNextLine`
18
+ */
19
+ function joinNeighbors(jodit, fakeNode, backspace, moved) {
14
20
  if (checkJoinBareText(jodit, fakeNode, backspace)) {
15
21
  return true;
16
22
  }
@@ -44,6 +50,16 @@ export function checkJoinNeighbors(jodit, fakeNode, backspace) {
44
50
  return true;
45
51
  }
46
52
  const box = findCaretBox(fakeNode, mainClosestBox);
53
+ // One pass only: the line now sits beside the next one, so the
54
+ // cases below join them. The DOM has changed either way
55
+ if (!moved &&
56
+ sibling &&
57
+ moveToNextLine(jodit, fakeNode, box, sibling, backspace)) {
58
+ if (!joinNeighbors(jodit, fakeNode, backspace, true)) {
59
+ jodit.s.setCursorBefore(fakeNode);
60
+ }
61
+ return true;
62
+ }
47
63
  if (sibling &&
48
64
  (checkPullNextLine(jodit, fakeNode, box, sibling, backspace) ||
49
65
  checkMoveListContent(jodit, box, sibling, backspace) ||
@@ -109,6 +125,82 @@ function resolveTableSibling(sibling, backspace) {
109
125
  });
110
126
  return cells.length ? cells[backspace ? cells.length - 1 : 0] : null;
111
127
  }
128
+ /**
129
+ * On Delete, Word joins two lines where the next one is, inside or outside
130
+ * its box or quote, and the joined line keeps the caret line's kind, list item
131
+ * or paragraph. Two paragraphs already join that way. When either line is a
132
+ * list item, this moves the caret's line beside the next one, and the usual
133
+ * cases then join them: `<p>one|</p><div><ul><li>two</li></ul></div>` becomes
134
+ * `<div><p>one|</p><ul><li>two</li></ul></div>`
135
+ * @private
136
+ */
137
+ function moveToNextLine(jodit, fakeNode, box, sibling, backspace) {
138
+ if (backspace ||
139
+ Dom.isTag(sibling, 'table') ||
140
+ Dom.isTag(sibling, INSEPARABLE_TAGS) ||
141
+ !Dom.isContentEditable(sibling, jodit.editor)) {
142
+ return false;
143
+ }
144
+ const line = Dom.up(fakeNode, Dom.isBlock, box, true);
145
+ const next = findEdgeBlock(sibling, false, jodit.editor);
146
+ if (!line ||
147
+ !next ||
148
+ !Dom.isContentEditable(next, jodit.editor) ||
149
+ !(Dom.isLeaf(line) || Dom.isLeaf(next)) ||
150
+ // A paragraph inside a list item is left as it is
151
+ Dom.isLeaf(line.parentElement) ||
152
+ Dom.isLeaf(next.parentElement) ||
153
+ boxOf(line) === boxOf(next)) {
154
+ return false;
155
+ }
156
+ const from = line.parentElement;
157
+ if (Dom.isLeaf(line) && Dom.isLeaf(next)) {
158
+ Dom.before(next, line);
159
+ }
160
+ else if (Dom.isLeaf(line)) {
161
+ // A list item keeps its bullet, in a list of its own
162
+ Dom.before(next, ownList(line));
163
+ }
164
+ else {
165
+ // A paragraph can't go inside a list, so it goes in front of it
166
+ Dom.before(next.parentElement, line);
167
+ }
168
+ let remove = from;
169
+ while (remove && remove !== jodit.editor && Dom.isEmpty(remove)) {
170
+ const parent = remove.parentElement;
171
+ Dom.safeRemove(remove);
172
+ remove = parent;
173
+ }
174
+ return true;
175
+ }
176
+ /**
177
+ * The box or quote a line is in, past its lists
178
+ */
179
+ function boxOf(line) {
180
+ let box = line.parentElement;
181
+ while (Dom.isList(box) || Dom.isLeaf(box)) {
182
+ box = box.parentElement;
183
+ }
184
+ return box;
185
+ }
186
+ /**
187
+ * Moves a list item into a list of its own, which carries on its numbering
188
+ */
189
+ function ownList(item) {
190
+ const list = item.parentElement;
191
+ const own = list.cloneNode(false);
192
+ const index = Array.from(list.children).indexOf(item);
193
+ if (index) {
194
+ // Two lists cannot share one id
195
+ own.removeAttribute('id');
196
+ if (Dom.isTag(list, 'ol')) {
197
+ const start = parseInt(list.getAttribute('start') || '1', 10) || 1;
198
+ own.setAttribute('start', String(start + index));
199
+ }
200
+ }
201
+ Dom.append(own, item);
202
+ return own;
203
+ }
112
204
  /**
113
205
  * Delete at the edge of a list pulls the next line up to the caret, as the
114
206
  * browsers do, instead of moving the caret's line into the next block:
@@ -6,11 +6,11 @@
6
6
  import { Config } from "../../config.js";
7
7
  Config.prototype.controls.subscript = {
8
8
  tags: ['sub'],
9
- tooltip: 'subscript'
9
+ tooltip: 'Subscript'
10
10
  };
11
11
  Config.prototype.controls.superscript = {
12
12
  tags: ['sup'],
13
- tooltip: 'superscript'
13
+ tooltip: 'Superscript'
14
14
  };
15
15
  Config.prototype.controls.bold = {
16
16
  tagRegExp: /^(strong|b)$/i,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.18.8",
3
+ "version": "4.18.10",
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",
@@ -223,5 +223,6 @@ declare const _exports: {
223
223
  'Start at...': string;
224
224
  'Start numbering at': string;
225
225
  'Number for the first item': string;
226
+ Close: string;
226
227
  };
227
228
  export = _exports;
@@ -229,5 +229,6 @@ declare const _exports: {
229
229
  'Start at...': string;
230
230
  'Start numbering at': string;
231
231
  'Number for the first item': string;
232
+ Close: string;
232
233
  };
233
234
  export = _exports;
@@ -221,5 +221,6 @@ declare const _exports: {
221
221
  'Start at...': string;
222
222
  'Start numbering at': string;
223
223
  'Number for the first item': string;
224
+ Close: string;
224
225
  };
225
226
  export = _exports;
@@ -225,5 +225,6 @@ declare const _exports: {
225
225
  'Start at...': string;
226
226
  'Start numbering at': string;
227
227
  'Number for the first item': string;
228
+ Close: string;
228
229
  };
229
230
  export = _exports;
@@ -225,5 +225,6 @@ declare const _exports: {
225
225
  'Start at...': string;
226
226
  'Start numbering at': string;
227
227
  'Number for the first item': string;
228
+ Close: string;
228
229
  };
229
230
  export = _exports;
@@ -220,5 +220,6 @@ declare const _exports: {
220
220
  'Start at...': string;
221
221
  'Start numbering at': string;
222
222
  'Number for the first item': string;
223
+ Close: string;
223
224
  };
224
225
  export = _exports;
@@ -226,5 +226,6 @@ declare const _exports: {
226
226
  'Start at...': string;
227
227
  'Start numbering at': string;
228
228
  'Number for the first item': string;
229
+ Close: string;
229
230
  };
230
231
  export = _exports;
@@ -220,5 +220,6 @@ declare const _exports: {
220
220
  'Start at...': string;
221
221
  'Start numbering at': string;
222
222
  'Number for the first item': string;
223
+ Close: string;
223
224
  };
224
225
  export = _exports;
@@ -220,5 +220,6 @@ declare const _exports: {
220
220
  'Start at...': string;
221
221
  'Start numbering at': string;
222
222
  'Number for the first item': string;
223
+ Close: string;
223
224
  };
224
225
  export = _exports;
@@ -222,5 +222,6 @@ declare const _exports: {
222
222
  'Start at...': string;
223
223
  'Start numbering at': string;
224
224
  'Number for the first item': string;
225
+ Close: string;
225
226
  };
226
227
  export = _exports;
@@ -221,5 +221,6 @@ declare const _exports: {
221
221
  'Start at...': string;
222
222
  'Start numbering at': string;
223
223
  'Number for the first item': string;
224
+ Close: string;
224
225
  };
225
226
  export = _exports;
@@ -225,5 +225,6 @@ declare const _exports: {
225
225
  'Start at...': string;
226
226
  'Start numbering at': string;
227
227
  'Number for the first item': string;
228
+ Close: string;
228
229
  };
229
230
  export = _exports;
@@ -225,5 +225,6 @@ declare const _exports: {
225
225
  'Start at...': string;
226
226
  'Start numbering at': string;
227
227
  'Number for the first item': string;
228
+ Close: string;
228
229
  };
229
230
  export = _exports;
@@ -219,5 +219,6 @@ declare const _exports: {
219
219
  'Start at...': string;
220
220
  'Start numbering at': string;
221
221
  'Number for the first item': string;
222
+ Close: string;
222
223
  };
223
224
  export = _exports;
@@ -220,5 +220,6 @@ declare const _exports: {
220
220
  'Start at...': string;
221
221
  'Start numbering at': string;
222
222
  'Number for the first item': string;
223
+ Close: string;
223
224
  };
224
225
  export = _exports;
@@ -221,5 +221,6 @@ declare const _exports: {
221
221
  'Start at...': string;
222
222
  'Start numbering at': string;
223
223
  'Number for the first item': string;
224
+ Close: string;
224
225
  };
225
226
  export = _exports;
@@ -229,5 +229,6 @@ declare const _exports: {
229
229
  'Start at...': string;
230
230
  'Start numbering at': string;
231
231
  'Number for the first item': string;
232
+ Close: string;
232
233
  };
233
234
  export = _exports;
@@ -220,5 +220,6 @@ declare const _exports: {
220
220
  'Start at...': string;
221
221
  'Start numbering at': string;
222
222
  'Number for the first item': string;
223
+ Close: string;
223
224
  };
224
225
  export = _exports;
@@ -225,5 +225,6 @@ declare const _exports: {
225
225
  'Start at...': string;
226
226
  'Start numbering at': string;
227
227
  'Number for the first item': string;
228
+ Close: string;
228
229
  };
229
230
  export = _exports;
@@ -219,5 +219,6 @@ declare const _exports: {
219
219
  'Start at...': string;
220
220
  'Start numbering at': string;
221
221
  'Number for the first item': string;
222
+ Close: string;
222
223
  };
223
224
  export = _exports;
@@ -227,5 +227,6 @@ declare const _exports: {
227
227
  'Start at...': string;
228
228
  'Start numbering at': string;
229
229
  'Number for the first item': string;
230
+ Close: string;
230
231
  };
231
232
  export = _exports;
@@ -228,5 +228,6 @@ declare const _exports: {
228
228
  'Start at...': string;
229
229
  'Start numbering at': string;
230
230
  'Number for the first item': string;
231
+ Close: string;
231
232
  };
232
233
  export = _exports;
@@ -220,5 +220,6 @@ declare const _exports: {
220
220
  'Start at...': string;
221
221
  'Start numbering at': string;
222
222
  'Number for the first item': string;
223
+ Close: string;
223
224
  };
224
225
  export = _exports;
@@ -219,5 +219,6 @@ declare const _exports: {
219
219
  'Start at...': string;
220
220
  'Start numbering at': string;
221
221
  'Number for the first item': string;
222
+ Close: string;
222
223
  };
223
224
  export = _exports;
@@ -221,5 +221,6 @@ declare const _exports: {
221
221
  'Start at...': string;
222
222
  'Start numbering at': string;
223
223
  'Number for the first item': string;
224
+ Close: string;
224
225
  };
225
226
  export = _exports;
@@ -220,5 +220,6 @@ declare const _exports: {
220
220
  'Start at...': string;
221
221
  'Start numbering at': string;
222
222
  'Number for the first item': string;
223
+ Close: string;
223
224
  };
224
225
  export = _exports;