jodit 4.17.2 → 4.17.4
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 +12 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +5 -5
- package/es2015/jodit.js +60 -7
- package/es2015/jodit.min.js +10 -10
- 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 +5 -5
- 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 +60 -7
- 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 -1
- package/es2021.en/jodit.fat.min.js +6 -6
- package/es2021.en/jodit.js +60 -7
- 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 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +80 -7
- 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/helpers/html/safe-html.js +15 -0
- package/esm/jodit.js +5 -0
- package/esm/modules/file-browser/data-provider.d.ts +1 -0
- package/esm/modules/file-browser/data-provider.js +26 -5
- package/esm/plugins/clean-html/clean-html.d.ts +8 -0
- package/esm/plugins/clean-html/clean-html.js +13 -0
- package/package.json +1 -1
- package/types/modules/file-browser/data-provider.d.ts +1 -0
- package/types/plugins/clean-html/clean-html.d.ts +8 -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.17.
|
|
6
|
+
export const APP_VERSION = "4.17.4";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -60,6 +60,21 @@ export function safeHTML(box, options) {
|
|
|
60
60
|
Dom.safeRemove(elm);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
// `<noscript>` is parsed as markup in a document with scripting off (the
|
|
64
|
+
// inert document the value is sanitized in) and as raw text in one with
|
|
65
|
+
// scripting on (the live editor). The same serialized bytes therefore
|
|
66
|
+
// describe two different trees, and markup hidden as inert text in the
|
|
67
|
+
// first comes alive as elements in the second. The element has no use in
|
|
68
|
+
// editor content, so it goes, together with everything it carried.
|
|
69
|
+
const noscript = [];
|
|
70
|
+
Dom.each(box, node => {
|
|
71
|
+
if (Dom.isElement(node) && node.nodeName === 'NOSCRIPT') {
|
|
72
|
+
noscript.push(node);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
for (const elm of noscript) {
|
|
76
|
+
Dom.safeRemove(elm);
|
|
77
|
+
}
|
|
63
78
|
const removeEvents = (_a = options.removeEventAttributes) !== null && _a !== void 0 ? _a : options.removeOnError;
|
|
64
79
|
// Single synchronous traversal of the subtree. Besides removing event
|
|
65
80
|
// handlers and `javascript:` links, `sanitizeHTMLElement` neutralises
|
package/esm/jodit.js
CHANGED
|
@@ -333,6 +333,11 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
|
|
|
333
333
|
}
|
|
334
334
|
if (this.editor) {
|
|
335
335
|
this.editor.innerHTML = data.value;
|
|
336
|
+
// Fired synchronously, before any task can run: the value was
|
|
337
|
+
// sanitized in an inert document and re-parsed here with scripting
|
|
338
|
+
// on, and the two parsers do not always agree. Listeners get to
|
|
339
|
+
// look at the tree that actually exists.
|
|
340
|
+
this.e.fire('afterSetNativeEditorValue');
|
|
336
341
|
}
|
|
337
342
|
}
|
|
338
343
|
/**
|
|
@@ -27,6 +27,7 @@ export default class DataProvider implements IFileBrowserDataProvider {
|
|
|
27
27
|
*/
|
|
28
28
|
get o(): this['options'];
|
|
29
29
|
private __ajaxInstances;
|
|
30
|
+
private __requestSerial;
|
|
30
31
|
protected get<T extends IFileBrowserAnswer = IFileBrowserAnswer>(name: keyof IFileBrowserOptions): Promise<T>;
|
|
31
32
|
private progressHandler;
|
|
32
33
|
onProgress(callback: (percentage: number) => void): void;
|
|
@@ -77,12 +77,24 @@ export function assertSourcesAnswer(resp, action, option) {
|
|
|
77
77
|
});
|
|
78
78
|
return resp;
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Actions that only read from the connector. A newer request for one of them
|
|
82
|
+
* makes the older one pointless, so it is aborted; every other action changes
|
|
83
|
+
* server state and must be allowed to finish.
|
|
84
|
+
*/
|
|
85
|
+
const REPLACEABLE_ACTIONS = new Set([
|
|
86
|
+
'items',
|
|
87
|
+
'folder',
|
|
88
|
+
'permissions',
|
|
89
|
+
'getLocalFileByUrl'
|
|
90
|
+
]);
|
|
80
91
|
export default class DataProvider {
|
|
81
92
|
constructor(parent, options) {
|
|
82
93
|
this.parent = parent;
|
|
83
94
|
this.options = options;
|
|
84
95
|
this.__currentPermissions = null;
|
|
85
96
|
this.__ajaxInstances = new Map();
|
|
97
|
+
this.__requestSerial = 0;
|
|
86
98
|
this.progressHandler = (ignore) => { };
|
|
87
99
|
}
|
|
88
100
|
/**
|
|
@@ -93,10 +105,19 @@ export default class DataProvider {
|
|
|
93
105
|
}
|
|
94
106
|
get(name) {
|
|
95
107
|
const instances = this.__ajaxInstances;
|
|
96
|
-
|
|
97
|
-
|
|
108
|
+
// A listing asked for again supersedes the one still loading, so the
|
|
109
|
+
// earlier request is aborted. That must never happen to a request
|
|
110
|
+
// that changes something on the server: aborting it does not undo it,
|
|
111
|
+
// the caller just never hears the result. Removing several files at
|
|
112
|
+
// once used to send one `fileRemove` per file and abort all but the
|
|
113
|
+
// last, so only the last one was ever removed. Mutating requests get a
|
|
114
|
+
// key of their own and run side by side.
|
|
115
|
+
const replaceable = REPLACEABLE_ACTIONS.has(name);
|
|
116
|
+
const key = replaceable ? name : `${name}#${++this.__requestSerial}`;
|
|
117
|
+
if (replaceable && instances.has(key)) {
|
|
118
|
+
const ajax = instances.get(key);
|
|
98
119
|
ajax === null || ajax === void 0 ? void 0 : ajax.abort();
|
|
99
|
-
instances.delete(
|
|
120
|
+
instances.delete(key);
|
|
100
121
|
}
|
|
101
122
|
const opts = ConfigProto(this.options[name] !== undefined
|
|
102
123
|
? this.options[name]
|
|
@@ -107,12 +128,12 @@ export default class DataProvider {
|
|
|
107
128
|
opts.data = opts.prepareData.call(this, opts.data);
|
|
108
129
|
}
|
|
109
130
|
const ajax = new Ajax(opts);
|
|
110
|
-
instances.set(
|
|
131
|
+
instances.set(key, ajax);
|
|
111
132
|
const promise = ajax.send();
|
|
112
133
|
promise
|
|
113
134
|
.finally(() => {
|
|
114
135
|
ajax.destruct();
|
|
115
|
-
instances.delete(
|
|
136
|
+
instances.delete(key);
|
|
116
137
|
this.progressHandler(100);
|
|
117
138
|
})
|
|
118
139
|
.catch(() => null);
|
|
@@ -25,6 +25,14 @@ export declare class cleanHtml extends Plugin {
|
|
|
25
25
|
private walker;
|
|
26
26
|
protected startWalker(): void;
|
|
27
27
|
protected beforeCommand(command: string): void | false;
|
|
28
|
+
/**
|
|
29
|
+
* The value was sanitized in an inert document and has just been re-parsed
|
|
30
|
+
* into the live editor with scripting on. Where the two parsers disagree
|
|
31
|
+
* (`<noscript>`, raw-text elements), markup that was inert text a moment
|
|
32
|
+
* ago is a real element now, so the live tree is sanitized once more, in
|
|
33
|
+
* the same call stack, before any handler it might carry can fire.
|
|
34
|
+
*/
|
|
35
|
+
protected onAfterSetNativeEditorValue(): void;
|
|
28
36
|
/**
|
|
29
37
|
* Event handler when manually assigning a value to the HTML editor.
|
|
30
38
|
*/
|
|
@@ -81,6 +81,16 @@ export class cleanHtml extends Plugin {
|
|
|
81
81
|
return false;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* The value was sanitized in an inert document and has just been re-parsed
|
|
86
|
+
* into the live editor with scripting on. Where the two parsers disagree
|
|
87
|
+
* (`<noscript>`, raw-text elements), markup that was inert text a moment
|
|
88
|
+
* ago is a real element now, so the live tree is sanitized once more, in
|
|
89
|
+
* the same call stack, before any handler it might carry can fire.
|
|
90
|
+
*/
|
|
91
|
+
onAfterSetNativeEditorValue() {
|
|
92
|
+
safeHTML(this.j.editor, this.j.o.cleanHTML);
|
|
93
|
+
}
|
|
84
94
|
/**
|
|
85
95
|
* Event handler when manually assigning a value to the HTML editor.
|
|
86
96
|
*/
|
|
@@ -201,6 +211,9 @@ __decorate([
|
|
|
201
211
|
__decorate([
|
|
202
212
|
watch(':beforeCommand')
|
|
203
213
|
], cleanHtml.prototype, "beforeCommand", null);
|
|
214
|
+
__decorate([
|
|
215
|
+
watch(':afterSetNativeEditorValue')
|
|
216
|
+
], cleanHtml.prototype, "onAfterSetNativeEditorValue", null);
|
|
204
217
|
__decorate([
|
|
205
218
|
watch(':beforeSetNativeEditorValue')
|
|
206
219
|
], cleanHtml.prototype, "onBeforeSetNativeEditorValue", null);
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ export default class DataProvider implements IFileBrowserDataProvider {
|
|
|
27
27
|
*/
|
|
28
28
|
get o(): this['options'];
|
|
29
29
|
private __ajaxInstances;
|
|
30
|
+
private __requestSerial;
|
|
30
31
|
protected get<T extends IFileBrowserAnswer = IFileBrowserAnswer>(name: keyof IFileBrowserOptions): Promise<T>;
|
|
31
32
|
private progressHandler;
|
|
32
33
|
onProgress(callback: (percentage: number) => void): void;
|
|
@@ -25,6 +25,14 @@ export declare class cleanHtml extends Plugin {
|
|
|
25
25
|
private walker;
|
|
26
26
|
protected startWalker(): void;
|
|
27
27
|
protected beforeCommand(command: string): void | false;
|
|
28
|
+
/**
|
|
29
|
+
* The value was sanitized in an inert document and has just been re-parsed
|
|
30
|
+
* into the live editor with scripting on. Where the two parsers disagree
|
|
31
|
+
* (`<noscript>`, raw-text elements), markup that was inert text a moment
|
|
32
|
+
* ago is a real element now, so the live tree is sanitized once more, in
|
|
33
|
+
* the same call stack, before any handler it might carry can fire.
|
|
34
|
+
*/
|
|
35
|
+
protected onAfterSetNativeEditorValue(): void;
|
|
28
36
|
/**
|
|
29
37
|
* Event handler when manually assigning a value to the HTML editor.
|
|
30
38
|
*/
|