jodit 4.18.9 → 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 (52) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +3 -3
  4. package/es2015/jodit.js +77 -2
  5. package/es2015/jodit.min.js +3 -3
  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 +3 -3
  13. package/es2018/jodit.min.js +3 -3
  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 +3 -3
  18. package/es2021/jodit.js +77 -2
  19. package/es2021/jodit.min.js +3 -3
  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 +3 -3
  28. package/es2021.en/jodit.js +77 -2
  29. package/es2021.en/jodit.min.js +3 -3
  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 +77 -2
  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/plugins/backspace/cases/check-join-neighbors.js +92 -0
  52. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.18.9
4
+ * Version: v4.18.10
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.18.9
4
+ * Version: v4.18.10
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.18.9
4
+ * Version: v4.18.10
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.18.9
4
+ * Version: v4.18.10
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.18.9
4
+ * Version: v4.18.10
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.18.9
4
+ * Version: v4.18.10
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.18.9
4
+ * Version: v4.18.10
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
package/es5/polyfills.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.18.9
4
+ * Version: v4.18.10
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.18.9
4
+ * Version: v4.18.10
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -3,7 +3,7 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- export const APP_VERSION = "4.18.9";
6
+ export const APP_VERSION = "4.18.10";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -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:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.18.9",
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",