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/es2015/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
  */
@@ -1805,7 +1805,7 @@ __webpack_require__.r(__webpack_exports__);
1805
1805
  * ```
1806
1806
  * @packageDocumentation
1807
1807
  * @module constants
1808
- */ const APP_VERSION = "4.17.0";
1808
+ */ const APP_VERSION = "4.17.1";
1809
1809
  // prettier-ignore
1810
1810
  const ES = "es2015";
1811
1811
  const IS_ES_MODERN = true;
@@ -6306,7 +6306,7 @@ function isSmuggledForeignHtml(elm) {
6306
6306
  }
6307
6307
  return /^data:image\/svg/.test(normalized) && DOCUMENT_EMBED_TAGS.has(tagName);
6308
6308
  }
6309
- function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError } = {
6309
+ function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError, removeEventAttributes } = {
6310
6310
  safeJavaScriptLink: true,
6311
6311
  removeOnError: true
6312
6312
  }) {
@@ -6314,6 +6314,13 @@ function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError } = {
6314
6314
  return false;
6315
6315
  }
6316
6316
  let effected = false;
6317
+ // Every `on*` handler, not only `onerror`: the clean-html background
6318
+ // pass calls this directly, and markup that reached the editable area
6319
+ // without `safeHTML` (a drop, a script) kept its handlers otherwise.
6320
+ // See GHSA-jhhp-r3r7-v2cg
6321
+ if (removeEventAttributes && removeAllEventAttributes(elm)) {
6322
+ effected = true;
6323
+ }
6317
6324
  if (removeOnError && elm.hasAttribute('onerror')) {
6318
6325
  (0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'onerror', null);
6319
6326
  effected = true;
@@ -31269,7 +31276,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
31269
31276
  window,
31270
31277
  this.j.ed,
31271
31278
  this.j.editor
31272
- ], 'dragstart.DragAndDrop', this.onDragStart);
31279
+ ], 'dragstart.DragAndDrop', this.onDragStart)// Always, not only after a `dragstart` seen in this window: a drop
31280
+ // from another window or application never produces one here, and
31281
+ // the browser then inserted its HTML natively, unsanitized. Routed
31282
+ // through the paste plugin instead. See GHSA-jhhp-r3r7-v2cg
31283
+ .on('drop.DragAndDrop', this.onDrop);
31273
31284
  }
31274
31285
  onDragStart(event) {
31275
31286
  let target = event.target;
@@ -31297,10 +31308,10 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
31297
31308
  this.addDragListeners();
31298
31309
  }
31299
31310
  addDragListeners() {
31300
- this.j.e.on('dragover', this.onDrag).on('drop.DragAndDrop', this.onDrop).on(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
31311
+ this.j.e.on('dragover', this.onDrag).on(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
31301
31312
  }
31302
31313
  removeDragListeners() {
31303
- this.j.e.off('dragover', this.onDrag).off('drop.DragAndDrop', this.onDrop).off(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
31314
+ this.j.e.off('dragover', this.onDrag).off(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
31304
31315
  }
31305
31316
  onDrag(event) {
31306
31317
  if (this.draggable) {
@@ -31362,7 +31373,12 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
31362
31373
  fragment = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.dataBind)(this.draggable, 'target');
31363
31374
  }
31364
31375
  } else if (this.getText(event)) {
31365
- fragment = this.j.createInside.fromHTML(this.getText(event));
31376
+ // Dropped markup takes the same sanitizing pass as pasted and
31377
+ // assigned content. See GHSA-jhhp-r3r7-v2cg
31378
+ const box = this.j.createInside.div();
31379
+ box.innerHTML = this.getText(event);
31380
+ this.j.e.fire('safeHTML', box);
31381
+ fragment = box.firstChild !== box.lastChild || !box.firstChild ? box : box.firstChild;
31366
31382
  }
31367
31383
  return fragment;
31368
31384
  }