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
@@ -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
  */
@@ -1799,7 +1799,7 @@ __webpack_require__.r(__webpack_exports__);
1799
1799
  * ```
1800
1800
  * @packageDocumentation
1801
1801
  * @module constants
1802
- */ const APP_VERSION = "4.16.0";
1802
+ */ const APP_VERSION = "4.16.1";
1803
1803
  // prettier-ignore
1804
1804
  const ES = "es2021";
1805
1805
  const IS_ES_MODERN = true;
@@ -32514,7 +32514,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeBaseUrl = '';
32514
32514
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeTitle = 'Jodit Editor';
32515
32515
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeDoctype = '<!DOCTYPE html>';
32516
32516
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeDefaultSrc = 'about:blank';
32517
- 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' + '}';
32517
+ 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' + '}';
32518
32518
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeCSSLinks = [];
32519
32519
  jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.iframeSandbox = null;
32520
32520
 
@@ -32756,13 +32756,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
32756
32756
 
32757
32757
 
32758
32758
 
32759
+
32759
32760
  const JODIT_IMAGE_PROCESSOR_BINDED = '__jodit_imageprocessor_binded';
32760
32761
  const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
32762
+ const IMAGE_SELECTED = 'jodit-wysiwyg_image-selected';
32761
32763
  /**
32762
32764
  * Change editor's size after load all images
32763
32765
  */ class imageProcessor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
32764
- afterInit(jodit) {}
32766
+ afterInit(jodit) {
32767
+ jodit.e.on(jodit.ed, 'selectionchange', this.onSelectionChange);
32768
+ }
32765
32769
  beforeDestruct(jodit) {
32770
+ jodit.e.off(jodit.ed, 'selectionchange', this.onSelectionChange);
32771
+ jodit.editor.classList.remove(IMAGE_SELECTED);
32766
32772
  const buffer = (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.cached)(jodit, 'buffer');
32767
32773
  const list = buffer?.get(JODIT_IMAGE_BLOB_ID);
32768
32774
  if (buffer && list) {
@@ -32793,6 +32799,13 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
32793
32799
  }
32794
32800
  }
32795
32801
  }
32802
+ /**
32803
+ * While the selection is an image, only the image is highlighted: Safari
32804
+ * paints the rest of a block image's line with its parent's highlight. See #1528
32805
+ */ onSelectionChange() {
32806
+ const { jodit } = this;
32807
+ jodit.editor.classList.toggle(IMAGE_SELECTED, isImageSelected(jodit));
32808
+ }
32796
32809
  async afterChange(data) {
32797
32810
  const { jodit: editor } = this;
32798
32811
  if (!editor.editor) {
@@ -32824,6 +32837,9 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
32824
32837
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
32825
32838
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)(':beforeSetElementValue')
32826
32839
  ], imageProcessor.prototype, "onBeforeSetElementValue", null);
32840
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
32841
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
32842
+ ], imageProcessor.prototype, "onSelectionChange", null);
32827
32843
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
32828
32844
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.watch)([
32829
32845
  ':change',
@@ -32832,6 +32848,14 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
32832
32848
  ]),
32833
32849
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.debounce)()
32834
32850
  ], imageProcessor.prototype, "afterChange", null);
32851
+ function isImageSelected(jodit) {
32852
+ const { sel } = jodit.s;
32853
+ if (!sel || !sel.rangeCount) {
32854
+ return false;
32855
+ }
32856
+ const { startContainer, startOffset, endContainer, endOffset } = sel.getRangeAt(0);
32857
+ return startContainer === endContainer && endOffset === startOffset + 1 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(startContainer.childNodes[startOffset], 'img') && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isOrContains(jodit.editor, startContainer);
32858
+ }
32835
32859
  /**
32836
32860
  * Remove the invisible-space text beside an image, which only held a caret.
32837
32861
  * Selecting the image replaces the caret, and with the text still after a
@@ -41871,13 +41895,9 @@ class SourceEditor {
41871
41895
  return;
41872
41896
  }
41873
41897
  loading = true;
41874
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(()=>{
41875
- // The source view was filled before the
41876
- // beautifier arrived — format it now.
41877
- if (addEventListener()) {
41878
- this.syncValueFromWYSIWYG(true);
41879
- }
41880
- }, ()=>null);
41898
+ // It formats the source view from the next time it opens:
41899
+ // filling it again now would replace what was typed there
41900
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(addEventListener, ()=>null);
41881
41901
  };
41882
41902
  editor.e.on('afterSetMode.source', loadBeautify);
41883
41903
  loadBeautify();