jodit 4.11.6 → 4.11.7

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 (68) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/es2015/jodit.css +1 -6
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +14 -14
  5. package/es2015/jodit.js +70 -11
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +5 -5
  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 +5 -5
  16. package/es2018/jodit.min.css +1 -1
  17. package/es2018/jodit.min.js +25 -25
  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 +1 -6
  21. package/es2021/jodit.fat.min.css +1 -1
  22. package/es2021/jodit.fat.min.js +6 -6
  23. package/es2021/jodit.js +70 -11
  24. package/es2021/jodit.min.css +1 -1
  25. package/es2021/jodit.min.js +6 -6
  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 -6
  33. package/es2021.en/jodit.fat.min.css +1 -1
  34. package/es2021.en/jodit.fat.min.js +6 -6
  35. package/es2021.en/jodit.js +70 -11
  36. package/es2021.en/jodit.min.css +1 -1
  37. package/es2021.en/jodit.min.js +6 -6
  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 +2 -10
  45. package/es5/jodit.fat.min.css +1 -1
  46. package/es5/jodit.fat.min.js +2 -2
  47. package/es5/jodit.js +76 -13
  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/core/constants.js +1 -1
  60. package/esm/core/dom/dom.d.ts +4 -0
  61. package/esm/core/dom/dom.js +28 -0
  62. package/esm/core/selection/selection.js +3 -2
  63. package/esm/plugins/backspace/backspace.js +1 -0
  64. package/esm/plugins/focus/focus.js +11 -5
  65. package/esm/plugins/search/helpers/highlight-text-ranges.js +23 -0
  66. package/esm/plugins/wrap-nodes/wrap-nodes.js +5 -2
  67. package/package.json +1 -1
  68. package/types/core/dom/dom.d.ts +4 -0
@@ -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.11.6
4
+ * Version: v4.11.7
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.11.6
4
+ * Version: v4.11.7
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.11.6
4
+ * Version: v4.11.7
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.11.6
4
+ * Version: v4.11.7
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.11.6
4
+ * Version: v4.11.7
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.11.6
4
+ * Version: v4.11.7
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.11.6
4
+ * Version: v4.11.7
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.11.6
4
+ * Version: v4.11.7
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.11.6
4
+ * Version: v4.11.7
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.11.6";
6
+ export const APP_VERSION = "4.11.7";
7
7
  // prettier-ignore
8
8
  export const ES = "es2020";
9
9
  export const IS_ES_MODERN = true;
@@ -124,6 +124,10 @@ export declare class Dom {
124
124
  * It's block and it can be split
125
125
  */
126
126
  static canSplitBlock(node: unknown): boolean;
127
+ /**
128
+ * Get first matched node inside root
129
+ */
130
+ static first(root: Nullable<Node>, condition: NodeCondition): Nullable<Node>;
127
131
  /**
128
132
  * Get last matched node inside root
129
133
  */
@@ -331,6 +331,34 @@ export class Dom {
331
331
  node.style !== undefined &&
332
332
  !/^(fixed|absolute)/i.test(node.style.position));
333
333
  }
334
+ /**
335
+ * Get first matched node inside root
336
+ */
337
+ static first(root, condition) {
338
+ let first = root === null || root === void 0 ? void 0 : root.firstChild;
339
+ if (!first) {
340
+ return null;
341
+ }
342
+ do {
343
+ if (condition(first)) {
344
+ return first;
345
+ }
346
+ let next = first.firstChild;
347
+ if (!next) {
348
+ next = first.nextSibling;
349
+ }
350
+ if (!next && first.parentNode !== root) {
351
+ do {
352
+ first = first.parentNode;
353
+ } while (first &&
354
+ !(first === null || first === void 0 ? void 0 : first.nextSibling) &&
355
+ first.parentNode !== root);
356
+ next = first === null || first === void 0 ? void 0 : first.nextSibling;
357
+ }
358
+ first = next;
359
+ } while (first);
360
+ return null;
361
+ }
334
362
  /**
335
363
  * Get last matched node inside root
336
364
  */
@@ -217,7 +217,8 @@ export class Selection {
217
217
  restore() {
218
218
  let range = false;
219
219
  const markAttr = (start) => `span[data-${consts.MARKER_CLASS}=${start ? 'start' : 'end'}]`;
220
- const start = this.area.querySelector(markAttr(true)), end = this.area.querySelector(markAttr(false));
220
+ const start = this.area.querySelector(markAttr(true));
221
+ const end = this.area.querySelector(markAttr(false));
221
222
  if (!start) {
222
223
  return;
223
224
  }
@@ -844,7 +845,7 @@ export class Selection {
844
845
  */
845
846
  selectRange(range, focus = true) {
846
847
  const sel = this.sel;
847
- if (focus && !this.isFocused()) {
848
+ if (focus && !this.isFocused() && this.j.e.current !== 'focus') {
848
849
  this.focus();
849
850
  }
850
851
  if (sel) {
@@ -57,6 +57,7 @@ export class backspace extends Plugin {
57
57
  sel.focus();
58
58
  }
59
59
  if (checkNotCollapsed(jodit)) {
60
+ jodit.e.fire('backSpaceAfterDelete', backspace);
60
61
  return false;
61
62
  }
62
63
  const range = sel.range;
@@ -32,11 +32,17 @@ export function focus(editor) {
32
32
  }
33
33
  const focus = () => {
34
34
  editor.s.focus();
35
- if (editor.o.cursorAfterAutofocus === 'end') {
36
- const lastTextNode = Dom.last(editor.editor, node => Dom.isText(node));
37
- if (lastTextNode) {
38
- editor.s.setCursorIn(lastTextNode, false);
39
- }
35
+ let textNode = null;
36
+ switch (editor.o.cursorAfterAutofocus) {
37
+ case 'start':
38
+ textNode = Dom.first(editor.editor, node => Dom.isText(node));
39
+ break;
40
+ case 'end':
41
+ textNode = Dom.last(editor.editor, node => Dom.isText(node));
42
+ break;
43
+ }
44
+ if (textNode) {
45
+ editor.s.setCursorIn(textNode, editor.o.cursorAfterAutofocus === 'start');
40
46
  }
41
47
  };
42
48
  editor.e.on('afterInit', () => {
@@ -10,6 +10,27 @@ import { $$ } from "../../../core/helpers/utils/selector.js";
10
10
  * @private
11
11
  */
12
12
  const TMP_ATTR = 'jd-tmp-selection';
13
+ const HIGHLIGHT_CSS = 'background-color: var(--jd-color-background-selection); color: var(--jd-color-text-selection);';
14
+ const injectedDocs = new WeakSet();
15
+ function ensureHighlightStyle(doc, useHighlightAPI) {
16
+ if (injectedDocs.has(doc)) {
17
+ return;
18
+ }
19
+ injectedDocs.add(doc);
20
+ const rule = useHighlightAPI
21
+ ? `::highlight(jodit-search-result) { ${HIGHLIGHT_CSS} }`
22
+ : `[${TMP_ATTR}] { ${HIGHLIGHT_CSS} }`;
23
+ try {
24
+ const sheet = new CSSStyleSheet();
25
+ sheet.insertRule(rule);
26
+ doc.adoptedStyleSheets = [...doc.adoptedStyleSheets, sheet];
27
+ }
28
+ catch (_a) {
29
+ const style = doc.createElement('style');
30
+ style.textContent = rule;
31
+ doc.head.appendChild(style);
32
+ }
33
+ }
13
34
  /**
14
35
  * @private
15
36
  */
@@ -21,6 +42,7 @@ export function highlightTextRanges(jodit, rng, restRanges, ci, root) {
21
42
  if (checkNativeSelectionMethod(jodit, rng, restRanges)) {
22
43
  return;
23
44
  }
45
+ ensureHighlightStyle(jodit.ed, false);
24
46
  const span = ci.element('span', {
25
47
  [TMP_ATTR]: true
26
48
  });
@@ -83,6 +105,7 @@ function checkNativeSelectionMethod(jodit, rng, restRanges) {
83
105
  range.setEnd(rng.endContainer, rng.endOffset);
84
106
  return range;
85
107
  });
108
+ ensureHighlightStyle(jodit.ed, true);
86
109
  const searchHighlight = new Highlight(...ranges);
87
110
  // @ts-ignore
88
111
  CSS.highlights.clear();
@@ -70,7 +70,8 @@ class wrapNodes extends Plugin {
70
70
  if (!jodit.isEditorMode()) {
71
71
  return;
72
72
  }
73
- let child = jodit.editor.firstChild, isChanged = false;
73
+ let child = jodit.editor.firstChild;
74
+ let isChanged = false;
74
75
  while (child) {
75
76
  child = checkAloneListLeaf(child, jodit);
76
77
  if (this.isSuitableStart(child)) {
@@ -111,7 +112,9 @@ class wrapNodes extends Plugin {
111
112
  const br = jodit.createInside.element('br');
112
113
  Dom.append(box, br);
113
114
  Dom.append(jodit.editor, box);
114
- jodit.s.isFocused() && jodit.s.setCursorBefore(br);
115
+ if (jodit.s.isFocused() || jodit.e.current === 'backSpaceAfterDelete') {
116
+ jodit.s.setCursorBefore(br);
117
+ }
115
118
  jodit.e.fire('internalChange');
116
119
  }
117
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.11.6",
3
+ "version": "4.11.7",
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",
@@ -124,6 +124,10 @@ export declare class Dom {
124
124
  * It's block and it can be split
125
125
  */
126
126
  static canSplitBlock(node: unknown): boolean;
127
+ /**
128
+ * Get first matched node inside root
129
+ */
130
+ static first(root: Nullable<Node>, condition: NodeCondition): Nullable<Node>;
127
131
  /**
128
132
  * Get last matched node inside root
129
133
  */