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
package/es2021/jodit.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
  */
@@ -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;
@@ -31049,7 +31056,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
31049
31056
  window,
31050
31057
  this.j.ed,
31051
31058
  this.j.editor
31052
- ], 'dragstart.DragAndDrop', this.onDragStart);
31059
+ ], 'dragstart.DragAndDrop', this.onDragStart)// Always, not only after a `dragstart` seen in this window: a drop
31060
+ // from another window or application never produces one here, and
31061
+ // the browser then inserted its HTML natively, unsanitized. Routed
31062
+ // through the paste plugin instead. See GHSA-jhhp-r3r7-v2cg
31063
+ .on('drop.DragAndDrop', this.onDrop);
31053
31064
  }
31054
31065
  onDragStart(event) {
31055
31066
  let target = event.target;
@@ -31077,10 +31088,10 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
31077
31088
  this.addDragListeners();
31078
31089
  }
31079
31090
  addDragListeners() {
31080
- this.j.e.on('dragover', this.onDrag).on('drop.DragAndDrop', this.onDrop).on(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
31091
+ this.j.e.on('dragover', this.onDrag).on(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
31081
31092
  }
31082
31093
  removeDragListeners() {
31083
- this.j.e.off('dragover', this.onDrag).off('drop.DragAndDrop', this.onDrop).off(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
31094
+ this.j.e.off('dragover', this.onDrag).off(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
31084
31095
  }
31085
31096
  onDrag(event) {
31086
31097
  if (this.draggable) {
@@ -31142,7 +31153,12 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
31142
31153
  fragment = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.dataBind)(this.draggable, 'target');
31143
31154
  }
31144
31155
  } else if (this.getText(event)) {
31145
- fragment = this.j.createInside.fromHTML(this.getText(event));
31156
+ // Dropped markup takes the same sanitizing pass as pasted and
31157
+ // assigned content. See GHSA-jhhp-r3r7-v2cg
31158
+ const box = this.j.createInside.div();
31159
+ box.innerHTML = this.getText(event);
31160
+ this.j.e.fire('safeHTML', box);
31161
+ fragment = box.firstChild !== box.lastChild || !box.firstChild ? box : box.firstChild;
31146
31162
  }
31147
31163
  return fragment;
31148
31164
  }