jodit 4.13.23 → 4.13.24
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 +6 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +25 -5
- package/es2015/jodit.min.js +2 -2
- 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.js +2 -2
- package/es2018/jodit.min.js +2 -2
- 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 -1
- package/es2021/jodit.fat.min.js +3 -3
- package/es2021/jodit.js +26 -5
- package/es2021/jodit.min.js +3 -3
- 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 -1
- package/es2021.en/jodit.fat.min.js +3 -3
- package/es2021.en/jodit.js +26 -5
- package/es2021.en/jodit.min.js +3 -3
- 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 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +27 -5
- package/es5/jodit.min.css +2 -2
- 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/selection/style/api/wrap.d.ts +2 -1
- package/esm/core/selection/style/api/wrap.js +12 -2
- package/esm/core/selection/style/transactions.js +18 -4
- package/package.json +1 -1
- package/types/core/selection/style/api/wrap.d.ts +2 -1
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.13.
|
|
6
|
+
export const APP_VERSION = "4.13.24";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -3,9 +3,10 @@
|
|
|
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
|
-
import type { ICommitStyle, IJodit } from "../../../../types/index";
|
|
6
|
+
import type { HTMLTagNames, ICommitStyle, IJodit } from "../../../../types/index";
|
|
7
7
|
/**
|
|
8
8
|
* Replaces the parent tag with the applicable one, or wraps the text and also replaces the tag
|
|
9
9
|
* @private
|
|
10
10
|
*/
|
|
11
11
|
export declare function wrap(commitStyle: ICommitStyle, font: HTMLElement, jodit: IJodit): HTMLElement;
|
|
12
|
+
export declare const WRAP_NODES: Set<HTMLTagNames>;
|
|
@@ -32,7 +32,7 @@ export function wrap(commitStyle, font, jodit) {
|
|
|
32
32
|
}
|
|
33
33
|
return newWrapper;
|
|
34
34
|
}
|
|
35
|
-
const WRAP_NODES = new Set([
|
|
35
|
+
export const WRAP_NODES = new Set([
|
|
36
36
|
'td',
|
|
37
37
|
'th',
|
|
38
38
|
'tr',
|
|
@@ -48,7 +48,9 @@ const WRAP_NODES = new Set([
|
|
|
48
48
|
*/
|
|
49
49
|
function findOrCreateWrapper(commitStyle, font, jodit) {
|
|
50
50
|
if (commitStyle.elementIsBlock) {
|
|
51
|
-
const box = Dom.up(font, node => Dom.isBlock(node) &&
|
|
51
|
+
const box = Dom.up(font, node => Dom.isBlock(node) &&
|
|
52
|
+
!Dom.isTag(node, WRAP_NODES) &&
|
|
53
|
+
!hasBlockChildren(node), jodit.editor);
|
|
52
54
|
if (box) {
|
|
53
55
|
return box;
|
|
54
56
|
}
|
|
@@ -57,3 +59,11 @@ function findOrCreateWrapper(commitStyle, font, jodit) {
|
|
|
57
59
|
attr(font, 'size', null);
|
|
58
60
|
return font;
|
|
59
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* A block that itself contains block-level children is a layout container:
|
|
64
|
+
* replacing it wholesale would merge all its blocks into the new element,
|
|
65
|
+
* so the selection must be wrapped in a new block inside it instead.
|
|
66
|
+
*/
|
|
67
|
+
function hasBlockChildren(node) {
|
|
68
|
+
return Array.from(node.childNodes).some(child => Dom.isBlock(child));
|
|
69
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { LIST_TAGS } from "../../constants.js";
|
|
7
7
|
import { Dom } from "../../dom/dom.js";
|
|
8
8
|
import { assert } from "../../helpers/utils/assert.js";
|
|
9
|
-
import { extractSelectedPart, getSuitChild, getSuitParent, isInsideInvisibleElement, suitableClosest, toggleAttributes, toggleOrderedList, unwrapChildren, wrap } from "./api/index.js";
|
|
9
|
+
import { extractSelectedPart, getSuitChild, getSuitParent, isInsideInvisibleElement, suitableClosest, toggleAttributes, toggleOrderedList, unwrapChildren, wrap, WRAP_NODES } from "./api/index.js";
|
|
10
10
|
import { INITIAL, REPLACE, UNSET, UNWRAP, WRAP } from "./constants.js";
|
|
11
11
|
export const states = {
|
|
12
12
|
START: 'START',
|
|
@@ -162,11 +162,25 @@ export const transactions = {
|
|
|
162
162
|
},
|
|
163
163
|
[states.UNWRAP]: {
|
|
164
164
|
exec(value) {
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
const { element, style, jodit } = value;
|
|
166
|
+
if (element.attributes.length &&
|
|
167
|
+
Dom.isTag(element, style.element)) {
|
|
168
|
+
return { ...value, next: states.REPLACE_DEFAULT };
|
|
169
|
+
}
|
|
170
|
+
// Unwrapping a block inside a container (e.g. an h3 inside a div)
|
|
171
|
+
// leaves bare inline content there: the wrapNodes plugin restores
|
|
172
|
+
// paragraphs only at the editor root. Replace such a block with
|
|
173
|
+
// the default tag instead.
|
|
174
|
+
const parent = element.parentElement;
|
|
175
|
+
if (style.elementIsBlock &&
|
|
176
|
+
!style.elementIsDefault &&
|
|
177
|
+
parent &&
|
|
178
|
+
parent !== jodit.editor &&
|
|
179
|
+
Dom.isBlock(parent) &&
|
|
180
|
+
!Dom.isTag(parent, WRAP_NODES)) {
|
|
167
181
|
return { ...value, next: states.REPLACE_DEFAULT };
|
|
168
182
|
}
|
|
169
|
-
Dom.unwrap(
|
|
183
|
+
Dom.unwrap(element);
|
|
170
184
|
return { ...value, mode: UNWRAP, next: states.END };
|
|
171
185
|
}
|
|
172
186
|
},
|
package/package.json
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
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
|
-
import type { ICommitStyle, IJodit } from "../../../../types/index";
|
|
6
|
+
import type { HTMLTagNames, ICommitStyle, IJodit } from "../../../../types/index";
|
|
7
7
|
/**
|
|
8
8
|
* Replaces the parent tag with the applicable one, or wraps the text and also replaces the tag
|
|
9
9
|
* @private
|
|
10
10
|
*/
|
|
11
11
|
export declare function wrap(commitStyle: ICommitStyle, font: HTMLElement, jodit: IJodit): HTMLElement;
|
|
12
|
+
export declare const WRAP_NODES: Set<HTMLTagNames>;
|