jodit 4.17.4 → 4.17.6

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 (63) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +5 -5
  4. package/es2015/jodit.js +131 -37
  5. package/es2015/jodit.min.js +5 -5
  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 +5 -5
  13. package/es2018/jodit.min.js +5 -5
  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 +7 -7
  18. package/es2021/jodit.js +125 -37
  19. package/es2021/jodit.min.js +7 -7
  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 +7 -7
  28. package/es2021.en/jodit.js +125 -37
  29. package/es2021.en/jodit.min.js +8 -8
  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 +140 -37
  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/core/selection/selection.d.ts +5 -0
  52. package/esm/core/selection/selection.js +56 -5
  53. package/esm/modules/history/history.js +20 -12
  54. package/esm/plugins/line-height/line-height.js +1 -1
  55. package/esm/plugins/placeholder/placeholder.js +1 -1
  56. package/esm/plugins/select/select.d.ts +7 -0
  57. package/esm/plugins/select/select.js +19 -1
  58. package/esm/plugins/source/editor/engines/ace.d.ts +2 -0
  59. package/esm/plugins/source/editor/engines/ace.js +35 -3
  60. package/package.json +1 -1
  61. package/types/core/selection/selection.d.ts +5 -0
  62. package/types/plugins/select/select.d.ts +7 -0
  63. package/types/plugins/source/editor/engines/ace.d.ts +2 -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.17.4
4
+ * Version: v4.17.6
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.17.4";
2132
+ var APP_VERSION = "4.17.6";
2133
2133
  // prettier-ignore
2134
2134
  var ES = "es5";
2135
2135
  var IS_ES_MODERN = false;
@@ -12309,6 +12309,12 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
12309
12309
 
12310
12310
 
12311
12311
 
12312
+ /**
12313
+ * A text node that is empty or holds only invisible caret placeholders.
12314
+ */ function isBlankTextNode(node) {
12315
+ var _node_nodeValue;
12316
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isText(node) && ((_node_nodeValue = node.nodeValue) !== null && _node_nodeValue !== void 0 ? _node_nodeValue : '').replace(jodit_core_constants__WEBPACK_IMPORTED_MODULE_8__.INVISIBLE_SPACE_REG_EXP(), '').length === 0;
12317
+ }
12312
12318
  var Selection = /*#__PURE__*/ function() {
12313
12319
  "use strict";
12314
12320
  function Selection(jodit) {
@@ -12464,6 +12470,23 @@ var Selection = /*#__PURE__*/ function() {
12464
12470
  });
12465
12471
  }
12466
12472
  },
12473
+ {
12474
+ key: "__nativeRangeCount",
12475
+ value: /**
12476
+ * How many ranges the browser's own selection holds right now, as opposed
12477
+ * to the composed view that [[sel]] may answer from.
12478
+ */ function __nativeRangeCount() {
12479
+ var _ref;
12480
+ var _this_win_getSelection;
12481
+ var shadowRoot = this.j.o.shadowRoot;
12482
+ if (shadowRoot && (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_12__.isFunction)(shadowRoot.getSelection)) {
12483
+ var _ref1;
12484
+ var _shadowRoot_getSelection;
12485
+ return (_ref1 = (_shadowRoot_getSelection = shadowRoot.getSelection()) === null || _shadowRoot_getSelection === void 0 ? void 0 : _shadowRoot_getSelection.rangeCount) !== null && _ref1 !== void 0 ? _ref1 : 0;
12486
+ }
12487
+ return (_ref = (_this_win_getSelection = this.win.getSelection()) === null || _this_win_getSelection === void 0 ? void 0 : _this_win_getSelection.rangeCount) !== null && _ref !== void 0 ? _ref : 0;
12488
+ }
12489
+ },
12467
12490
  {
12468
12491
  key: "range",
12469
12492
  get: /**
@@ -12624,10 +12647,22 @@ var Selection = /*#__PURE__*/ function() {
12624
12647
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.append(marker, this.j.createInside.text(jodit_core_constants__WEBPACK_IMPORTED_MODULE_8__.INVISIBLE_SPACE));
12625
12648
  if (newRange) {
12626
12649
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isOrContains(this.area, atStart ? newRange.startContainer : newRange.endContainer)) {
12627
- // Here need do unsafe inserting
12628
- // Deny Dom.safeInsertNode(newRange, marker);
12629
- // Apply style -> Test Style module -> Base apply -> For selection <p><strong>|test|</strong></p> apply style {"element":"em","style":{"fontStyle":"italic"}}
12630
- newRange.insertNode(marker);
12650
+ var _node_nodeValue;
12651
+ var node = newRange.startContainer, offset = newRange.startOffset;
12652
+ // At either end of a text node the marker goes beside it. Splitting
12653
+ // the node there would leave the selection's boundary in an empty
12654
+ // text node, and WebKit neither repaints a selection that leaves one
12655
+ // nor moves a selection that follows one when it's removed.
12656
+ if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isText(node) && offset === 0) {
12657
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.before(node, marker);
12658
+ } else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isText(node) && offset === ((_node_nodeValue = node.nodeValue) === null || _node_nodeValue === void 0 ? void 0 : _node_nodeValue.length)) {
12659
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.after(node, marker);
12660
+ } else {
12661
+ // Here need do unsafe inserting
12662
+ // Deny Dom.safeInsertNode(newRange, marker);
12663
+ // Apply style -> Test Style module -> Base apply -> For selection <p><strong>|test|</strong></p> apply style {"element":"em","style":{"fontStyle":"italic"}}
12664
+ newRange.insertNode(marker);
12665
+ }
12631
12666
  }
12632
12667
  }
12633
12668
  return marker;
@@ -13044,7 +13079,9 @@ var Selection = /*#__PURE__*/ function() {
13044
13079
  }
13045
13080
  ].forEach(function(getChildNode) {
13046
13081
  var childNode = getChildNode();
13047
- if (childNode && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isEmptyTextNode(childNode)) {
13082
+ // Only a text node left with nothing in it by the split
13083
+ // goes; one holding a space is content (`<b>a</b> |`).
13084
+ if (childNode && isBlankTextNode(childNode)) {
13048
13085
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.safeRemove(childNode);
13049
13086
  }
13050
13087
  });
@@ -13465,6 +13502,16 @@ var Selection = /*#__PURE__*/ function() {
13465
13502
  if (backward && ranges.length === 1) {
13466
13503
  var range = ranges[0];
13467
13504
  sel.setBaseAndExtent(range.endContainer, range.endOffset, range.startContainer, range.startOffset);
13505
+ } else if (ranges.length === 1 && !this.__nativeRangeCount() && (0,jodit_core_helpers_checker__WEBPACK_IMPORTED_MODULE_12__.isFunction)(sel.setBaseAndExtent)) {
13506
+ // `addRange` is specified to ignore a range whose root is not
13507
+ // the document, which is every range inside a shadow tree.
13508
+ // Chrome's `ShadowRoot.getSelection()` takes them anyway, but
13509
+ // Safari has only the window selection, so after
13510
+ // `removeAllRanges` the caret is simply gone: a character was
13511
+ // deleted and nothing was left to type into. `setBaseAndExtent`
13512
+ // does accept nodes inside a shadow tree.
13513
+ var range1 = ranges[0];
13514
+ sel.setBaseAndExtent(range1.startContainer, range1.startOffset, range1.endContainer, range1.endOffset);
13468
13515
  }
13469
13516
  }
13470
13517
  /**
@@ -27078,19 +27125,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_10__.Config.prototype.history = {
27078
27125
  */ function updateStack() {
27079
27126
  var replace = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
27080
27127
  var newValue = this.snapshot.make();
27081
- if (!_snapshot__WEBPACK_IMPORTED_MODULE_12__.Snapshot.equal(newValue, this.startValue)) {
27082
- var newCommand = new _command__WEBPACK_IMPORTED_MODULE_11__.Command(this.startValue, newValue, this, this.updateTick);
27083
- if (replace) {
27084
- var command = this.__stack.current();
27085
- if (command && this.updateTick === command.tick) {
27086
- this.__stack.replace(newCommand);
27087
- }
27088
- } else {
27089
- this.__stack.push(newCommand);
27090
- }
27128
+ if (_snapshot__WEBPACK_IMPORTED_MODULE_12__.Snapshot.equal(newValue, this.startValue)) {
27129
+ return;
27130
+ }
27131
+ // Only the selection moved, for example when the selection markers
27132
+ // went in before a switch to the source view. There is nothing to
27133
+ // undo, but the next change has to start from this selection.
27134
+ if (newValue.html === this.startValue.html) {
27091
27135
  this.startValue = newValue;
27092
- this.fireChangeStack();
27136
+ return;
27137
+ }
27138
+ var newCommand = new _command__WEBPACK_IMPORTED_MODULE_11__.Command(this.startValue, newValue, this, this.updateTick);
27139
+ if (replace) {
27140
+ var command = this.__stack.current();
27141
+ if (command && this.updateTick === command.tick) {
27142
+ this.__stack.replace(newCommand);
27143
+ }
27144
+ } else {
27145
+ this.__stack.push(newCommand);
27093
27146
  }
27147
+ this.startValue = newValue;
27148
+ this.fireChangeStack();
27094
27149
  }
27095
27150
  },
27096
27151
  {
@@ -44047,7 +44102,7 @@ var lineHeight = /*#__PURE__*/ function(Plugin) {
44047
44102
  try {
44048
44103
  if (s.isCollapsed()) {
44049
44104
  var fake = c.fake();
44050
- s.insertNode(fake, false, false);
44105
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.safeInsertNode(s.range, fake);
44051
44106
  apply(fake);
44052
44107
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.safeRemove(fake);
44053
44108
  } else {
@@ -46347,7 +46402,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.useInputsPlaceholder
46347
46402
  _this.placeholderElm.innerHTML = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_12__.attr)(editor.element, 'placeholder') || '';
46348
46403
  }
46349
46404
  editor.e.fire('placeholder', _this.placeholderElm.innerHTML);
46350
- editor.e.off('.placeholder').on('changePlace.placeholder', _this.addNativeListeners).on('change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder ' + 'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder ' + 'internalChange.placeholder', _this.toggle).on(window, 'load', _this.toggle);
46405
+ editor.e.off('.placeholder').on('changePlace.placeholder', _this.addNativeListeners).on('change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder ' + 'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder ' + 'internalChange.placeholder afterCommand.placeholder', _this.toggle).on(window, 'load', _this.toggle);
46351
46406
  _this.addNativeListeners();
46352
46407
  _this.toggle();
46353
46408
  });
@@ -49790,7 +49845,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
49790
49845
  'touchstart',
49791
49846
  'mouseup',
49792
49847
  'touchend'
49793
- ]);
49848
+ ]), /**
49849
+ * Where the last press started. Chrome reports a drag that begins in one
49850
+ * element and ends in another as a `click` on their common ancestor, so a
49851
+ * press inside a popup is remembered to tell such a drag from a real click.
49852
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__pressTarget", null);
49794
49853
  return _this;
49795
49854
  }
49796
49855
  ;(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(select, [
@@ -49826,18 +49885,30 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
49826
49885
  }
49827
49886
  }
49828
49887
  },
49888
+ {
49889
+ key: "onOutsidePress",
49890
+ value: function onOutsidePress(e) {
49891
+ this.__pressTarget = e.target;
49892
+ }
49893
+ },
49829
49894
  {
49830
49895
  key: "onOutsideClick",
49831
49896
  value: /**
49832
49897
  * @event outsideClick(e) - when user clicked on the outside of editor
49833
49898
  */ function onOutsideClick(e) {
49834
49899
  var _this = this;
49835
- var node = e.target;
49900
+ var node = e.target, pressed = this.__pressTarget;
49901
+ this.__pressTarget = null;
49836
49902
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.up(node, function(elm) {
49837
49903
  return elm === _this.j.editor;
49838
49904
  })) {
49839
49905
  return;
49840
49906
  }
49907
+ // Selecting the text of a popup input with the mouse and releasing
49908
+ // the button past the popup's edge is not a click outside of it.
49909
+ if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.Popup)) {
49910
+ return;
49911
+ }
49841
49912
  var box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.Popup);
49842
49913
  if (!box) {
49843
49914
  this.j.e.fire('outsideClick', e);
@@ -49963,6 +50034,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
49963
50034
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
49964
50035
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.autobind
49965
50036
  ], select.prototype, "onStartSelection", null);
50037
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
50038
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
50039
+ 'ow:mousedown',
50040
+ 'ow:touchstart'
50041
+ ])
50042
+ ], select.prototype, "onOutsidePress", null);
49966
50043
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
49967
50044
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)('ow:click')
49968
50045
  ], select.prototype, "onOutsideClick", null);
@@ -50347,10 +50424,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.source = {
50347
50424
  /* harmony import */ var _swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(53429);
50348
50425
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(25045);
50349
50426
  /* harmony import */ var _swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34918);
50350
- /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(81937);
50351
- /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(23211);
50352
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(65946);
50353
- /* harmony import */ var jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(94193);
50427
+ /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(31635);
50428
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(81937);
50429
+ /* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(49574);
50430
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(23211);
50431
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(65946);
50432
+ /* harmony import */ var jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(94193);
50354
50433
  /*!
50355
50434
  * Jodit Editor (https://xdsoft.net/jodit/)
50356
50435
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -50366,6 +50445,8 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.source = {
50366
50445
 
50367
50446
 
50368
50447
 
50448
+
50449
+
50369
50450
  var AceEditor = /*#__PURE__*/ function(SourceEditor) {
50370
50451
  "use strict";
50371
50452
  (0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__._)(AceEditor, SourceEditor);
@@ -50380,7 +50461,7 @@ var AceEditor = /*#__PURE__*/ function(SourceEditor) {
50380
50461
  _this.j.e.fire('focus', e);
50381
50462
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "proxyOnMouseDown", function(e) {
50382
50463
  _this.j.e.fire('mousedown', e);
50383
- });
50464
+ }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__settingValue", false);
50384
50465
  return _this;
50385
50466
  }
50386
50467
  ;(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(AceEditor, [
@@ -50462,7 +50543,7 @@ var AceEditor = /*#__PURE__*/ function(SourceEditor) {
50462
50543
  return;
50463
50544
  }
50464
50545
  var fakeMirror = _this.j.c.div('jodit-source__mirror-fake');
50465
- jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_6__.Dom.append(_this.container, fakeMirror);
50546
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.append(_this.container, fakeMirror);
50466
50547
  var ace = editor.ow.ace;
50467
50548
  _this.instance = ace.edit(fakeMirror);
50468
50549
  if (editor.o.direction === 'rtl') {
@@ -50483,15 +50564,15 @@ var AceEditor = /*#__PURE__*/ function(SourceEditor) {
50483
50564
  _this.instance.setOption('wrap', editor.o.sourceEditorNativeOptions.wrap);
50484
50565
  _this.instance.getSession().setUseWorker(false);
50485
50566
  _this.instance.$blockScrolling = Infinity;
50486
- _this.instance.on('change', _this.toWYSIWYG);
50567
+ _this.instance.on('change', _this.__onChange);
50487
50568
  _this.instance.on('focus', _this.proxyOnFocus);
50488
50569
  _this.instance.on('mousedown', _this.proxyOnMouseDown);
50489
50570
  _this.instance.on('blur', _this.proxyOnBlur);
50490
- if (editor.getRealMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__.MODE_WYSIWYG) {
50571
+ if (editor.getRealMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_6__.MODE_WYSIWYG) {
50491
50572
  _this.setValue(_this.getValue());
50492
50573
  }
50493
50574
  var onResize = _this.j.async.throttle(function() {
50494
- if (editor.isInDestruct || editor.getMode() === jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__.MODE_WYSIWYG) {
50575
+ if (editor.isInDestruct || editor.getMode() === jodit_core_constants__WEBPACK_IMPORTED_MODULE_6__.MODE_WYSIWYG) {
50495
50576
  return;
50496
50577
  }
50497
50578
  var hasFocus = _this.instance.isFocused();
@@ -50509,7 +50590,7 @@ var AceEditor = /*#__PURE__*/ function(SourceEditor) {
50509
50590
  };
50510
50591
  var loading = false;
50511
50592
  var initAceEditor = function initAceEditor1() {
50512
- if (editor.isInDestruct || editor.getRealMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__.MODE_SOURCE && editor.getMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_5__.MODE_SPLIT) {
50593
+ if (editor.isInDestruct || editor.getRealMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_6__.MODE_SOURCE && editor.getMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_6__.MODE_SPLIT) {
50513
50594
  return;
50514
50595
  }
50515
50596
  // ACE (~400 KiB from the CDN) is only needed once the source view
@@ -50518,7 +50599,7 @@ var AceEditor = /*#__PURE__*/ function(SourceEditor) {
50518
50599
  if (!_this.aceExists()) {
50519
50600
  if (!loading) {
50520
50601
  loading = true;
50521
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_7__.loadNext)(editor, editor.o.sourceEditorCDNUrlsJS).then(initAceEditor).catch(function() {
50602
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_9__.loadNext)(editor, editor.o.sourceEditorCDNUrlsJS).then(initAceEditor).catch(function() {
50522
50603
  return null;
50523
50604
  });
50524
50605
  }
@@ -50536,7 +50617,7 @@ var AceEditor = /*#__PURE__*/ function(SourceEditor) {
50536
50617
  key: "destruct",
50537
50618
  value: function destruct() {
50538
50619
  var _this_j_events, _this_j;
50539
- this.instance.off('change', this.toWYSIWYG);
50620
+ this.instance.off('change', this.__onChange);
50540
50621
  this.instance.off('focus', this.proxyOnFocus);
50541
50622
  this.instance.off('mousedown', this.proxyOnMouseDown);
50542
50623
  this.instance.destroy();
@@ -50548,14 +50629,33 @@ var AceEditor = /*#__PURE__*/ function(SourceEditor) {
50548
50629
  value: function setValue(value) {
50549
50630
  if (!this.j.o.editHTMLDocumentMode && this.j.o.beautifyHTML) {
50550
50631
  var html = this.j.e.fire('beautifyHTML', value);
50551
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_7__.isString)(html)) {
50632
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_9__.isString)(html)) {
50552
50633
  value = html;
50553
50634
  }
50554
50635
  }
50555
- this.instance.setValue(value);
50636
+ // ACE reports its own `setValue` as two changes, the removal of the
50637
+ // old text and the insertion of the new one. Fed back into the
50638
+ // editor they became two history entries, `content -> ''` and
50639
+ // `'' -> content`, so the first undo after a switch to the source
50640
+ // view and back emptied the editor. The text came from the editor
50641
+ // in the first place, so there is nothing to send back.
50642
+ this.__settingValue = true;
50643
+ try {
50644
+ this.instance.setValue(value);
50645
+ } finally{
50646
+ this.__settingValue = false;
50647
+ }
50556
50648
  this.instance.clearSelection();
50557
50649
  }
50558
50650
  },
50651
+ {
50652
+ key: "__onChange",
50653
+ value: function __onChange() {
50654
+ if (!this.__settingValue) {
50655
+ this.toWYSIWYG();
50656
+ }
50657
+ }
50658
+ },
50559
50659
  {
50560
50660
  key: "getValue",
50561
50661
  value: function getValue() {
@@ -50658,7 +50758,10 @@ var AceEditor = /*#__PURE__*/ function(SourceEditor) {
50658
50758
  }
50659
50759
  ]);
50660
50760
  return AceEditor;
50661
- }(jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_8__.SourceEditor);
50761
+ }(jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_10__.SourceEditor);
50762
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
50763
+ jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_7__.autobind
50764
+ ], AceEditor.prototype, "__onChange", null);
50662
50765
 
50663
50766
 
50664
50767
  /***/ }),
package/es5/jodit.min.css CHANGED
@@ -1,14 +1,14 @@
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.17.4
4
+ * Version: v4.17.6
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
8
8
  /*!
9
9
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
10
10
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
11
- * Version: v4.17.4
11
+ * Version: v4.17.6
12
12
  * Url: https://xdsoft.net/jodit/
13
13
  * License(s): MIT
14
14
  */