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.
Files changed (55) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +3 -3
  4. package/es2015/jodit.js +23 -7
  5. package/es2015/jodit.min.js +3 -3
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +3 -3
  13. package/es2018/jodit.min.js +3 -3
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +4 -4
  18. package/es2021/jodit.js +23 -7
  19. package/es2021/jodit.min.js +4 -4
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +4 -4
  28. package/es2021.en/jodit.js +23 -7
  29. package/es2021.en/jodit.min.js +4 -4
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +23 -7
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/core/constants.js +1 -1
  51. package/esm/core/helpers/html/safe-html.d.ts +1 -1
  52. package/esm/core/helpers/html/safe-html.js +8 -1
  53. package/esm/plugins/drag-and-drop/drag-and-drop.js +16 -4
  54. package/package.json +1 -1
  55. package/types/core/helpers/html/safe-html.d.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.17.0
4
+ * Version: v4.17.1
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.17.0
4
+ * Version: v4.17.1
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.17.0
4
+ * Version: v4.17.1
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.17.0
4
+ * Version: v4.17.1
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.17.0
4
+ * Version: v4.17.1
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.17.0
4
+ * Version: v4.17.1
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.17.0
4
+ * Version: v4.17.1
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
package/es5/polyfills.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.17.0
4
+ * Version: v4.17.1
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.17.0
4
+ * Version: v4.17.1
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.0";
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.on([window, this.j.ed, this.j.editor], 'dragstart.DragAndDrop', this.onDragStart);
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
- fragment = this.j.createInside.fromHTML(this.getText(event));
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.17.0",
3
+ "version": "4.17.1",
4
4
  "description": "Jodit is an awesome and useful wysiwyg editor with filebrowser",
5
5
  "main": "esm/index.js",
6
6
  "types": "types/index.d.ts",
@@ -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;