jodit 4.17.0 → 4.17.1
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 +3 -3
- package/es2015/jodit.js +23 -7
- package/es2015/jodit.min.js +3 -3
- 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 +3 -3
- package/es2018/jodit.min.js +3 -3
- 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 +4 -4
- package/es2021/jodit.js +23 -7
- package/es2021/jodit.min.js +4 -4
- 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 +4 -4
- package/es2021.en/jodit.js +23 -7
- package/es2021.en/jodit.min.js +4 -4
- 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 +23 -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.d.ts +1 -1
- package/esm/core/helpers/html/safe-html.js +8 -1
- package/esm/plugins/drag-and-drop/drag-and-drop.js +16 -4
- package/package.json +1 -1
- package/types/core/helpers/html/safe-html.d.ts +1 -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.17.
|
|
6
|
+
export const APP_VERSION = "4.17.1";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -13,4 +13,4 @@ export type safeOptions = {
|
|
|
13
13
|
* Removes dangerous constructs from HTML
|
|
14
14
|
*/
|
|
15
15
|
export declare function safeHTML(box: HTMLElement | DocumentFragment, options: safeOptions): void;
|
|
16
|
-
export declare function sanitizeHTMLElement(elm: Element | DocumentFragment, { safeJavaScriptLink, removeOnError }?: safeOptions): boolean;
|
|
16
|
+
export declare function sanitizeHTMLElement(elm: Element | DocumentFragment, { safeJavaScriptLink, removeOnError, removeEventAttributes }?: safeOptions): boolean;
|
|
@@ -145,7 +145,7 @@ function isDangerousUrl(value, tagName) {
|
|
|
145
145
|
}
|
|
146
146
|
return (/^data:image\/svg/.test(normalized) && DOCUMENT_EMBED_TAGS.has(tagName));
|
|
147
147
|
}
|
|
148
|
-
export function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError } = {
|
|
148
|
+
export function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError, removeEventAttributes } = {
|
|
149
149
|
safeJavaScriptLink: true,
|
|
150
150
|
removeOnError: true
|
|
151
151
|
}) {
|
|
@@ -153,6 +153,13 @@ export function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError } =
|
|
|
153
153
|
return false;
|
|
154
154
|
}
|
|
155
155
|
let effected = false;
|
|
156
|
+
// Every `on*` handler, not only `onerror`: the clean-html background
|
|
157
|
+
// pass calls this directly, and markup that reached the editable area
|
|
158
|
+
// without `safeHTML` (a drop, a script) kept its handlers otherwise.
|
|
159
|
+
// See GHSA-jhhp-r3r7-v2cg
|
|
160
|
+
if (removeEventAttributes && removeAllEventAttributes(elm)) {
|
|
161
|
+
effected = true;
|
|
162
|
+
}
|
|
156
163
|
if (removeOnError && elm.hasAttribute('onerror')) {
|
|
157
164
|
attr(elm, 'onerror', null);
|
|
158
165
|
effected = true;
|
|
@@ -38,7 +38,13 @@ export class dragAndDrop extends Plugin {
|
|
|
38
38
|
}
|
|
39
39
|
/** @override */
|
|
40
40
|
afterInit() {
|
|
41
|
-
this.j.e
|
|
41
|
+
this.j.e
|
|
42
|
+
.on([window, this.j.ed, this.j.editor], 'dragstart.DragAndDrop', this.onDragStart)
|
|
43
|
+
// Always, not only after a `dragstart` seen in this window: a drop
|
|
44
|
+
// from another window or application never produces one here, and
|
|
45
|
+
// the browser then inserted its HTML natively, unsanitized. Routed
|
|
46
|
+
// through the paste plugin instead. See GHSA-jhhp-r3r7-v2cg
|
|
47
|
+
.on('drop.DragAndDrop', this.onDrop);
|
|
42
48
|
}
|
|
43
49
|
onDragStart(event) {
|
|
44
50
|
let target = event.target;
|
|
@@ -69,13 +75,11 @@ export class dragAndDrop extends Plugin {
|
|
|
69
75
|
addDragListeners() {
|
|
70
76
|
this.j.e
|
|
71
77
|
.on('dragover', this.onDrag)
|
|
72
|
-
.on('drop.DragAndDrop', this.onDrop)
|
|
73
78
|
.on(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
|
|
74
79
|
}
|
|
75
80
|
removeDragListeners() {
|
|
76
81
|
this.j.e
|
|
77
82
|
.off('dragover', this.onDrag)
|
|
78
|
-
.off('drop.DragAndDrop', this.onDrop)
|
|
79
83
|
.off(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
|
|
80
84
|
}
|
|
81
85
|
onDrag(event) {
|
|
@@ -144,7 +148,15 @@ export class dragAndDrop extends Plugin {
|
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
else if (this.getText(event)) {
|
|
147
|
-
|
|
151
|
+
// Dropped markup takes the same sanitizing pass as pasted and
|
|
152
|
+
// assigned content. See GHSA-jhhp-r3r7-v2cg
|
|
153
|
+
const box = this.j.createInside.div();
|
|
154
|
+
box.innerHTML = this.getText(event);
|
|
155
|
+
this.j.e.fire('safeHTML', box);
|
|
156
|
+
fragment =
|
|
157
|
+
box.firstChild !== box.lastChild || !box.firstChild
|
|
158
|
+
? box
|
|
159
|
+
: box.firstChild;
|
|
148
160
|
}
|
|
149
161
|
return fragment;
|
|
150
162
|
}
|
package/package.json
CHANGED
|
@@ -13,4 +13,4 @@ export type safeOptions = {
|
|
|
13
13
|
* Removes dangerous constructs from HTML
|
|
14
14
|
*/
|
|
15
15
|
export declare function safeHTML(box: HTMLElement | DocumentFragment, options: safeOptions): void;
|
|
16
|
-
export declare function sanitizeHTMLElement(elm: Element | DocumentFragment, { safeJavaScriptLink, removeOnError }?: safeOptions): boolean;
|
|
16
|
+
export declare function sanitizeHTMLElement(elm: Element | DocumentFragment, { safeJavaScriptLink, removeOnError, removeEventAttributes }?: safeOptions): boolean;
|