jodit 4.15.7 → 4.15.9
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 +13 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +5 -5
- package/es2015/jodit.js +65 -31
- package/es2015/jodit.min.js +6 -6
- 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 +5 -5
- package/es2018/jodit.min.js +6 -6
- 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 +6 -6
- package/es2021/jodit.js +64 -30
- package/es2021/jodit.min.js +7 -7
- 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 +6 -6
- package/es2021.en/jodit.js +64 -30
- package/es2021.en/jodit.min.js +7 -7
- 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 +65 -31
- 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/config.d.ts +2 -1
- package/esm/core/constants.js +1 -1
- package/esm/jodit.d.ts +6 -0
- package/esm/jodit.js +9 -2
- package/esm/plugins/clean-html/config.d.ts +2 -1
- package/esm/plugins/clean-html/helpers/visitor/filters/try-remove-node.js +10 -0
- package/esm/plugins/mobile/mobile.js +25 -4
- package/package.json +1 -1
- package/types/config.d.ts +2 -1
- package/types/jodit.d.ts +6 -0
- package/types/plugins/clean-html/config.d.ts +2 -1
package/es5/polyfills.fat.min.js
CHANGED
package/es5/polyfills.js
CHANGED
package/es5/polyfills.min.js
CHANGED
package/esm/config.d.ts
CHANGED
|
@@ -1021,7 +1021,8 @@ interface Config {
|
|
|
1021
1021
|
*/
|
|
1022
1022
|
fillEmptyParagraph: boolean;
|
|
1023
1023
|
/**
|
|
1024
|
-
* Remove empty elements
|
|
1024
|
+
* Remove empty inline elements. Elements that in-page links can point
|
|
1025
|
+
* at (anything with an `id`, and `<a>` with a `name`) are kept.
|
|
1025
1026
|
*/
|
|
1026
1027
|
removeEmptyElements: boolean;
|
|
1027
1028
|
/**
|
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.15.
|
|
6
|
+
export const APP_VERSION = "4.15.9";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
package/esm/jodit.d.ts
CHANGED
|
@@ -242,6 +242,12 @@ export declare class Jodit extends ViewWithToolbar implements IJodit, Dlgs {
|
|
|
242
242
|
* If some plugin changes the DOM directly, then you need to update the content of the original element
|
|
243
243
|
*/
|
|
244
244
|
protected updateElementValue(): void;
|
|
245
|
+
/**
|
|
246
|
+
* In inline mode the source element is the editor container, so its
|
|
247
|
+
* `innerHTML` is the editor's own markup rather than the value. Keep the
|
|
248
|
+
* value last synchronised to it here instead.
|
|
249
|
+
*/
|
|
250
|
+
private __inlineElementValue;
|
|
245
251
|
/**
|
|
246
252
|
* Return source element value
|
|
247
253
|
*/
|
package/esm/jodit.js
CHANGED
|
@@ -468,6 +468,10 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
|
|
|
468
468
|
* Return source element value
|
|
469
469
|
*/
|
|
470
470
|
getElementValue() {
|
|
471
|
+
if (this.element === this.container &&
|
|
472
|
+
this.__inlineElementValue !== undefined) {
|
|
473
|
+
return this.__inlineElementValue;
|
|
474
|
+
}
|
|
471
475
|
return this.element.value !== undefined
|
|
472
476
|
? this.element.value
|
|
473
477
|
: this.element.innerHTML;
|
|
@@ -476,8 +480,11 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
|
|
|
476
480
|
if (!isString(value)) {
|
|
477
481
|
throw error('value must be string');
|
|
478
482
|
}
|
|
479
|
-
if (this.element
|
|
480
|
-
|
|
483
|
+
if (this.element === this.container) {
|
|
484
|
+
this.__inlineElementValue = value;
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
if (value !== this.getElementValue()) {
|
|
481
488
|
const data = { value };
|
|
482
489
|
const res = this.e.fire('beforeSetElementValue', data);
|
|
483
490
|
callPromise(res, () => {
|
|
@@ -20,7 +20,8 @@ declare module 'jodit/config' {
|
|
|
20
20
|
*/
|
|
21
21
|
fillEmptyParagraph: boolean;
|
|
22
22
|
/**
|
|
23
|
-
* Remove empty elements
|
|
23
|
+
* Remove empty inline elements. Elements that in-page links can point
|
|
24
|
+
* at (anything with an `id`, and `<a>` with a `name`) are kept.
|
|
24
25
|
*/
|
|
25
26
|
removeEmptyElements: boolean;
|
|
26
27
|
/**
|
|
@@ -55,7 +55,17 @@ function isRemovableNode(jodit, node, current, allow, deny) {
|
|
|
55
55
|
return (Dom.isElement(node) &&
|
|
56
56
|
node.nodeName.match(IS_INLINE) != null &&
|
|
57
57
|
!Dom.isTemporary(node) &&
|
|
58
|
+
!isFragmentTarget(node) &&
|
|
58
59
|
trimInv(node.innerHTML).length === 0 &&
|
|
59
60
|
(current == null || !Dom.isOrContains(node, current)) &&
|
|
60
61
|
(liveCaret == null || !Dom.isOrContains(node, liveCaret)));
|
|
61
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* An element with an `id`, or an `<a>` with a `name`, is where an in-page link
|
|
65
|
+
* (`#fragment`) lands. It is usually empty (`<a name="top"></a>`), and removing
|
|
66
|
+
* it silently breaks every link that points at it.
|
|
67
|
+
*/
|
|
68
|
+
function isFragmentTarget(element) {
|
|
69
|
+
return (element.hasAttribute('id') ||
|
|
70
|
+
(element.nodeName === 'A' && element.hasAttribute('name')));
|
|
71
|
+
}
|
|
@@ -3,8 +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 { Dom } from "../../core/dom/dom.js";
|
|
6
7
|
import { pluginSystem } from "../../core/global.js";
|
|
7
8
|
import { splitArray, toArray } from "../../core/helpers/index.js";
|
|
9
|
+
import { isString } from "../../core/helpers/checker/is-string.js";
|
|
8
10
|
import { flatButtonsSet, isButtonGroup } from "../../core/ui/helpers/buttons.js";
|
|
9
11
|
import "./config.js";
|
|
10
12
|
const isButtonSeparator = (item) => item === '|' || item === '---' || item === '\n';
|
|
@@ -75,6 +77,22 @@ function fitToButtons(list, editor) {
|
|
|
75
77
|
}
|
|
76
78
|
return cleaned;
|
|
77
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* The width that decides which breakpoint set the toolbar uses. A toolbar
|
|
82
|
+
* rendered into an external container (`toolbar` set to an element or a
|
|
83
|
+
* selector) lays out in that container, so its width is what matters there.
|
|
84
|
+
*/
|
|
85
|
+
function adaptiveWidth(editor) {
|
|
86
|
+
var _a;
|
|
87
|
+
const { toolbar } = editor.o;
|
|
88
|
+
if (isString(toolbar) || Dom.isHTMLElement(toolbar)) {
|
|
89
|
+
const width = editor.toolbarContainer.offsetWidth;
|
|
90
|
+
if (width) {
|
|
91
|
+
return width;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return ((_a = editor.container.parentElement) !== null && _a !== void 0 ? _a : editor.container).offsetWidth;
|
|
95
|
+
}
|
|
78
96
|
/**
|
|
79
97
|
* Rebuild toolbar in depends on editor's width
|
|
80
98
|
*/
|
|
@@ -108,13 +126,16 @@ export function mobile(editor) {
|
|
|
108
126
|
if (editor.o.toolbarAdaptive) {
|
|
109
127
|
editor.e
|
|
110
128
|
.on('resize afterInit recalcAdaptive changePlace afterAddPlace', () => {
|
|
111
|
-
var _a
|
|
129
|
+
var _a;
|
|
112
130
|
if (!editor.o.toolbar) {
|
|
113
131
|
return;
|
|
114
132
|
}
|
|
115
|
-
const width = ((_a = editor.container.parentElement) !== null && _a !== void 0 ? _a : editor.container).offsetWidth;
|
|
116
133
|
const newStore = (() => {
|
|
117
|
-
if (editor.isFullSize
|
|
134
|
+
if (editor.isFullSize) {
|
|
135
|
+
return splitArray(editor.o.buttons);
|
|
136
|
+
}
|
|
137
|
+
const width = adaptiveWidth(editor);
|
|
138
|
+
if (width >= editor.o.sizeLG) {
|
|
118
139
|
return splitArray(editor.o.buttons);
|
|
119
140
|
}
|
|
120
141
|
if (width >= editor.o.sizeMD) {
|
|
@@ -128,7 +149,7 @@ export function mobile(editor) {
|
|
|
128
149
|
if (newStore.toString() !== store.toString()) {
|
|
129
150
|
store = newStore;
|
|
130
151
|
editor.e.fire('closeAllPopups');
|
|
131
|
-
(
|
|
152
|
+
(_a = editor.toolbar) === null || _a === void 0 ? void 0 : _a.setRemoveButtons(editor.o.removeButtons).build(store.concat(editor.o.extraButtons));
|
|
132
153
|
}
|
|
133
154
|
})
|
|
134
155
|
.on(editor.ow, 'load resize', () => editor.e.fire('recalcAdaptive'));
|
package/package.json
CHANGED
package/types/config.d.ts
CHANGED
|
@@ -1021,7 +1021,8 @@ interface Config {
|
|
|
1021
1021
|
*/
|
|
1022
1022
|
fillEmptyParagraph: boolean;
|
|
1023
1023
|
/**
|
|
1024
|
-
* Remove empty elements
|
|
1024
|
+
* Remove empty inline elements. Elements that in-page links can point
|
|
1025
|
+
* at (anything with an `id`, and `<a>` with a `name`) are kept.
|
|
1025
1026
|
*/
|
|
1026
1027
|
removeEmptyElements: boolean;
|
|
1027
1028
|
/**
|
package/types/jodit.d.ts
CHANGED
|
@@ -242,6 +242,12 @@ export declare class Jodit extends ViewWithToolbar implements IJodit, Dlgs {
|
|
|
242
242
|
* If some plugin changes the DOM directly, then you need to update the content of the original element
|
|
243
243
|
*/
|
|
244
244
|
protected updateElementValue(): void;
|
|
245
|
+
/**
|
|
246
|
+
* In inline mode the source element is the editor container, so its
|
|
247
|
+
* `innerHTML` is the editor's own markup rather than the value. Keep the
|
|
248
|
+
* value last synchronised to it here instead.
|
|
249
|
+
*/
|
|
250
|
+
private __inlineElementValue;
|
|
245
251
|
/**
|
|
246
252
|
* Return source element value
|
|
247
253
|
*/
|
|
@@ -20,7 +20,8 @@ declare module 'jodit/config' {
|
|
|
20
20
|
*/
|
|
21
21
|
fillEmptyParagraph: boolean;
|
|
22
22
|
/**
|
|
23
|
-
* Remove empty elements
|
|
23
|
+
* Remove empty inline elements. Elements that in-page links can point
|
|
24
|
+
* at (anything with an `id`, and `<a>` with a `name`) are kept.
|
|
24
25
|
*/
|
|
25
26
|
removeEmptyElements: boolean;
|
|
26
27
|
/**
|