jodit 4.13.21 → 4.13.23

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 (66) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +4 -4
  5. package/es2015/jodit.js +29 -34
  6. package/es2015/jodit.min.css +1 -1
  7. package/es2015/jodit.min.js +4 -4
  8. package/es2015/plugins/debug/debug.css +1 -1
  9. package/es2015/plugins/debug/debug.js +1 -1
  10. package/es2015/plugins/debug/debug.min.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  12. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  13. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  14. package/es2018/jodit.fat.min.css +1 -1
  15. package/es2018/jodit.fat.min.js +4 -4
  16. package/es2018/jodit.min.css +1 -1
  17. package/es2018/jodit.min.js +4 -4
  18. package/es2018/plugins/debug/debug.min.js +1 -1
  19. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  20. package/es2021/jodit.css +1 -1
  21. package/es2021/jodit.fat.min.css +1 -1
  22. package/es2021/jodit.fat.min.js +4 -4
  23. package/es2021/jodit.js +27 -34
  24. package/es2021/jodit.min.css +1 -1
  25. package/es2021/jodit.min.js +4 -4
  26. package/es2021/plugins/debug/debug.css +1 -1
  27. package/es2021/plugins/debug/debug.js +1 -1
  28. package/es2021/plugins/debug/debug.min.js +1 -1
  29. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  30. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  31. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  32. package/es2021.en/jodit.css +1 -1
  33. package/es2021.en/jodit.fat.min.css +1 -1
  34. package/es2021.en/jodit.fat.min.js +4 -4
  35. package/es2021.en/jodit.js +27 -34
  36. package/es2021.en/jodit.min.css +1 -1
  37. package/es2021.en/jodit.min.js +4 -4
  38. package/es2021.en/plugins/debug/debug.css +1 -1
  39. package/es2021.en/plugins/debug/debug.js +1 -1
  40. package/es2021.en/plugins/debug/debug.min.js +1 -1
  41. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  42. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  43. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  44. package/es5/jodit.css +2 -2
  45. package/es5/jodit.fat.min.css +1 -1
  46. package/es5/jodit.fat.min.js +2 -2
  47. package/es5/jodit.js +55 -34
  48. package/es5/jodit.min.css +3 -3
  49. package/es5/jodit.min.js +2 -2
  50. package/es5/plugins/debug/debug.css +1 -1
  51. package/es5/plugins/debug/debug.js +1 -1
  52. package/es5/plugins/debug/debug.min.js +1 -1
  53. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  54. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  55. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  56. package/es5/polyfills.fat.min.js +2 -2
  57. package/es5/polyfills.js +213 -87
  58. package/es5/polyfills.min.js +2 -2
  59. package/esm/core/constants.js +1 -1
  60. package/esm/modules/uploader/helpers/data-uri-to-blob.d.ts +3 -1
  61. package/esm/modules/uploader/helpers/data-uri-to-blob.js +7 -8
  62. package/esm/plugins/clean-html/helpers/visitor/filters/remove-empty-text-node.js +7 -1
  63. package/esm/plugins/clean-html/helpers/visitor/filters/remove-inv-text-nodes.js +4 -1
  64. package/esm/plugins/image-processor/image-processor.js +11 -19
  65. package/package.json +1 -1
  66. package/types/modules/uploader/helpers/data-uri-to-blob.d.ts +3 -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.13.21
4
+ * Version: v4.13.23
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1849,7 +1849,7 @@ __webpack_require__.r(__webpack_exports__);
1849
1849
  * ```
1850
1850
  * @packageDocumentation
1851
1851
  * @module constants
1852
- */ const APP_VERSION = "4.13.21";
1852
+ */ const APP_VERSION = "4.13.23";
1853
1853
  // prettier-ignore
1854
1854
  const ES = "es2015";
1855
1855
  const IS_ES_MODERN = true;
@@ -25003,13 +25003,13 @@ function buildData(uploader, data) {
25003
25003
  */ /**
25004
25004
  * @module modules/uploader
25005
25005
  */ /**
25006
- * Convert dataURI to Blob
25006
+ * Convert dataURI to Blob. Both base64 and percent-encoded payloads are
25007
+ * supported — `data:image/svg+xml,%3Csvg...` is as valid as
25008
+ * `data:image/png;base64,...`
25007
25009
  */ function dataURItoBlob(dataURI) {
25008
- // convert base64 to raw binary data held in a string
25009
- // doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
25010
- const byteString = atob(dataURI.split(',')[1]), // separate out the mime component
25011
- mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0], // write the bytes of the string to an ArrayBuffer
25012
- ab = new ArrayBuffer(byteString.length), ia = new Uint8Array(ab);
25010
+ var _ref;
25011
+ var _header_split_;
25012
+ const [header, ...rest] = dataURI.split(','), payload = rest.join(','), mimeString = (_ref = (_header_split_ = header.split(':')[1]) === null || _header_split_ === void 0 ? void 0 : _header_split_.split(';')[0]) !== null && _ref !== void 0 ? _ref : '', byteString = /;base64/i.test(header) ? atob(payload) : decodeURIComponent(payload), ab = new ArrayBuffer(byteString.length), ia = new Uint8Array(ab);
25013
25013
  for(let i = 0; i < byteString.length; i += 1){
25014
25014
  ia[i] = byteString.charCodeAt(i);
25015
25015
  }
@@ -28683,7 +28683,11 @@ __webpack_require__.r(__webpack_exports__);
28683
28683
  * @private
28684
28684
  */ function removeEmptyTextNode(jodit, node, hadEffect, arg, argi, currentNode) {
28685
28685
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isText(node) && !node.nodeValue) {
28686
- if (node === currentNode && jodit.s.isCollapsed()) {
28686
+ // Restore the caret only while the editor owns focus. The walker runs
28687
+ // asynchronously, so the user may have already tabbed away — moving the
28688
+ // selection here would call `focus()` and steal focus back from the
28689
+ // element the user navigated to (e.g. Shift+Tab accessibility flow).
28690
+ if (node === currentNode && jodit.s.isFocused() && jodit.s.isCollapsed()) {
28687
28691
  jodit.s.setCursorAfter(node);
28688
28692
  }
28689
28693
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.safeRemove(node);
@@ -28726,7 +28730,10 @@ __webpack_require__.r(__webpack_exports__);
28726
28730
  return hadEffect;
28727
28731
  }
28728
28732
  node.nodeValue = node.nodeValue.replace((0,jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INVISIBLE_SPACE_REG_EXP)(), '');
28729
- if (node === currentNode && jodit.s.isCollapsed()) {
28733
+ // Same guard as in `removeEmptyTextNode`: the walker is asynchronous, so
28734
+ // never move the selection (it re-focuses the editor) once the user has
28735
+ // moved focus elsewhere.
28736
+ if (node === currentNode && jodit.s.isFocused() && jodit.s.isCollapsed()) {
28730
28737
  jodit.s.setCursorAfter(node);
28731
28738
  }
28732
28739
  if (!node.nodeValue) {
@@ -32526,7 +32533,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
32526
32533
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
32527
32534
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
32528
32535
  /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
32529
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(51034);
32536
+ /* harmony import */ var jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(23112);
32537
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(51034);
32530
32538
  /*!
32531
32539
  * Jodit Editor (https://xdsoft.net/jodit/)
32532
32540
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -32543,6 +32551,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
32543
32551
 
32544
32552
 
32545
32553
 
32554
+
32546
32555
  const JODIT_IMAGE_PROCESSOR_BINDED = '__jodit_imageprocessor_binded';
32547
32556
  const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
32548
32557
  /**
@@ -32628,7 +32637,15 @@ function replaceDataURIToBlobUUID(editor, elm) {
32628
32637
  if (typeof ArrayBuffer === 'undefined' || typeof URL === 'undefined') {
32629
32638
  return;
32630
32639
  }
32631
- const dataUri = elm.src, blob = dataURItoBlob(dataUri);
32640
+ const dataUri = elm.src;
32641
+ let blob;
32642
+ try {
32643
+ blob = (0,jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_7__.dataURItoBlob)(dataUri);
32644
+ } catch (unused) {
32645
+ // A data URI the browser accepts but we cannot decode is not worth
32646
+ // breaking the editor over — keep the image as it is
32647
+ return;
32648
+ }
32632
32649
  elm.src = URL.createObjectURL(blob);
32633
32650
  editor.e.fire('internalUpdate');
32634
32651
  const { buffer } = editor;
@@ -32636,28 +32653,6 @@ function replaceDataURIToBlobUUID(editor, elm) {
32636
32653
  list[elm.src] = dataUri;
32637
32654
  editor.buffer.set(JODIT_IMAGE_BLOB_ID, list);
32638
32655
  }
32639
- // https://stackoverflow.com/a/12300351
32640
- function dataURItoBlob(dataURI) {
32641
- // convert base64 to raw binary data held in a string
32642
- // doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
32643
- const byteString = atob(dataURI.split(',')[1]);
32644
- // separate out the mime component
32645
- const mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
32646
- // write the bytes of the string to an ArrayBuffer
32647
- const ab = new ArrayBuffer(byteString.length);
32648
- // create a view into the buffer
32649
- const ia = new Uint8Array(ab);
32650
- // set the bytes of the buffer to the correct values
32651
- for(let i = 0; i < byteString.length; i++){
32652
- ia[i] = byteString.charCodeAt(i);
32653
- }
32654
- // write the ArrayBuffer to a blob, and you're done
32655
- return new Blob([
32656
- ab
32657
- ], {
32658
- type: mimeString
32659
- });
32660
- }
32661
32656
  jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProcessor', imageProcessor);
32662
32657
 
32663
32658