jodit 4.15.16 → 4.15.17

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 (55) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +4 -4
  4. package/es2015/jodit.js +61 -16
  5. package/es2015/jodit.min.js +4 -4
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +4 -4
  13. package/es2018/jodit.min.js +4 -4
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +5 -5
  18. package/es2021/jodit.js +60 -16
  19. package/es2021/jodit.min.js +5 -5
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +5 -5
  28. package/es2021.en/jodit.js +60 -16
  29. package/es2021.en/jodit.min.js +5 -5
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +62 -16
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/core/constants.js +1 -1
  51. package/esm/plugins/focus/focus.js +17 -1
  52. package/esm/plugins/image-processor/image-processor.js +20 -1
  53. package/esm/plugins/image-properties/writers/margin.js +5 -3
  54. package/esm/plugins/inline-popup/config/items/img.js +7 -0
  55. package/package.json +1 -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.15.16
4
+ * Version: v4.15.17
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1780,7 +1780,7 @@ __webpack_require__.r(__webpack_exports__);
1780
1780
  * ```
1781
1781
  * @packageDocumentation
1782
1782
  * @module constants
1783
- */ const APP_VERSION = "4.15.16";
1783
+ */ const APP_VERSION = "4.15.17";
1784
1784
  // prettier-ignore
1785
1785
  const ES = "es2021";
1786
1786
  const IS_ES_MODERN = true;
@@ -31596,14 +31596,28 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_1__.pluginSystem.add('file', file);
31596
31596
  */ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.saveSelectionOnBlur = true;
31597
31597
  function focus(editor) {
31598
31598
  if (editor.o.saveSelectionOnBlur) {
31599
+ // A click that brings focus back places the caret itself, and Chrome
31600
+ // has already placed it when focus fires, so restoring would move it
31601
+ // back to the old selection. The saved markers are dropped instead.
31602
+ let focusByPointer = false;
31599
31603
  editor.e.on('blur', ()=>{
31604
+ // A press that never brought the focus back must not decide
31605
+ // what the next focus does
31606
+ focusByPointer = false;
31600
31607
  if (editor.isEditorMode()) {
31601
31608
  editor.s.save(true);
31602
31609
  }
31610
+ }).on('mousedown touchstart', ()=>{
31611
+ focusByPointer = !editor.editorIsActive;
31603
31612
  }).on('focus', ()=>{
31604
31613
  if (editor.isEditorMode()) {
31605
- editor.s.restore();
31614
+ if (focusByPointer) {
31615
+ editor.s.removeMarkers();
31616
+ } else {
31617
+ editor.s.restore();
31618
+ }
31606
31619
  }
31620
+ focusByPointer = false;
31607
31621
  });
31608
31622
  }
31609
31623
  const focus = ()=>{
@@ -32629,11 +32643,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
32629
32643
  /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31635);
32630
32644
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
32631
32645
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(84839);
32632
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28077);
32633
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
32634
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(91206);
32635
- /* harmony import */ var jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(23112);
32636
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(51034);
32646
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23211);
32647
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
32648
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
32649
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
32650
+ /* harmony import */ var jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(23112);
32651
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(51034);
32637
32652
  /*!
32638
32653
  * Jodit Editor (https://xdsoft.net/jodit/)
32639
32654
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -32650,11 +32665,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.imageProcessor = {
32650
32665
 
32651
32666
 
32652
32667
 
32668
+
32653
32669
  const JODIT_IMAGE_PROCESSOR_BINDED = '__jodit_imageprocessor_binded';
32654
32670
  const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
32655
32671
  /**
32656
32672
  * Change editor's size after load all images
32657
- */ class imageProcessor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
32673
+ */ class imageProcessor extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
32658
32674
  afterInit(jodit) {}
32659
32675
  beforeDestruct(jodit) {
32660
32676
  const buffer = (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.cached)(jodit, 'buffer');
@@ -32692,9 +32708,9 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
32692
32708
  if (!editor.editor) {
32693
32709
  return;
32694
32710
  }
32695
- ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.$$)('img', editor.editor).forEach((elm)=>{
32696
- if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.dataBind)(elm, JODIT_IMAGE_PROCESSOR_BINDED)) {
32697
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.dataBind)(elm, JODIT_IMAGE_PROCESSOR_BINDED, true);
32711
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.$$)('img', editor.editor).forEach((elm)=>{
32712
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(elm, JODIT_IMAGE_PROCESSOR_BINDED)) {
32713
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.dataBind)(elm, JODIT_IMAGE_PROCESSOR_BINDED, true);
32698
32714
  if (!elm.complete) {
32699
32715
  editor.e.on(elm, 'load', function ElementOnLoad() {
32700
32716
  !editor.isInDestruct && editor.e?.fire('resize');
@@ -32705,6 +32721,7 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
32705
32721
  replaceDataURIToBlobUUID(editor, elm);
32706
32722
  }
32707
32723
  editor.e.on(elm, 'mousedown touchstart', ()=>{
32724
+ removeCaretText(elm);
32708
32725
  editor.s.select(elm);
32709
32726
  });
32710
32727
  }
@@ -32725,6 +32742,23 @@ const JODIT_IMAGE_BLOB_ID = JODIT_IMAGE_PROCESSOR_BINDED + 'blob-id';
32725
32742
  ]),
32726
32743
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.debounce)()
32727
32744
  ], imageProcessor.prototype, "afterChange", null);
32745
+ /**
32746
+ * Remove the invisible-space text beside an image, which only held a caret.
32747
+ * Selecting the image replaces the caret, and with the text still after a
32748
+ * block image, Safari highlights the rest of the image's line. See #1512
32749
+ */ function removeCaretText(elm) {
32750
+ for (const side of [
32751
+ 'previousSibling',
32752
+ 'nextSibling'
32753
+ ]){
32754
+ let node = elm[side];
32755
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isText(node) && !node.nodeValue?.replace((0,jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.INVISIBLE_SPACE_REG_EXP)(), '')){
32756
+ const next = node[side];
32757
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(node);
32758
+ node = next;
32759
+ }
32760
+ }
32761
+ }
32728
32762
  function replaceDataURIToBlobUUID(editor, elm) {
32729
32763
  if (!editor.o.imageProcessor.replaceDataURIToBlobIdInView) {
32730
32764
  return;
@@ -32735,7 +32769,7 @@ function replaceDataURIToBlobUUID(editor, elm) {
32735
32769
  const dataUri = elm.src;
32736
32770
  let blob;
32737
32771
  try {
32738
- blob = (0,jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_6__.dataURItoBlob)(dataUri);
32772
+ blob = (0,jodit_modules_uploader_helpers_data_uri_to_blob__WEBPACK_IMPORTED_MODULE_7__.dataURItoBlob)(dataUri);
32739
32773
  } catch {
32740
32774
  // A data URI the browser accepts but we cannot decode is not worth
32741
32775
  // breaking the editor over — keep the image as it is
@@ -32748,7 +32782,7 @@ function replaceDataURIToBlobUUID(editor, elm) {
32748
32782
  list[elm.src] = dataUri;
32749
32783
  editor.buffer.set(JODIT_IMAGE_BLOB_ID, list);
32750
32784
  }
32751
- jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('imageProcessor', imageProcessor);
32785
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('imageProcessor', imageProcessor);
32752
32786
 
32753
32787
 
32754
32788
  /***/ }),
@@ -34222,10 +34256,12 @@ UIImagePositionTab = (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__
34222
34256
  marginBottom,
34223
34257
  marginLeft
34224
34258
  ];
34259
+ // Compared with the inline value, which is what `readMargins` showed, so a
34260
+ // margin from a stylesheet is not overwritten when the field is unchanged
34225
34261
  const applyMargin = (key, value)=>{
34226
- const oldValue = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, key);
34262
+ const oldValue = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__.normalSizeToString)((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.cssInline)(image, key) || 0);
34227
34263
  const v = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_1__.normalSizeToString)(value);
34228
- if (oldValue.toString() !== v.toString()) {
34264
+ if (oldValue !== v) {
34229
34265
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_0__.css)(image, key, v);
34230
34266
  }
34231
34267
  };
@@ -35050,6 +35086,14 @@ const align = {
35050
35086
  'Normal'
35051
35087
  ],
35052
35088
  tooltip: 'Vertical align',
35089
+ // `vertical-align` only moves an image in the line, not a floated or block one
35090
+ isDisabled: (editor, button)=>{
35091
+ const image = button.target;
35092
+ return Boolean(image && ([
35093
+ 'left',
35094
+ 'right'
35095
+ ].includes((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, 'float')) || (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(image, 'display') === 'block'));
35096
+ },
35053
35097
  exec: (editor, image, { control })=>{
35054
35098
  if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(image, 'img')) {
35055
35099
  return;