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/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.16.0
4
+ * Version: v4.16.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.16.0";
1808
+ */ const APP_VERSION = "4.16.1";
1809
1809
  // prettier-ignore
1810
1810
  const ES = "es2015";
1811
1811
  const IS_ES_MODERN = true;
@@ -33135,7 +33135,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeBaseUrl = '';
33135
33135
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeTitle = 'Jodit Editor';
33136
33136
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeDoctype = '<!DOCTYPE html>';
33137
33137
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeDefaultSrc = 'about:blank';
33138
- 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' + '}';
33138
+ 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' + '}';
33139
33139
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeCSSLinks = [];
33140
33140
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeSandbox = null;
33141
33141
 
@@ -33380,13 +33380,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
33380
33380
 
33381
33381
 
33382
33382
 
33383
+
33383
33384
  const JODIT_IMAGE_PROCESSOR_BINDED = '__jodit_imageprocessor_binded';
33384
33385
  const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33386
+ const IMAGE_SELECTED = 'jodit-wysiwyg_image-selected';
33385
33387
  /**
33386
33388
  * Change editor's size after load all images
33387
33389
  */ class imageProcessor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
33388
- afterInit(jodit) {}
33390
+ afterInit(jodit) {
33391
+ jodit.e.on(jodit.ed, 'selectionchange', this.onSelectionChange);
33392
+ }
33389
33393
  beforeDestruct(jodit) {
33394
+ jodit.e.off(jodit.ed, 'selectionchange', this.onSelectionChange);
33395
+ jodit.editor.classList.remove(IMAGE_SELECTED);
33390
33396
  const buffer = (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.cached)(jodit, 'buffer');
33391
33397
  const list = buffer === null || buffer === void 0 ? void 0 : buffer.get(JODIT_IMAGE_BLOB_ID);
33392
33398
  if (buffer && list) {
@@ -33417,6 +33423,13 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33417
33423
  }
33418
33424
  }
33419
33425
  }
33426
+ /**
33427
+ * While the selection is an image, only the image is highlighted: Safari
33428
+ * paints the rest of a block image's line with its parent's highlight. See #1528
33429
+ */ onSelectionChange() {
33430
+ const { jodit } = this;
33431
+ jodit.editor.classList.toggle(IMAGE_SELECTED, isImageSelected(jodit));
33432
+ }
33420
33433
  afterChange(data) {
33421
33434
  return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function*() {
33422
33435
  const { jodit: editor } = this;
@@ -33451,6 +33464,9 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33451
33464
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
33452
33465
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':beforeSetElementValue')
33453
33466
  ], imageProcessor.prototype, "onBeforeSetElementValue", null);
33467
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
33468
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
33469
+ ], imageProcessor.prototype, "onSelectionChange", null);
33454
33470
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
33455
33471
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
33456
33472
  ':change',
@@ -33459,6 +33475,14 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
33459
33475
  ]),
33460
33476
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.debounce)()
33461
33477
  ], imageProcessor.prototype, "afterChange", null);
33478
+ function isImageSelected(jodit) {
33479
+ const { sel } = jodit.s;
33480
+ if (!sel || !sel.rangeCount) {
33481
+ return false;
33482
+ }
33483
+ const { startContainer, startOffset, endContainer, endOffset } = sel.getRangeAt(0);
33484
+ return startContainer === endContainer && endOffset === startOffset + 1 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(startContainer.childNodes[startOffset], 'img') && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(jodit.editor, startContainer);
33485
+ }
33462
33486
  /**
33463
33487
  * Remove the invisible-space text beside an image, which only held a caret.
33464
33488
  * Selecting the image replaces the caret, and with the text still after a
@@ -42955,13 +42979,9 @@ class SourceEditor {
42955
42979
  return;
42956
42980
  }
42957
42981
  loading = true;
42958
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(()=>{
42959
- // The source view was filled before the
42960
- // beautifier arrived — format it now.
42961
- if (addEventListener()) {
42962
- this.syncValueFromWYSIWYG(true);
42963
- }
42964
- }, ()=>null);
42982
+ // It formats the source view from the next time it opens:
42983
+ // filling it again now would replace what was typed there
42984
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(addEventListener, ()=>null);
42965
42985
  };
42966
42986
  editor.e.on('afterSetMode.source', loadBeautify);
42967
42987
  loadBeautify();