jodit 4.13.20 → 4.13.22

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 (65) 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 +27 -33
  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 +5 -5
  23. package/es2021/jodit.js +25 -33
  24. package/es2021/jodit.min.css +1 -1
  25. package/es2021/jodit.min.js +5 -5
  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 +5 -5
  35. package/es2021.en/jodit.js +25 -33
  36. package/es2021.en/jodit.min.css +1 -1
  37. package/es2021.en/jodit.min.js +5 -5
  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 +53 -33
  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/core/helpers/utils/scroll-into-view.js +5 -1
  61. package/esm/modules/uploader/helpers/data-uri-to-blob.d.ts +3 -1
  62. package/esm/modules/uploader/helpers/data-uri-to-blob.js +7 -8
  63. package/esm/plugins/image-processor/image-processor.js +11 -19
  64. package/package.json +1 -1
  65. package/types/modules/uploader/helpers/data-uri-to-blob.d.ts +3 -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.13.20
4
+ * Version: v4.13.22
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1843,7 +1843,7 @@ __webpack_require__.r(__webpack_exports__);
1843
1843
  * ```
1844
1844
  * @packageDocumentation
1845
1845
  * @module constants
1846
- */ const APP_VERSION = "4.13.20";
1846
+ */ const APP_VERSION = "4.13.22";
1847
1847
  // prettier-ignore
1848
1848
  const ES = "es2021";
1849
1849
  const IS_ES_MODERN = true;
@@ -9108,7 +9108,13 @@ const map = {};
9108
9108
  root.scrollTop = root.scrollTop < alignBottom ? alignBottom : elm.offsetTop;
9109
9109
  }
9110
9110
  if (!inView(elm, root, doc)) {
9111
- elm.scrollIntoView();
9111
+ // `block: 'nearest'` scrolls the page the minimal distance (one
9112
+ // line while typing), while the default `block: 'start'` aligns
9113
+ // the element to the viewport top and the page jumps like
9114
+ // PageDown was pressed
9115
+ elm.scrollIntoView({
9116
+ block: 'nearest'
9117
+ });
9112
9118
  }
9113
9119
  }
9114
9120
  }
@@ -24778,13 +24784,11 @@ function buildData(uploader, data) {
24778
24784
  */ /**
24779
24785
  * @module modules/uploader
24780
24786
  */ /**
24781
- * Convert dataURI to Blob
24787
+ * Convert dataURI to Blob. Both base64 and percent-encoded payloads are
24788
+ * supported — `data:image/svg+xml,%3Csvg...` is as valid as
24789
+ * `data:image/png;base64,...`
24782
24790
  */ function dataURItoBlob(dataURI) {
24783
- // convert base64 to raw binary data held in a string
24784
- // doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
24785
- const byteString = atob(dataURI.split(',')[1]), // separate out the mime component
24786
- mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0], // write the bytes of the string to an ArrayBuffer
24787
- ab = new ArrayBuffer(byteString.length), ia = new Uint8Array(ab);
24791
+ const [header, ...rest] = dataURI.split(','), payload = rest.join(','), mimeString = header.split(':')[1]?.split(';')[0] ?? '', byteString = /;base64/i.test(header) ? atob(payload) : decodeURIComponent(payload), ab = new ArrayBuffer(byteString.length), ia = new Uint8Array(ab);
24788
24792
  for(let i = 0; i < byteString.length; i += 1){
24789
24793
  ia[i] = byteString.charCodeAt(i);
24790
24794
  }
@@ -31885,7 +31889,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
31885
31889
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28077);
31886
31890
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
31887
31891
  /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(91206);
31888
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(51034);
31892
+ /* harmony import */ var jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(23112);
31893
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(51034);
31889
31894
  /*!
31890
31895
  * Jodit Editor (https://xdsoft.net/jodit/)
31891
31896
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -31901,6 +31906,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
31901
31906
 
31902
31907
 
31903
31908
 
31909
+
31904
31910
  const JODIT_IMAGE_PROCESSOR_BINDED = '__jodit_imageprocessor_binded';
31905
31911
  const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
31906
31912
  /**
@@ -31983,7 +31989,15 @@ function replaceDataURIToBlobUUID(editor, elm) {
31983
31989
  if (typeof ArrayBuffer === 'undefined' || typeof URL === 'undefined') {
31984
31990
  return;
31985
31991
  }
31986
- const dataUri = elm.src, blob = dataURItoBlob(dataUri);
31992
+ const dataUri = elm.src;
31993
+ let blob;
31994
+ try {
31995
+ blob = (0,jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_6__.dataURItoBlob)(dataUri);
31996
+ } catch {
31997
+ // A data URI the browser accepts but we cannot decode is not worth
31998
+ // breaking the editor over — keep the image as it is
31999
+ return;
32000
+ }
31987
32001
  elm.src = URL.createObjectURL(blob);
31988
32002
  editor.e.fire('internalUpdate');
31989
32003
  const { buffer } = editor;
@@ -31991,28 +32005,6 @@ function replaceDataURIToBlobUUID(editor, elm) {
31991
32005
  list[elm.src] = dataUri;
31992
32006
  editor.buffer.set(JODIT_IMAGE_BLOB_ID, list);
31993
32007
  }
31994
- // https://stackoverflow.com/a/12300351
31995
- function dataURItoBlob(dataURI) {
31996
- // convert base64 to raw binary data held in a string
31997
- // doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
31998
- const byteString = atob(dataURI.split(',')[1]);
31999
- // separate out the mime component
32000
- const mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
32001
- // write the bytes of the string to an ArrayBuffer
32002
- const ab = new ArrayBuffer(byteString.length);
32003
- // create a view into the buffer
32004
- const ia = new Uint8Array(ab);
32005
- // set the bytes of the buffer to the correct values
32006
- for(let i = 0; i < byteString.length; i++){
32007
- ia[i] = byteString.charCodeAt(i);
32008
- }
32009
- // write the ArrayBuffer to a blob, and you're done
32010
- return new Blob([
32011
- ab
32012
- ], {
32013
- type: mimeString
32014
- });
32015
- }
32016
32008
  jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('imageProcessor', imageProcessor);
32017
32009
 
32018
32010