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.
- package/CHANGELOG.md +17 -0
- package/es2015/jodit.css +1 -6
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +14 -14
- package/es2015/jodit.js +70 -11
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +5 -5
- package/es2015/plugins/debug/debug.css +1 -1
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +5 -5
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +25 -25
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +1 -6
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +6 -6
- package/es2021/jodit.js +70 -11
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +6 -6
- package/es2021/plugins/debug/debug.css +1 -1
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +1 -6
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +6 -6
- package/es2021.en/jodit.js +70 -11
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +6 -6
- package/es2021.en/plugins/debug/debug.css +1 -1
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/jodit.css +2 -10
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +76 -13
- package/es5/jodit.min.css +3 -3
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/dom/dom.d.ts +4 -0
- package/esm/core/dom/dom.js +28 -0
- package/esm/core/selection/selection.js +3 -2
- package/esm/plugins/backspace/backspace.js +1 -0
- package/esm/plugins/focus/focus.js +11 -5
- package/esm/plugins/search/helpers/highlight-text-ranges.js +23 -0
- package/esm/plugins/wrap-nodes/wrap-nodes.js +5 -2
- package/package.json +1 -1
- package/types/core/dom/dom.d.ts +4 -0
package/es5/polyfills.fat.min.js
CHANGED
package/es5/polyfills.js
CHANGED
package/es5/polyfills.min.js
CHANGED
package/esm/core/constants.js
CHANGED
|
@@ -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
|
+
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;
|
package/esm/core/dom/dom.d.ts
CHANGED
|
@@ -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
|
*/
|
package/esm/core/dom/dom.js
CHANGED
|
@@ -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))
|
|
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) {
|
|
@@ -32,11 +32,17 @@ export function focus(editor) {
|
|
|
32
32
|
}
|
|
33
33
|
const focus = () => {
|
|
34
34
|
editor.s.focus();
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
editor.
|
|
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
|
|
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()
|
|
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
package/types/core/dom/dom.d.ts
CHANGED
|
@@ -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
|
*/
|