jodit 4.16.0 → 4.16.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 (65) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/es2015/jodit.css +11 -1
  3. package/es2015/jodit.fat.min.css +1 -1
  4. package/es2015/jodit.fat.min.js +4 -4
  5. package/es2015/jodit.js +31 -11
  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 +11 -1
  21. package/es2021/jodit.fat.min.css +1 -1
  22. package/es2021/jodit.fat.min.js +4 -4
  23. package/es2021/jodit.js +31 -11
  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 +11 -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 +31 -11
  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 +15 -2
  45. package/es5/jodit.fat.min.css +1 -1
  46. package/es5/jodit.fat.min.js +2 -2
  47. package/es5/jodit.js +34 -11
  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 +1 -1
  57. package/es5/polyfills.js +1 -1
  58. package/es5/polyfills.min.js +1 -1
  59. package/esm/core/constants.js +1 -1
  60. package/esm/plugins/iframe/config.js +4 -0
  61. package/esm/plugins/image-processor/image-processor.d.ts +5 -0
  62. package/esm/plugins/image-processor/image-processor.js +29 -2
  63. package/esm/plugins/source/source.js +3 -7
  64. package/package.json +1 -1
  65. package/types/plugins/image-processor/image-processor.d.ts +5 -0
package/es5/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.16.0
4
+ * Version: v4.16.1
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -2129,7 +2129,7 @@ __webpack_require__.r(__webpack_exports__);
2129
2129
  * @packageDocumentation
2130
2130
  * @module constants
2131
2131
  */
2132
- var APP_VERSION = "4.16.0";
2132
+ var APP_VERSION = "4.16.1";
2133
2133
  // prettier-ignore
2134
2134
  var ES = "es5";
2135
2135
  var IS_ES_MODERN = false;
@@ -39131,7 +39131,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeBaseUrl = '';
39131
39131
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeTitle = 'Jodit Editor';
39132
39132
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeDoctype = '<!DOCTYPE html>';
39133
39133
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeDefaultSrc = 'about:blank';
39134
- jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeStyle = 'html{' + 'margin:0;' + 'padding:0;' + 'min-height: 100%;' + '}' + 'body{' + 'box-sizing:border-box;' + 'font-size:13px;' + 'line-height:1.6;' + 'padding:10px;' + 'margin:0;' + 'background:transparent;' + 'color:#000;' + 'position:' + 'relative;' + 'z-index:2;' + 'user-select:auto;' + 'margin:0px;' + 'overflow:auto;' + 'outline:none;' + '}' + 'table{' + 'width:100%;' + 'border:none;' + 'border-collapse:collapse;' + 'empty-cells: show;' + 'max-width: 100%;' + '}' + 'th,td{' + 'padding: 2px 5px;' + 'border:1px solid #ccc;' + '-webkit-user-select:text;' + '-moz-user-select:text;' + '-ms-user-select:text;' + 'user-select:text' + '}' + 'p{' + 'margin-top:0;' + '}' + '.jodit_editor .jodit_iframe_wrapper{' + 'display: block;' + 'clear: both;' + 'user-select: none;' + 'position: relative;' + '}' + '.jodit_editor .jodit_iframe_wrapper:after {' + 'position:absolute;' + 'content:"";' + 'z-index:1;' + 'top:0;' + 'left:0;' + 'right: 0;' + 'bottom: 0;' + 'cursor: pointer;' + 'display: block;' + 'background: rgba(0, 0, 0, 0);' + '} ' + '.jodit_disabled{' + 'user-select: none;' + '-o-user-select: none;' + '-moz-user-select: none;' + '-khtml-user-select: none;' + '-webkit-user-select: none;' + '-ms-user-select: none' + '}';
39134
+ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeStyle = 'html{' + 'margin:0;' + 'padding:0;' + 'min-height: 100%;' + '}' + 'body{' + 'box-sizing:border-box;' + 'font-size:13px;' + 'line-height:1.6;' + 'padding:10px;' + 'margin:0;' + 'background:transparent;' + 'color:#000;' + 'position:' + 'relative;' + 'z-index:2;' + 'user-select:auto;' + 'margin:0px;' + 'overflow:auto;' + 'outline:none;' + '}' + 'table{' + 'width:100%;' + 'border:none;' + 'border-collapse:collapse;' + 'empty-cells: show;' + 'max-width: 100%;' + '}' + 'th,td{' + 'padding: 2px 5px;' + 'border:1px solid #ccc;' + '-webkit-user-select:text;' + '-moz-user-select:text;' + '-ms-user-select:text;' + 'user-select:text' + '}' + 'p{' + 'margin-top:0;' + '}' + '.jodit_editor .jodit_iframe_wrapper{' + 'display: block;' + 'clear: both;' + 'user-select: none;' + 'position: relative;' + '}' + '.jodit_editor .jodit_iframe_wrapper:after {' + 'position:absolute;' + 'content:"";' + 'z-index:1;' + 'top:0;' + 'left:0;' + 'right: 0;' + 'bottom: 0;' + 'cursor: pointer;' + 'display: block;' + 'background: rgba(0, 0, 0, 0);' + '} ' + '.jodit-wysiwyg_image-selected::selection,' + '.jodit-wysiwyg_image-selected *:not(img)::selection{' + 'background:transparent' + '}' + '.jodit_disabled{' + 'user-select: none;' + '-o-user-select: none;' + '-moz-user-select: none;' + '-khtml-user-select: none;' + '-webkit-user-select: none;' + '-ms-user-select: none' + '}';
39135
39135
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeCSSLinks = [];
39136
39136
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeSandbox = null;
39137
39137
 
@@ -39394,8 +39394,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
39394
39394
 
39395
39395
 
39396
39396
 
39397
+
39397
39398
  var JODIT_IMAGE_PROCESSOR_BINDED = '__jodit_imageprocessor_binded';
39398
39399
  var JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
39400
+ var IMAGE_SELECTED = 'jodit-wysiwyg_image-selected';
39399
39401
  /**
39400
39402
  * Change editor's size after load all images
39401
39403
  */ var imageProcessor = /*#__PURE__*/ function(Plugin) {
@@ -39408,11 +39410,15 @@ var JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
39408
39410
  ;(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_3__._)(imageProcessor, [
39409
39411
  {
39410
39412
  key: "afterInit",
39411
- value: function afterInit(jodit) {}
39413
+ value: function afterInit(jodit) {
39414
+ jodit.e.on(jodit.ed, 'selectionchange', this.onSelectionChange);
39415
+ }
39412
39416
  },
39413
39417
  {
39414
39418
  key: "beforeDestruct",
39415
39419
  value: function beforeDestruct(jodit) {
39420
+ jodit.e.off(jodit.ed, 'selectionchange', this.onSelectionChange);
39421
+ jodit.editor.classList.remove(IMAGE_SELECTED);
39416
39422
  var buffer = (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.cached)(jodit, 'buffer');
39417
39423
  var list = buffer === null || buffer === void 0 ? void 0 : buffer.get(JODIT_IMAGE_BLOB_ID);
39418
39424
  if (buffer && list) {
@@ -39484,6 +39490,16 @@ var JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
39484
39490
  }
39485
39491
  }
39486
39492
  },
39493
+ {
39494
+ key: "onSelectionChange",
39495
+ value: /**
39496
+ * While the selection is an image, only the image is highlighted: Safari
39497
+ * paints the rest of a block image's line with its parent's highlight. See #1528
39498
+ */ function onSelectionChange() {
39499
+ var jodit = this.jodit;
39500
+ jodit.editor.classList.toggle(IMAGE_SELECTED, isImageSelected(jodit));
39501
+ }
39502
+ },
39487
39503
  {
39488
39504
  key: "afterChange",
39489
39505
  value: function afterChange(data) {
@@ -39531,6 +39547,9 @@ var JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
39531
39547
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
39532
39548
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.watch)(':beforeSetElementValue')
39533
39549
  ], imageProcessor.prototype, "onBeforeSetElementValue", null);
39550
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
39551
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.autobind
39552
+ ], imageProcessor.prototype, "onSelectionChange", null);
39534
39553
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
39535
39554
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.watch)([
39536
39555
  ':change',
@@ -39539,6 +39558,14 @@ var JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
39539
39558
  ]),
39540
39559
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.debounce)()
39541
39560
  ], imageProcessor.prototype, "afterChange", null);
39561
+ function isImageSelected(jodit) {
39562
+ var sel = jodit.s.sel;
39563
+ if (!sel || !sel.rangeCount) {
39564
+ return false;
39565
+ }
39566
+ var _sel_getRangeAt = sel.getRangeAt(0), startContainer = _sel_getRangeAt.startContainer, startOffset = _sel_getRangeAt.startOffset, endContainer = _sel_getRangeAt.endContainer, endOffset = _sel_getRangeAt.endOffset;
39567
+ return startContainer === endContainer && endOffset === startOffset + 1 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isTag(startContainer.childNodes[startOffset], 'img') && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isOrContains(jodit.editor, startContainer);
39568
+ }
39542
39569
  /**
39543
39570
  * Remove the invisible-space text beside an image, which only held a caret.
39544
39571
  * Selecting the image replaces the caret, and with the text still after a
@@ -50952,13 +50979,9 @@ var SourceEditor = /*#__PURE__*/ function() {
50952
50979
  return;
50953
50980
  }
50954
50981
  loading = true;
50955
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(function() {
50956
- // The source view was filled before the
50957
- // beautifier arrived — format it now.
50958
- if (addEventListener()) {
50959
- _this.syncValueFromWYSIWYG(true);
50960
- }
50961
- }, function() {
50982
+ // It formats the source view from the next time it opens:
50983
+ // filling it again now would replace what was typed there
50984
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_11__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(addEventListener, function() {
50962
50985
  return null;
50963
50986
  });
50964
50987
  };