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
  */
@@ -1799,7 +1799,7 @@ __webpack_require__.r(__webpack_exports__);
1799
1799
  * ```
1800
1800
  * @packageDocumentation
1801
1801
  * @module constants
1802
- */ const APP_VERSION = "4.17.0";
1802
+ */ const APP_VERSION = "4.17.1";
1803
1803
  // prettier-ignore
1804
1804
  const ES = "es2021";
1805
1805
  const IS_ES_MODERN = true;
@@ -6281,7 +6281,7 @@ function isSmuggledForeignHtml(elm) {
6281
6281
  }
6282
6282
  return /^data:image\/svg/.test(normalized) && DOCUMENT_EMBED_TAGS.has(tagName);
6283
6283
  }
6284
- function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError } = {
6284
+ function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError, removeEventAttributes } = {
6285
6285
  safeJavaScriptLink: true,
6286
6286
  removeOnError: true
6287
6287
  }) {
@@ -6289,6 +6289,13 @@ function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError } = {
6289
6289
  return false;
6290
6290
  }
6291
6291
  let effected = false;
6292
+ // Every `on*` handler, not only `onerror`: the clean-html background
6293
+ // pass calls this directly, and markup that reached the editable area
6294
+ // without `safeHTML` (a drop, a script) kept its handlers otherwise.
6295
+ // See GHSA-jhhp-r3r7-v2cg
6296
+ if (removeEventAttributes && removeAllEventAttributes(elm)) {
6297
+ effected = true;
6298
+ }
6292
6299
  if (removeOnError && elm.hasAttribute('onerror')) {
6293
6300
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'onerror', null);
6294
6301
  effected = true;
@@ -30662,7 +30669,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
30662
30669
  window,
30663
30670
  this.j.ed,
30664
30671
  this.j.editor
30665
- ], 'dragstart.DragAndDrop', this.onDragStart);
30672
+ ], 'dragstart.DragAndDrop', this.onDragStart)// Always, not only after a `dragstart` seen in this window: a drop
30673
+ // from another window or application never produces one here, and
30674
+ // the browser then inserted its HTML natively, unsanitized. Routed
30675
+ // through the paste plugin instead. See GHSA-jhhp-r3r7-v2cg
30676
+ .on('drop.DragAndDrop', this.onDrop);
30666
30677
  }
30667
30678
  onDragStart(event) {
30668
30679
  let target = event.target;
@@ -30690,10 +30701,10 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
30690
30701
  this.addDragListeners();
30691
30702
  }
30692
30703
  addDragListeners() {
30693
- this.j.e.on('dragover', this.onDrag).on('drop.DragAndDrop', this.onDrop).on(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
30704
+ this.j.e.on('dragover', this.onDrag).on(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
30694
30705
  }
30695
30706
  removeDragListeners() {
30696
- this.j.e.off('dragover', this.onDrag).off('drop.DragAndDrop', this.onDrop).off(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
30707
+ this.j.e.off('dragover', this.onDrag).off(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
30697
30708
  }
30698
30709
  onDrag(event) {
30699
30710
  if (this.draggable) {
@@ -30755,7 +30766,12 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
30755
30766
  fragment = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.dataBind)(this.draggable, 'target');
30756
30767
  }
30757
30768
  } else if (this.getText(event)) {
30758
- fragment = this.j.createInside.fromHTML(this.getText(event));
30769
+ // Dropped markup takes the same sanitizing pass as pasted and
30770
+ // assigned content. See GHSA-jhhp-r3r7-v2cg
30771
+ const box = this.j.createInside.div();
30772
+ box.innerHTML = this.getText(event);
30773
+ this.j.e.fire('safeHTML', box);
30774
+ fragment = box.firstChild !== box.lastChild || !box.firstChild ? box : box.firstChild;
30759
30775
  }
30760
30776
  return fragment;
30761
30777
  }