jodit 4.19.6 → 4.19.7

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 (70) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +6 -6
  4. package/es2015/jodit.js +494 -102
  5. package/es2015/jodit.min.js +8 -8
  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 +6 -6
  13. package/es2018/jodit.min.js +8 -8
  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 +482 -101
  19. package/es2021/jodit.min.js +57 -57
  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 +18 -18
  28. package/es2021.en/jodit.js +482 -101
  29. package/es2021.en/jodit.min.js +18 -18
  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 +578 -107
  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/style/apply-style.js +31 -2
  52. package/esm/jodit.js +14 -2
  53. package/esm/plugins/backspace/cases/check-join-neighbors.js +36 -7
  54. package/esm/plugins/backspace/cases/check-remove-empty-parent.js +3 -1
  55. package/esm/plugins/bold/bold.js +4 -1
  56. package/esm/plugins/delete/delete.d.ts +12 -0
  57. package/esm/plugins/delete/delete.js +50 -1
  58. package/esm/plugins/resize-cells/resize-cells.d.ts +25 -1
  59. package/esm/plugins/resize-cells/resize-cells.js +84 -15
  60. package/esm/plugins/select/select.d.ts +35 -0
  61. package/esm/plugins/select/select.js +153 -1
  62. package/esm/plugins/select-cells/select-cells.d.ts +24 -0
  63. package/esm/plugins/select-cells/select-cells.js +81 -18
  64. package/esm/types/style.d.ts +5 -0
  65. package/package.json +1 -1
  66. package/types/plugins/delete/delete.d.ts +12 -0
  67. package/types/plugins/resize-cells/resize-cells.d.ts +25 -1
  68. package/types/plugins/select/select.d.ts +35 -0
  69. package/types/plugins/select-cells/select-cells.d.ts +24 -0
  70. package/types/types/style.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.19.6
4
+ * Version: v4.19.7
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -2154,7 +2154,7 @@ __webpack_require__.r(__webpack_exports__);
2154
2154
  * @packageDocumentation
2155
2155
  * @module constants
2156
2156
  */
2157
- var APP_VERSION = "4.19.6";
2157
+ var APP_VERSION = "4.19.7";
2158
2158
  // prettier-ignore
2159
2159
  var ES = "es5";
2160
2160
  var IS_ES_MODERN = false;
@@ -15936,9 +15936,11 @@ var WRAP_NODES = new Set([
15936
15936
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
15937
15937
  /* harmony export */ ApplyStyle: function() { return /* binding */ ApplyStyle; }
15938
15938
  /* harmony export */ });
15939
- /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51640);
15940
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(98394);
15941
- /* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(78462);
15939
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
15940
+ /* harmony import */ var jodit_core_helpers_utils_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28723);
15941
+ /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(51640);
15942
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(98394);
15943
+ /* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78462);
15942
15944
  /*!
15943
15945
  * Jodit Editor (https://xdsoft.net/jodit/)
15944
15946
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -15948,13 +15950,40 @@ var WRAP_NODES = new Set([
15948
15950
  */
15949
15951
 
15950
15952
 
15953
+
15954
+
15955
+ /**
15956
+ * Take a selected fragment out of the elements its style takes the place
15957
+ * of: one around it is split, so the fragment leaves it, and one in it is
15958
+ * unwrapped
15959
+ */ function takeOutOf(jodit, font, tags) {
15960
+ var range = jodit.s.createRange();
15961
+ var outer = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(font.parentNode, tags, jodit.editor);
15962
+ while(outer){
15963
+ range.selectNodeContents(outer);
15964
+ range.setEndBefore(font);
15965
+ var before = range.cloneContents();
15966
+ range.selectNodeContents(outer);
15967
+ range.setStartAfter(font);
15968
+ // Split only when there's more in it, as a split leaves empty copies
15969
+ // of the elements between
15970
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(before) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(range.cloneContents())) {
15971
+ (0,_api__WEBPACK_IMPORTED_MODULE_2__.extractSelectedPart)(outer, font, jodit);
15972
+ }
15973
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.unwrap(outer);
15974
+ outer = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(font.parentNode, tags, jodit.editor);
15975
+ }
15976
+ ;(0,jodit_core_helpers_utils_selector__WEBPACK_IMPORTED_MODULE_1__.$$)(tags.join(','), font).forEach(function(inner) {
15977
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.unwrap(inner);
15978
+ });
15979
+ }
15951
15980
  /** @internal */ function ApplyStyle(jodit, cs) {
15952
15981
  var _editor_firstChild;
15953
15982
  var sel = jodit.s, editor = jodit.editor;
15954
15983
  (_editor_firstChild = editor.firstChild) === null || _editor_firstChild === void 0 ? void 0 : _editor_firstChild.normalize(); // FF fix for test "commandsTest - Exec command "bold"
15955
15984
  var fakes = sel.fakes();
15956
15985
  var collapsed = sel.isCollapsed();
15957
- var mode = _constants__WEBPACK_IMPORTED_MODULE_1__.INITIAL;
15986
+ var mode = _constants__WEBPACK_IMPORTED_MODULE_3__.INITIAL;
15958
15987
  try {
15959
15988
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
15960
15989
  try {
@@ -15962,16 +15991,20 @@ var WRAP_NODES = new Set([
15962
15991
  // temporary wrapper before the selection is restored in finally.
15963
15992
  for(var _iterator = sel.wrapInTagGen(fakes)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
15964
15993
  var font = _step.value;
15994
+ var _cs_options_exclude;
15995
+ if ((_cs_options_exclude = cs.options.exclude) === null || _cs_options_exclude === void 0 ? void 0 : _cs_options_exclude.length) {
15996
+ takeOutOf(jodit, font, cs.options.exclude);
15997
+ }
15965
15998
  var state = {
15966
15999
  collapsed: collapsed,
15967
16000
  mode: mode,
15968
16001
  element: font,
15969
- next: _transactions__WEBPACK_IMPORTED_MODULE_2__.states.START,
16002
+ next: _transactions__WEBPACK_IMPORTED_MODULE_4__.states.START,
15970
16003
  jodit: jodit,
15971
16004
  style: cs
15972
16005
  };
15973
- var machine = new _api__WEBPACK_IMPORTED_MODULE_0__.FiniteStateMachine(_transactions__WEBPACK_IMPORTED_MODULE_2__.states.START, _transactions__WEBPACK_IMPORTED_MODULE_2__.transactions);
15974
- while(!jodit.isInDestruct && machine.getState() !== _transactions__WEBPACK_IMPORTED_MODULE_2__.states.END){
16006
+ var machine = new _api__WEBPACK_IMPORTED_MODULE_2__.FiniteStateMachine(_transactions__WEBPACK_IMPORTED_MODULE_4__.states.START, _transactions__WEBPACK_IMPORTED_MODULE_4__.transactions);
16007
+ while(!jodit.isInDestruct && machine.getState() !== _transactions__WEBPACK_IMPORTED_MODULE_4__.states.END){
15975
16008
  state = machine.dispatch('exec', state);
15976
16009
  }
15977
16010
  // The first selected fragment determines how later fragments toggle.
@@ -22328,6 +22361,20 @@ var FOCUS_EVENTS = new Set([
22328
22361
  'focusin',
22329
22362
  'focusout'
22330
22363
  ]);
22364
+ var EDITING_KEYS = new Set([
22365
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_12__.KEY_ENTER,
22366
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_12__.KEY_BACKSPACE,
22367
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_12__.KEY_DELETE
22368
+ ]);
22369
+ /**
22370
+ * Whether the input method (IME) is using the key. Safari fires the keydown
22371
+ * that ends a composition, as the Enter that confirms Japanese text, after
22372
+ * `compositionend`, and types Korean without one, so `isComposing` is false and
22373
+ * only keyCode 229 tells. Only the keys the editor turns into edits are held
22374
+ * back: the handlers that follow typing still see the rest.
22375
+ */ function isInputMethodKey(event) {
22376
+ return event.isComposing || event.keyCode === 229 && EDITING_KEYS.has(event.key);
22377
+ }
22331
22378
  var __defaultStyleDisplayKey = 'data-jodit-default-style-display';
22332
22379
  var __defaultClassesKey = 'data-jodit-default-classes';
22333
22380
  var NOEDIT = {
@@ -23611,7 +23658,7 @@ var Jodit = /*#__PURE__*/ function(ViewWithToolbar) {
23611
23658
  }
23612
23659
  }
23613
23660
  var w = _this.ew;
23614
- if ((0,_swc_helpers_instanceof__WEBPACK_IMPORTED_MODULE_7__._)(event, w.KeyboardEvent) && event.isComposing) {
23661
+ if ((0,_swc_helpers_instanceof__WEBPACK_IMPORTED_MODULE_7__._)(event, w.KeyboardEvent) && isInputMethodKey(event)) {
23615
23662
  return;
23616
23663
  }
23617
23664
  if (_this.e && _this.e.fire) {
@@ -34595,6 +34642,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_9__.pluginSystem.add('backspace', bac
34595
34642
  if (checkJoinBareText(jodit, fakeNode, backspace)) {
34596
34643
  return true;
34597
34644
  }
34645
+ // Old content can have an inline element round blocks beside the text:
34646
+ // moved inside them, the line joins the block as it would bare text
34647
+ // (#1781)
34648
+ var inline = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
34649
+ if (joinsBareText(jodit, edgeBlock(inline, backspace)) && moveInlineInside(inline, jodit.editor)) {
34650
+ return joinNeighbors(jodit, fakeNode, backspace, moved);
34651
+ }
34598
34652
  var nextBox = fakeNode, mainClosestBox = nextBox;
34599
34653
  // Find the main big closest element
34600
34654
  while(nextBox && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(nextBox, backspace) && nextBox.parentElement !== jodit.editor){
@@ -34902,9 +34956,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_9__.pluginSystem.add('backspace', bac
34902
34956
  * in `<div>a|<p>b</p>c</div>` gives `<div>a|b<br>c</div>`
34903
34957
  */ function checkJoinBareText(jodit, fakeNode, backspace) {
34904
34958
  var block = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
34905
- if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(block) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(block) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(block) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(block, 'table') || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(block) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(block, jodit.editor) || Array.from(block.childNodes).some(function(node) {
34906
- return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node);
34907
- })) {
34959
+ if (!joinsBareText(jodit, block)) {
34908
34960
  return false;
34909
34961
  }
34910
34962
  var filter = (0,jodit_plugins_backspace_helpers__WEBPACK_IMPORTED_MODULE_2__.getMoveFilter)(jodit);
@@ -34931,6 +34983,28 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_9__.pluginSystem.add('backspace', bac
34931
34983
  jodit.s.setCursorBefore(fakeNode);
34932
34984
  return true;
34933
34985
  }
34986
+ /**
34987
+ * Whether a block joins the bare text beside it: not a list, a table or a
34988
+ * cell, and holding no block of its own
34989
+ */ function joinsBareText(jodit, block) {
34990
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(block) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(block) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(block) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(block, 'table') && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(block) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(block, jodit.editor) && !Array.from(block.childNodes).some(function(node) {
34991
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node);
34992
+ });
34993
+ }
34994
+ /**
34995
+ * The block an inline element holds on its side facing the caret, through
34996
+ * the inline elements in it: the `<p>` of `<span><strong><p>…</p></strong></span>`
34997
+ */ function edgeBlock(node, backspace) {
34998
+ var edge = node;
34999
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(edge) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(edge)){
35000
+ var _ref;
35001
+ var children = Array.from(edge.childNodes).filter(function(child) {
35002
+ return !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child);
35003
+ });
35004
+ edge = (_ref = backspace ? children[children.length - 1] : children[0]) !== null && _ref !== void 0 ? _ref : null;
35005
+ }
35006
+ return edge === node ? null : edge;
35007
+ }
34934
35008
  function checkMoveListContent(jodit, mainClosestBox, sibling, backspace) {
34935
35009
  // Process UL/LI/OL cases
34936
35010
  var siblingIsList = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.LIST_TAGS);
@@ -35385,7 +35459,6 @@ function isNotEditable(jodit, node) {
35385
35459
  if (!prn || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn)) {
35386
35460
  return false;
35387
35461
  }
35388
- var neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
35389
35462
  do {
35390
35463
  if (prn && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(prn)) {
35391
35464
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(prn, fakeNode);
@@ -35402,6 +35475,9 @@ function isNotEditable(jodit, node) {
35402
35475
  if (found && (0,_check_join_two_lists__WEBPACK_IMPORTED_MODULE_2__.checkJoinTwoLists)(jodit, fakeNode, backspace)) {
35403
35476
  return true;
35404
35477
  }
35478
+ // Looked for once the empty elements have gone, as the one beside the
35479
+ // caret can be in them: the `<br>` that Delete in `<p>|<br></p>` leaves
35480
+ var neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
35405
35481
  if (neighbor && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText(neighbor) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(neighbor, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INSEPARABLE_TAGS)) {
35406
35482
  setCursorIn(neighbor, !backspace);
35407
35483
  } else {
@@ -35879,8 +35955,15 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.delete = {
35879
35955
  }
35880
35956
  cssRules[key] = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isArray)(cssOptions[key]) ? cssOptions[key][0] : cssOptions[key];
35881
35957
  });
35958
+ var element = control.tags ? control.tags[0] : undefined;
35882
35959
  editor.s.commitStyle({
35883
- element: control.tags ? control.tags[0] : undefined
35960
+ element: element,
35961
+ // As in the browsers and Word, each takes the other's place
35962
+ exclude: element === 'sub' ? [
35963
+ 'sup'
35964
+ ] : element === 'sup' ? [
35965
+ 'sub'
35966
+ ] : []
35884
35967
  });
35885
35968
  editor.synchronizeValues();
35886
35969
  return false;
@@ -38680,11 +38763,12 @@ __webpack_require__.r(__webpack_exports__);
38680
38763
  /* harmony import */ var _swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(34918);
38681
38764
  /* harmony import */ var _swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(50684);
38682
38765
  /* harmony import */ var _swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(38574);
38683
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(27795);
38684
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(28077);
38685
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(65946);
38686
- /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4040);
38687
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(91206);
38766
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(81937);
38767
+ /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(27795);
38768
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(28077);
38769
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(65946);
38770
+ /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(4040);
38771
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(91206);
38688
38772
  /*!
38689
38773
  * Jodit Editor (https://xdsoft.net/jodit/)
38690
38774
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -38706,6 +38790,7 @@ __webpack_require__.r(__webpack_exports__);
38706
38790
 
38707
38791
 
38708
38792
 
38793
+
38709
38794
  var NOT_EMPTY_CONTENT_TAGS = new Set([
38710
38795
  'img',
38711
38796
  'table',
@@ -38713,6 +38798,18 @@ var NOT_EMPTY_CONTENT_TAGS = new Set([
38713
38798
  'iframe',
38714
38799
  'hr'
38715
38800
  ]);
38801
+ var KEEPS_SPACES = new Set([
38802
+ 'pre',
38803
+ 'pre-wrap',
38804
+ 'break-spaces'
38805
+ ]);
38806
+ /**
38807
+ * A plain space beside this neighbor isn't shown: there is none, or it's a
38808
+ * line break, a block or text starting (or ending) with a plain space
38809
+ */ function hidesSpace(neighbor, edge) {
38810
+ var _neighbor_nodeValue;
38811
+ return !neighbor || jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isTag(neighbor, 'br') || jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isBlock(neighbor) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isText(neighbor) && edge.test((_neighbor_nodeValue = neighbor.nodeValue) !== null && _neighbor_nodeValue !== void 0 ? _neighbor_nodeValue : '');
38812
+ }
38716
38813
  var deleteCommand = /*#__PURE__*/ function(Plugin) {
38717
38814
  "use strict";
38718
38815
  (0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__._)(deleteCommand, Plugin);
@@ -38750,13 +38847,13 @@ var deleteCommand = /*#__PURE__*/ function(Plugin) {
38750
38847
  */ function __afterDeleteCommand() {
38751
38848
  var jodit = this.j;
38752
38849
  var current = jodit.s.current();
38753
- if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isTag(current.firstChild, 'br')) {
38850
+ if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isTag(current.firstChild, 'br')) {
38754
38851
  jodit.s.removeNode(current.firstChild);
38755
38852
  }
38756
- if (!(0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_10__.trim)(jodit.editor.textContent || '') && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.first(jodit.editor, function(node) {
38757
- return jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isTag(node, NOT_EMPTY_CONTENT_TAGS);
38758
- }) && (!current || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(current, 'table', jodit.editor))) {
38759
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.detach(jodit.editor);
38853
+ if (!(0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_11__.trim)(jodit.editor.textContent || '') && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.first(jodit.editor, function(node) {
38854
+ return jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isTag(node, NOT_EMPTY_CONTENT_TAGS);
38855
+ }) && (!current || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.closest(current, 'table', jodit.editor))) {
38856
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.detach(jodit.editor);
38760
38857
  var node = jodit.s.setCursorIn(jodit.editor);
38761
38858
  jodit.s.removeNode(node);
38762
38859
  }
@@ -38779,14 +38876,15 @@ var deleteCommand = /*#__PURE__*/ function(Plugin) {
38779
38876
  range.deleteContents();
38780
38877
  var fake = jodit.createInside.fake();
38781
38878
  range.insertNode(fake);
38782
- var leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.findSibling(fake, true);
38783
- var rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.findSibling(fake, false);
38879
+ var leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.findSibling(fake, true);
38880
+ var rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.findSibling(fake, false);
38784
38881
  this.__moveContentInLeftSibling(fake, leftSibling, rightSibling);
38882
+ this.__keepSpacesVisible(fake);
38785
38883
  range.setStartBefore(fake);
38786
38884
  range.collapse(true);
38787
38885
  this.__moveCursorInEditableSibling(jodit, leftSibling, fake, range);
38788
38886
  this.__addBrInEmptyBlock(fake, range);
38789
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(fake);
38887
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.safeRemove(fake);
38790
38888
  jodit.s.selectRange(caret !== null && caret !== void 0 ? caret : range);
38791
38889
  return false;
38792
38890
  }
@@ -38803,27 +38901,27 @@ var deleteCommand = /*#__PURE__*/ function(Plugin) {
38803
38901
  * Returns where the caret goes, or null when no table is involved
38804
38902
  */ function __clearSelectedCells(range) {
38805
38903
  var _this_j = this.j, editor = _this_j.editor, createInside = _this_j.createInside;
38806
- var startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isCell, editor);
38807
- var endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isCell, editor);
38904
+ var startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isCell, editor);
38905
+ var endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isCell, editor);
38808
38906
  if (startCell === endCell) {
38809
38907
  return null;
38810
38908
  }
38811
- var startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(startCell, 'table', editor);
38812
- var endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(endCell, 'table', editor);
38909
+ var startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.closest(startCell, 'table', editor);
38910
+ var endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.closest(endCell, 'table', editor);
38813
38911
  var caret = range.cloneRange();
38814
38912
  caret.collapse(true);
38815
38913
  var parts = [];
38816
38914
  var addParts = function addParts(table) {
38817
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_9__.toArray)(table.rows).flatMap(function(row) {
38818
- return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_9__.toArray)(row.cells);
38915
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.toArray)(table.rows).flatMap(function(row) {
38916
+ return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.toArray)(row.cells);
38819
38917
  }).filter(function(cell) {
38820
38918
  return range.intersectsNode(cell);
38821
38919
  }).forEach(function(cell) {
38822
38920
  var part = range.cloneRange();
38823
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isOrContains(cell, range.startContainer)) {
38921
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isOrContains(cell, range.startContainer)) {
38824
38922
  part.setStart(cell, 0);
38825
38923
  }
38826
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isOrContains(cell, range.endContainer)) {
38924
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isOrContains(cell, range.endContainer)) {
38827
38925
  part.setEnd(cell, cell.childNodes.length);
38828
38926
  }
38829
38927
  parts.push([
@@ -38847,9 +38945,9 @@ var deleteCommand = /*#__PURE__*/ function(Plugin) {
38847
38945
  parts.forEach(function(param) {
38848
38946
  var _param = (0,_swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_5__._)(param, 2), cell = _param[0], part = _param[1];
38849
38947
  part.deleteContents();
38850
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isEmpty(cell)) {
38851
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.detach(cell);
38852
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.append(cell, createInside.element('br'));
38948
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isEmpty(cell)) {
38949
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.detach(cell);
38950
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.append(cell, createInside.element('br'));
38853
38951
  }
38854
38952
  });
38855
38953
  return startTable ? caret : null;
@@ -38860,49 +38958,89 @@ var deleteCommand = /*#__PURE__*/ function(Plugin) {
38860
38958
  value: function __moveContentInLeftSibling(fake, leftSibling, rightSibling) {
38861
38959
  leftSibling = this.__defineRightLeftBox(leftSibling);
38862
38960
  // Nothing is moved into a table, and a block left empty after it goes
38863
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isTag(leftSibling, 'table')) {
38864
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isEmpty(rightSibling)) {
38865
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(rightSibling);
38961
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isTag(leftSibling, 'table')) {
38962
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isEmpty(rightSibling)) {
38963
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.safeRemove(rightSibling);
38866
38964
  }
38867
38965
  return;
38868
38966
  }
38869
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isList(rightSibling) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isTag(rightSibling, 'table') && jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock(leftSibling)) {
38870
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.append(leftSibling, fake);
38871
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.moveContent(rightSibling, leftSibling);
38872
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(rightSibling);
38967
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isList(rightSibling) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isTag(rightSibling, 'table') && jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isBlock(leftSibling)) {
38968
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.append(leftSibling, fake);
38969
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.moveContent(rightSibling, leftSibling);
38970
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.safeRemove(rightSibling);
38873
38971
  }
38874
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isLeaf(rightSibling.firstElementChild)) {
38972
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isLeaf(rightSibling.firstElementChild)) {
38875
38973
  var item = rightSibling.firstElementChild;
38876
38974
  // What's left of the right list's first item joins the left block,
38877
38975
  // up to a list nested in the item
38878
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock(leftSibling)) {
38879
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.append(leftSibling, fake);
38880
- while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock(item.firstChild)){
38881
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.append(leftSibling, item.firstChild);
38976
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isBlock(leftSibling)) {
38977
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.append(leftSibling, fake);
38978
+ while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isBlock(item.firstChild)){
38979
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.append(leftSibling, item.firstChild);
38882
38980
  }
38883
38981
  }
38884
38982
  // Remove empty right LI
38885
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isEmpty(item)) {
38886
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(item);
38983
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isEmpty(item)) {
38984
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.safeRemove(item);
38887
38985
  }
38888
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isEmpty(rightSibling)) {
38889
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(rightSibling);
38986
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isEmpty(rightSibling)) {
38987
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.safeRemove(rightSibling);
38890
38988
  }
38891
38989
  }
38892
38990
  }
38893
38991
  },
38992
+ {
38993
+ key: "__keepSpacesVisible",
38994
+ value: /**
38995
+ * A plain space the deletion leaves at an edge of the block, before a line
38996
+ * break or next to another space isn't shown, and the browser drops it when
38997
+ * the next char is typed. It becomes non-breaking, as in the browsers' own
38998
+ * delete and in Backspace without a selection (#1522)
38999
+ */ function __keepSpacesVisible(fake) {
39000
+ var _Dom_closest;
39001
+ var jodit = this.jodit;
39002
+ var block = (_Dom_closest = jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isBlock, jodit.editor)) !== null && _Dom_closest !== void 0 ? _Dom_closest : jodit.editor;
39003
+ if (KEEPS_SPACES.has(jodit.ew.getComputedStyle(block).whiteSpace)) {
39004
+ return;
39005
+ }
39006
+ var before = this.__findNeighbor(fake, true, block);
39007
+ var after = this.__findNeighbor(fake, false, block);
39008
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isText(before) && hidesSpace(after, /^ /)) {
39009
+ before.nodeValue = before.nodeValue.replace(/ +$/, function(spaces) {
39010
+ return jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.NBSP_SPACE.repeat(spaces.length);
39011
+ });
39012
+ }
39013
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isText(after) && hidesSpace(before, / $/)) {
39014
+ after.nodeValue = after.nodeValue.replace(/^ +/, function(spaces) {
39015
+ return jodit_core_constants__WEBPACK_IMPORTED_MODULE_7__.NBSP_SPACE.repeat(spaces.length);
39016
+ });
39017
+ }
39018
+ }
39019
+ },
39020
+ {
39021
+ key: "__findNeighbor",
39022
+ value: /**
39023
+ * The text, line break or other element next to the caret in its block,
39024
+ * looking inside inline elements
39025
+ */ function __findNeighbor(fake, left, block) {
39026
+ return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.call)(left ? jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.prev : jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.next, fake, function(node) {
39027
+ var _node_nodeValue;
39028
+ return jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isText(node) ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_10__.trimInv)((_node_nodeValue = node.nodeValue) !== null && _node_nodeValue !== void 0 ? _node_nodeValue : '').length > 0 : !jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isComment(node) && !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isInlineBlock(node) && node.firstChild);
39029
+ }, block);
39030
+ }
39031
+ },
38894
39032
  {
38895
39033
  key: "__defineRightLeftBox",
38896
39034
  value: /**
38897
39035
  * If left sibling is list - return last leaf
38898
39036
  */ function __defineRightLeftBox(leftSibling) {
38899
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isList(leftSibling)) {
39037
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isList(leftSibling)) {
38900
39038
  return leftSibling;
38901
39039
  }
38902
39040
  var lastLeaf = leftSibling.lastElementChild;
38903
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isLeaf(lastLeaf)) {
39041
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isLeaf(lastLeaf)) {
38904
39042
  lastLeaf = this.j.createInside.element('li');
38905
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.append(leftSibling, lastLeaf);
39043
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.append(leftSibling, lastLeaf);
38906
39044
  }
38907
39045
  return lastLeaf;
38908
39046
  }
@@ -38913,9 +39051,9 @@ var deleteCommand = /*#__PURE__*/ function(Plugin) {
38913
39051
  * Add BR in the empty block left at the caret
38914
39052
  */ function __addBrInEmptyBlock(fake, range) {
38915
39053
  var jodit = this.j;
38916
- if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
39054
+ if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
38917
39055
  var br = jodit.createInside.element('br');
38918
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.after(fake, br);
39056
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.after(fake, br);
38919
39057
  range.setStartBefore(br);
38920
39058
  range.collapse(true);
38921
39059
  }
@@ -38924,25 +39062,25 @@ var deleteCommand = /*#__PURE__*/ function(Plugin) {
38924
39062
  {
38925
39063
  key: "__moveCursorInEditableSibling",
38926
39064
  value: function __moveCursorInEditableSibling(jodit, leftSibling, fake, range) {
38927
- if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isText(leftSibling)) {
39065
+ if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isText(leftSibling)) {
38928
39066
  var _Dom_closest;
38929
- var root = (_Dom_closest = jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isBlock, jodit.editor)) !== null && _Dom_closest !== void 0 ? _Dom_closest : jodit.editor;
38930
- var leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.isText, root);
39067
+ var root = (_Dom_closest = jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isBlock, jodit.editor)) !== null && _Dom_closest !== void 0 ? _Dom_closest : jodit.editor;
39068
+ var leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.isText, root);
38931
39069
  if (leftText) {
38932
39070
  range.setStartAfter(leftText);
38933
39071
  range.collapse(true);
38934
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_7__.Dom.safeRemove(fake);
39072
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_8__.Dom.safeRemove(fake);
38935
39073
  }
38936
39074
  }
38937
39075
  }
38938
39076
  }
38939
39077
  ]);
38940
39078
  return deleteCommand;
38941
- }((0,_swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_6__._)(jodit_core_plugin__WEBPACK_IMPORTED_MODULE_11__.Plugin));
39079
+ }((0,_swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_6__._)(jodit_core_plugin__WEBPACK_IMPORTED_MODULE_12__.Plugin));
38942
39080
  (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(deleteCommand, "requires", [
38943
39081
  'backspace'
38944
39082
  ]);
38945
- jodit_core_global__WEBPACK_IMPORTED_MODULE_8__.pluginSystem.add('deleteCommand', deleteCommand);
39083
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_9__.pluginSystem.add('deleteCommand', deleteCommand);
38946
39084
 
38947
39085
 
38948
39086
  /***/ }),
@@ -51641,8 +51779,15 @@ var key = 'table_processor_observer-resize';
51641
51779
  }
51642
51780
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "hideTimeout", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "drag", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "wholeTable", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "workCell", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "workTable", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "minX", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "maxX", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "startX", 0), /**
51643
51781
  * The table's and its cells' styles as a column drag started, put back
51644
- * before each new width
51782
+ * as it ends, before the final widths
51645
51783
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "startStyles", []), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "startLeft", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "startEdge", 0), /**
51784
+ * For each of the two columns a drag resizes, the cell whose width
51785
+ * `setColumnWidthByDelta` sets, with its width as the drag started, and
51786
+ * the cells below it, whose widths it clears
51787
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "startWidths", []), /**
51788
+ * The table's width as the drag started, and for a drag of its edge, the
51789
+ * width inside what holds it and its margin on that side
51790
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "startTableWidth", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "startParentWidth", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "startMargin", 0), /**
51646
51791
  * The row whose height the handle sets, or null while it sets a width
51647
51792
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "workRow", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "startY", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "startHeight", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "rowStyle", null), /**
51648
51793
  * The boxes that scroll the row, with their styles, as a row drag turns
@@ -51696,7 +51841,7 @@ var key = 'table_processor_observer-resize';
51696
51841
  * Click on resize handle
51697
51842
  */ function onHandleMouseDown(event) {
51698
51843
  var _this = this;
51699
- if (this.j.isLocked) {
51844
+ if (this.j.isLocked || this.j.o.readonly) {
51700
51845
  return;
51701
51846
  }
51702
51847
  this.drag = true;
@@ -51732,10 +51877,15 @@ var key = 'table_processor_observer-resize';
51732
51877
  var box;
51733
51878
  this.minX = 0;
51734
51879
  this.maxX = 1000000;
51880
+ this.startTableWidth = this.workTable.offsetWidth;
51735
51881
  if (this.wholeTable != null) {
51736
- var tableBox = this.workTable.parentNode.getBoundingClientRect();
51882
+ var parent = this.workTable.parentNode;
51883
+ var tableBox = parent.getBoundingClientRect();
51737
51884
  this.minX = tableBox.left;
51738
51885
  this.maxX = this.minX + tableBox.width;
51886
+ var side = this.isRTL ? 'marginRight' : 'marginLeft';
51887
+ this.startParentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_13__.getContentWidth)(parent, this.j.ew);
51888
+ this.startMargin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
51739
51889
  } else {
51740
51890
  // find maximum columns
51741
51891
  var coordinate = this.module.formalCoordinate(this.workTable, this.workCell, true);
@@ -51749,6 +51899,21 @@ var key = 'table_processor_observer-resize';
51749
51899
  _this.maxX = Math.min(box.left + box.width - jodit_core_constants__WEBPACK_IMPORTED_MODULE_9__.NEARBY / 2, _this.maxX);
51750
51900
  }
51751
51901
  });
51902
+ var matrix = this.module.formalMatrix(this.workTable);
51903
+ this.startWidths = this.resizedColumns().map(function(column) {
51904
+ var cells = matrix.map(function(row) {
51905
+ return row[column];
51906
+ });
51907
+ var index = cells.findIndex(function(td) {
51908
+ return td.colSpan === 1 || cells.length === 1;
51909
+ });
51910
+ var cell = cells[index];
51911
+ return [
51912
+ cell,
51913
+ cell ? cell.offsetWidth : 0,
51914
+ cells.slice(Math.max(index, 0) + 1)
51915
+ ];
51916
+ });
51752
51917
  }
51753
51918
  return false;
51754
51919
  }
@@ -51780,8 +51945,11 @@ var key = 'table_processor_observer-resize';
51780
51945
  x = this.maxX;
51781
51946
  }
51782
51947
  this.resizeDelta = x - this.startX + (!this.j.o.iframe ? 0 : workplacePosition.left);
51783
- this.restoreStyles();
51784
- this.resizeColumnsOrTable();
51948
+ if (this.wholeTable == null) {
51949
+ this.setColumnWidths();
51950
+ } else {
51951
+ this.resizeTable();
51952
+ }
51785
51953
  var tableBox = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_13__.offset)(this.workTable, this.j, this.j.ed);
51786
51954
  Object.assign(this.resizeHandler.style, {
51787
51955
  left: this.startLeft + this.columnEdge() - this.startEdge + 'px',
@@ -51920,6 +52088,19 @@ var key = 'table_processor_observer-resize';
51920
52088
  this.scrollFrame = this.j.async.requestAnimationFrame(scroll);
51921
52089
  }
51922
52090
  },
52091
+ {
52092
+ key: "resizedColumns",
52093
+ value: /**
52094
+ * The two columns a column drag resizes: the work cell's last, and the
52095
+ * next cell's first
52096
+ */ function resizedColumns() {
52097
+ var nextTD = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_13__.call)(this.isRTL ? jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_11__.Dom.prev : jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_11__.Dom.next, this.workCell, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_11__.Dom.isCell, this.workCell.parentNode);
52098
+ return [
52099
+ this.module.formalCoordinate(this.workTable, this.workCell, true)[1],
52100
+ this.module.formalCoordinate(this.workTable, nextTD)[1]
52101
+ ];
52102
+ }
52103
+ },
51923
52104
  {
51924
52105
  key: "resizeColumns",
51925
52106
  value: /**
@@ -51928,9 +52109,32 @@ var key = 'table_processor_observer-resize';
51928
52109
  var delta = this.resizeDelta;
51929
52110
  var marked = [];
51930
52111
  var tableModule = this.module;
51931
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, this.workCell, true)[1], delta, true, marked);
51932
- var nextTD = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_13__.call)(this.isRTL ? jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_11__.Dom.prev : jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_11__.Dom.next, this.workCell, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_11__.Dom.isCell, this.workCell.parentNode);
51933
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, nextTD)[1], -delta, false, marked);
52112
+ var _this_resizedColumns = (0,_swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_5__._)(this.resizedColumns(), 2), column = _this_resizedColumns[0], nextColumn = _this_resizedColumns[1];
52113
+ tableModule.setColumnWidthByDelta(this.workTable, column, delta, true, marked);
52114
+ tableModule.setColumnWidthByDelta(this.workTable, nextColumn, -delta, false, marked);
52115
+ }
52116
+ },
52117
+ {
52118
+ key: "setColumnWidths",
52119
+ value: /**
52120
+ * Sets the widths `resizeColumns` would while the handle is dragged, from
52121
+ * the widths the drag started with, so that a move doesn't put back every
52122
+ * cell's style and lay the table out again to measure them
52123
+ */ function setColumnWidths() {
52124
+ var _this = this;
52125
+ this.startWidths.forEach(function(param, index) {
52126
+ var _param = (0,_swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_5__._)(param, 3), cell = _param[0], width = _param[1], below = _param[2];
52127
+ var delta = index ? -_this.resizeDelta : _this.resizeDelta;
52128
+ if (cell) {
52129
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_14__.css)(cell, 'width', ((width + delta) / _this.startTableWidth * 100).toFixed(jodit_core_constants__WEBPACK_IMPORTED_MODULE_9__.ACCURACY) + '%');
52130
+ }
52131
+ below.forEach(function(td) {
52132
+ td.style.removeProperty('width');
52133
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_13__.attr)(td, 'style')) {
52134
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_13__.attr)(td, 'style', null);
52135
+ }
52136
+ });
52137
+ });
51934
52138
  }
51935
52139
  },
51936
52140
  {
@@ -51939,7 +52143,7 @@ var key = 'table_processor_observer-resize';
51939
52143
  * Resize whole table
51940
52144
  */ function resizeTable() {
51941
52145
  var delta = this.resizeDelta * (this.isRTL ? -1 : 1);
51942
- var width = this.workTable.offsetWidth, parentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_13__.getContentWidth)(this.workTable.parentNode, this.j.ew);
52146
+ var width = this.startTableWidth, parentWidth = this.startParentWidth;
51943
52147
  // for RTL use mirror logic
51944
52148
  var rightSide = !this.wholeTable;
51945
52149
  var needChangeWidth = this.isRTL ? !rightSide : rightSide;
@@ -51948,10 +52152,9 @@ var key = 'table_processor_observer-resize';
51948
52152
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_14__.css)(this.workTable, 'width', (width + delta) / parentWidth * 100 + '%');
51949
52153
  } else {
51950
52154
  var side = this.isRTL ? 'marginRight' : 'marginLeft';
51951
- var margin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
51952
52155
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_14__.css)(this.workTable, (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)({
51953
52156
  width: (width - delta) / parentWidth * 100 + '%'
51954
- }, side, (margin + delta) / parentWidth * 100 + '%'));
52157
+ }, side, (this.startMargin + delta) / parentWidth * 100 + '%'));
51955
52158
  }
51956
52159
  }
51957
52160
  },
@@ -52048,9 +52251,10 @@ var key = 'table_processor_observer-resize';
52048
52251
  if (!editor.o.tableAllowCellResize) {
52049
52252
  return;
52050
52253
  }
52051
- editor.e.off(this.j.ow, '.resize-cells').off('.resize-cells').on('change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells', function() {
52254
+ var observeTables = function observeTables() {
52052
52255
  ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_13__.$$)('table', editor.editor).forEach(_this.observe);
52053
- }).on(this.j.ow, 'scroll.resize-cells', function() {
52256
+ };
52257
+ editor.e.off(this.j.ow, '.resize-cells').off('.resize-cells').on('change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells', observeTables).on(this.j.ow, 'scroll.resize-cells', function() {
52054
52258
  if (!_this.drag || _this.workRow) {
52055
52259
  return;
52056
52260
  }
@@ -52068,6 +52272,8 @@ var key = 'table_processor_observer-resize';
52068
52272
  tableModule.normalizeTable(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_11__.Dom.closest(td, 'table', editor.editor));
52069
52273
  });
52070
52274
  });
52275
+ // None of those events comes with the editor's starting value
52276
+ observeTables();
52071
52277
  }
52072
52278
  },
52073
52279
  {
@@ -52085,7 +52291,9 @@ var key = 'table_processor_observer-resize';
52085
52291
  _this.hideResizeHandle();
52086
52292
  }
52087
52293
  }).on(table, 'mousemove.resize-cells touchmove.resize-cells', this.j.async.throttle(function(event) {
52088
- if (_this.j.isLocked) {
52294
+ // A drag from a cell isn't a resize, and the handle on
52295
+ // a border it passes would take its moves (#1778)
52296
+ if (_this.j.isLocked || _this.j.o.readonly || event.buttons) {
52089
52297
  return;
52090
52298
  }
52091
52299
  var cell = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_11__.Dom.up(event.target, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_11__.Dom.isCell, table);
@@ -54370,7 +54578,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.tableAllowCellSelecti
54370
54578
 
54371
54579
 
54372
54580
  var key = 'table_processor_observer';
54373
- var MOUSE_MOVE_LABEL = 'onMoveTableSelectCell';
54374
54581
  var selectCells = /*#__PURE__*/ function(Plugin) {
54375
54582
  "use strict";
54376
54583
  (0,_swc_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__._)(selectCells, Plugin);
@@ -54385,7 +54592,12 @@ var selectCells = /*#__PURE__*/ function(Plugin) {
54385
54592
  * First selected cell
54386
54593
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__selectedCell", null), /**
54387
54594
  * User is selecting cells now
54388
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__isSelectionMode", false);
54595
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__isSelectionMode", false), /**
54596
+ * The cell the marks were last drawn to
54597
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__movedTo", null), /**
54598
+ * A drag let go outside the table ends in a click on the editor, which
54599
+ * would unmark its cells
54600
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__keepMarks", false);
54389
54601
  return _this;
54390
54602
  }
54391
54603
  ;(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(selectCells, [
@@ -54408,6 +54620,8 @@ var selectCells = /*#__PURE__*/ function(Plugin) {
54408
54620
  // move the caret, as table-keyboard-navigation's do
54409
54621
  .on('keydown', this.__onKeyDown, {
54410
54622
  top: true
54623
+ }).on('clickEditor', this.__onClickAfterDrag, {
54624
+ top: true
54411
54625
  }).on('keydown.select-cells', function(event) {
54412
54626
  if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_8__.KEY_TAB) {
54413
54627
  _this.unselectCells();
@@ -54553,12 +54767,15 @@ var selectCells = /*#__PURE__*/ function(Plugin) {
54553
54767
  }
54554
54768
  this.__isSelectionMode = true;
54555
54769
  this.__selectedCell = cell;
54770
+ this.__movedTo = cell;
54556
54771
  this.__tableModule.addSelection(cell);
54557
- this.j.e.on(table, 'mousemove.select-cells touchmove.select-cells', // Don't use decorator because need clear label on mouseup
54558
- this.j.async.throttle(this.__onMove.bind(this, table), {
54559
- label: MOUSE_MOVE_LABEL,
54560
- timeout: this.j.defaultTimeout / 2
54561
- })).on(table, 'mouseup.select-cells touchend.select-cells', this.__onStopSelection.bind(this, table));
54772
+ this.j.e.on(table, 'mousemove.select-cells touchmove.select-cells', this.__onMove.bind(this, table)).on(table, 'mouseup.select-cells touchend.select-cells', this.__onStopSelection.bind(this, table));
54773
+ new Set([
54774
+ this.j.ew,
54775
+ this.j.ow
54776
+ ]).forEach(function(win) {
54777
+ return _this.j.e.on(win, 'mouseup.select-cells touchend.select-cells', _this.__onRelease.bind(_this, table));
54778
+ });
54562
54779
  return false;
54563
54780
  }
54564
54781
  },
@@ -54569,6 +54786,29 @@ var selectCells = /*#__PURE__*/ function(Plugin) {
54569
54786
  this.__onRemoveSelection();
54570
54787
  }
54571
54788
  },
54789
+ {
54790
+ key: "onMouseDown",
54791
+ value: function onMouseDown() {
54792
+ this.__keepMarks = false;
54793
+ }
54794
+ },
54795
+ {
54796
+ key: "__onClickAfterDrag",
54797
+ value: /**
54798
+ * The click that ends a drag let go outside the table, and inside the
54799
+ * editor, lands on the editor. Taken on, it would unmark the cells and
54800
+ * close their popup. As for the click on a row after a drag over the
54801
+ * cells, the browser's own selection from the drag goes
54802
+ */ function __onClickAfterDrag() {
54803
+ if (this.__keepMarks) {
54804
+ var _this_j_s_sel;
54805
+ this.__keepMarks = false;
54806
+ (_this_j_s_sel = this.j.s.sel) === null || _this_j_s_sel === void 0 ? void 0 : _this_j_s_sel.removeAllRanges();
54807
+ this.j.e.stopPropagation('clickEditor');
54808
+ return false;
54809
+ }
54810
+ }
54811
+ },
54572
54812
  {
54573
54813
  key: "onChange",
54574
54814
  value: function onChange() {
@@ -54592,16 +54832,20 @@ var selectCells = /*#__PURE__*/ function(Plugin) {
54592
54832
  // Inside Shadow DOM `document.elementFromPoint` returns the shadow
54593
54833
  // host, so the lookup must start from the shadow root
54594
54834
  var node = ((_this_j_o_shadowRoot = this.j.o.shadowRoot) !== null && _this_j_o_shadowRoot !== void 0 ? _this_j_o_shadowRoot : this.j.ed).elementFromPoint(e.clientX, e.clientY);
54595
- if (!node) {
54596
- return;
54597
- }
54598
- var cell = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.closest(node, [
54835
+ var cell = node && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.closest(node, [
54599
54836
  'td',
54600
54837
  'th'
54601
54838
  ], table);
54602
54839
  if (!cell || !this.__selectedCell) {
54603
54840
  return;
54604
54841
  }
54842
+ // The marks change only when the mouse goes into another cell, and then
54843
+ // at once rather than throttled, as the browser's own selection from
54844
+ // the drag shows in the cells between until they do (#1778)
54845
+ if (cell === this.__movedTo) {
54846
+ return;
54847
+ }
54848
+ this.__movedTo = cell;
54605
54849
  if (cell !== this.__selectedCell) {
54606
54850
  this.j.lock(key);
54607
54851
  }
@@ -54645,9 +54889,7 @@ var selectCells = /*#__PURE__*/ function(Plugin) {
54645
54889
  value: /**
54646
54890
  * Stop a selection process
54647
54891
  */ function __onStopSelection(table, e) {
54648
- var _this = this;
54649
54892
  var _this_j_o_shadowRoot;
54650
- var _box_bound__, _box_bound__1;
54651
54893
  if (!this.__selectedCell) {
54652
54894
  return;
54653
54895
  }
@@ -54670,10 +54912,40 @@ var selectCells = /*#__PURE__*/ function(Plugin) {
54670
54912
  if (ownTable && ownTable !== table) {
54671
54913
  return; // Nested tables
54672
54914
  }
54673
- var bound = this.__tableModule.getSelectedBound(table, [
54915
+ this.__showCellsPopup(table, [
54674
54916
  cell,
54675
54917
  this.__selectedCell
54676
- ]), box = this.__tableModule.formalMatrix(table);
54918
+ ]);
54919
+ this.__stopListening();
54920
+ }
54921
+ },
54922
+ {
54923
+ key: "__onRelease",
54924
+ value: /**
54925
+ * A drag let go outside the table doesn't reach the table's `mouseup`, so
54926
+ * the window's ends it, leaving the cells marked as they were (#1774)
54927
+ */ function __onRelease(table, e) {
54928
+ if (this.__isSelectionMode) {
54929
+ this.__isSelectionMode = false;
54930
+ if (!this.j.isLockedNotBy(key)) {
54931
+ this.j.unlock();
54932
+ }
54933
+ var cells = this.__tableModule.getAllSelectedCells();
54934
+ // One let go outside the editor clicks outside it, which unmarks them
54935
+ if (cells.length > 1 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_10__.Dom.isOrContains(this.j.editor, e.target)) {
54936
+ this.__keepMarks = true;
54937
+ this.__showCellsPopup(table, cells);
54938
+ }
54939
+ }
54940
+ this.__stopListening();
54941
+ }
54942
+ },
54943
+ {
54944
+ key: "__showCellsPopup",
54945
+ value: function __showCellsPopup(table, cells) {
54946
+ var _this = this;
54947
+ var _box_bound__, _box_bound__1;
54948
+ var bound = this.__tableModule.getSelectedBound(table, cells), box = this.__tableModule.formalMatrix(table);
54677
54949
  var max = (_box_bound__ = box[bound[1][0]]) === null || _box_bound__ === void 0 ? void 0 : _box_bound__[bound[1][1]], min = (_box_bound__1 = box[bound[0][0]]) === null || _box_bound__1 === void 0 ? void 0 : _box_bound__1[bound[0][1]];
54678
54950
  // `getSelectedBound` keeps its `Infinity` sentinel when none of the
54679
54951
  // selected cells belong to this table's matrix — e.g. after a
@@ -54693,10 +54965,22 @@ var selectCells = /*#__PURE__*/ function(Plugin) {
54693
54965
  height: maxOffset.top - minOffset.top + maxOffset.height
54694
54966
  };
54695
54967
  }, 'cells');
54968
+ }
54969
+ },
54970
+ {
54971
+ key: "__stopListening",
54972
+ value: function __stopListening() {
54973
+ var _this = this;
54696
54974
  (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_12__.$$)('table', this.j.editor).forEach(function(table) {
54697
54975
  _this.j.e.off(table, 'mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells');
54698
54976
  });
54699
- this.j.async.clearTimeout(MOUSE_MOVE_LABEL);
54977
+ new Set([
54978
+ this.j.ew,
54979
+ this.j.ow
54980
+ ]).forEach(function(win) {
54981
+ return _this.j.e.off(win, 'mouseup.select-cells touchend.select-cells');
54982
+ });
54983
+ this.__movedTo = null;
54700
54984
  }
54701
54985
  },
54702
54986
  {
@@ -54899,7 +55183,8 @@ var selectCells = /*#__PURE__*/ function(Plugin) {
54899
55183
  key: "beforeDestruct",
54900
55184
  value: /** @override */ function beforeDestruct(jodit) {
54901
55185
  this.__onRemoveSelection();
54902
- jodit.e.off('.select-cells').off('keydown', this.__onKeyDown);
55186
+ this.__stopListening();
55187
+ jodit.e.off('.select-cells').off('keydown', this.__onKeyDown).off('clickEditor', this.__onClickAfterDrag);
54903
55188
  }
54904
55189
  }
54905
55190
  ]);
@@ -54920,6 +55205,15 @@ var selectCells = /*#__PURE__*/ function(Plugin) {
54920
55205
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
54921
55206
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.watch)(':outsideClick')
54922
55207
  ], selectCells.prototype, "onOutsideClick", null);
55208
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
55209
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.watch)([
55210
+ ':mousedown',
55211
+ ':touchstart'
55212
+ ])
55213
+ ], selectCells.prototype, "onMouseDown", null);
55214
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
55215
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.autobind
55216
+ ], selectCells.prototype, "__onClickAfterDrag", null);
54923
55217
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_6__.__decorate)([
54924
55218
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_9__.watch)(':change')
54925
55219
  ], selectCells.prototype, "onChange", null);
@@ -54976,10 +55270,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
54976
55270
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(84839);
54977
55271
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(23211);
54978
55272
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(28077);
54979
- /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(57821);
54980
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(91206);
54981
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(4099);
54982
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(47670);
55273
+ /* harmony import */ var jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(88475);
55274
+ /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(57821);
55275
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(91206);
55276
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(4099);
55277
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(47670);
54983
55278
  /*!
54984
55279
  * Jodit Editor (https://xdsoft.net/jodit/)
54985
55280
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -55003,6 +55298,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
55003
55298
 
55004
55299
 
55005
55300
 
55301
+
55006
55302
  /**
55007
55303
  * A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
55008
55304
  *
@@ -55029,7 +55325,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
55029
55325
  * Where the last press started. Chrome reports a drag that begins in one
55030
55326
  * element and ends in another as a `click` on their common ancestor, so a
55031
55327
  * press inside a popup is remembered to tell such a drag from a real click.
55032
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__pressTarget", null);
55328
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__pressTarget", null), /**
55329
+ * The row a press to its right was beside, and the caret it put there,
55330
+ * while the button is down
55331
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_3__._)(_this, "__pressBesideRow", null);
55033
55332
  return _this;
55034
55333
  }
55035
55334
  ;(0,_swc_helpers_create_class__WEBPACK_IMPORTED_MODULE_2__._)(select, [
@@ -55040,6 +55339,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
55040
55339
  this.proxyEventsList.forEach(function(eventName) {
55041
55340
  jodit.e.on(eventName + '.select', _this.onStartSelection);
55042
55341
  });
55342
+ jodit.e.on('dblclick', this.__onDblClickBesideRow, {
55343
+ top: true
55344
+ });
55043
55345
  }
55044
55346
  },
55045
55347
  {
@@ -55047,8 +55349,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
55047
55349
  value: function beforeDestruct(jodit) {
55048
55350
  var _this = this;
55049
55351
  this.proxyEventsList.forEach(function(eventName) {
55050
- jodit.e.on(eventName + '.select', _this.onStartSelection);
55352
+ jodit.e.off(eventName + '.select', _this.onStartSelection);
55051
55353
  });
55354
+ this.__endPressBesideRow();
55355
+ jodit.e.off('dblclick', this.__onDblClickBesideRow);
55052
55356
  }
55053
55357
  },
55054
55358
  {
@@ -55057,7 +55361,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
55057
55361
  var j = this.j;
55058
55362
  var result, target = e.target;
55059
55363
  while(result === undefined && target && target !== j.editor){
55060
- result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_11__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
55364
+ result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_12__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
55061
55365
  target = target.parentElement;
55062
55366
  }
55063
55367
  if (e.type === 'click' && result === undefined && target === j.editor) {
@@ -55086,10 +55390,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
55086
55390
  }
55087
55391
  // Selecting the text of a popup input with the mouse and releasing
55088
55392
  // the button past the popup's edge is not a click outside of it.
55089
- if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.Popup)) {
55393
+ if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_14__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_14__.Popup)) {
55090
55394
  return;
55091
55395
  }
55092
- var box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_13__.Popup);
55396
+ var box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_14__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_14__.Popup);
55093
55397
  if (!box) {
55094
55398
  this.j.e.fire('outsideClick', e);
55095
55399
  }
@@ -55147,6 +55451,161 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
55147
55451
  }
55148
55452
  }
55149
55453
  },
55454
+ {
55455
+ key: "__rowBeside",
55456
+ value: /**
55457
+ * The table row the mouse is to the right of
55458
+ */ function __rowBeside(e) {
55459
+ var _rows_find;
55460
+ var j = this.j;
55461
+ var target = e.target;
55462
+ if (j.o.readonly || e.button !== 0 || e.detail > 2 || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isHTMLElement(target) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.closest(target, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isCell, j.editor)) {
55463
+ return null;
55464
+ }
55465
+ var table = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_11__.toArray)(target.children).find(function(elm) {
55466
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isTag(elm, 'table')) {
55467
+ return false;
55468
+ }
55469
+ var box = elm.getBoundingClientRect();
55470
+ return e.clientX >= box.right && e.clientY >= box.top && e.clientY < box.bottom;
55471
+ });
55472
+ var rows = table ? (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_11__.toArray)(table.rows).filter(function(row) {
55473
+ return row.cells.length;
55474
+ }) : [];
55475
+ if (!table || !rows.length) {
55476
+ return null;
55477
+ }
55478
+ var row = (_rows_find = rows.find(function(row) {
55479
+ return e.clientY < row.getBoundingClientRect().bottom;
55480
+ })) !== null && _rows_find !== void 0 ? _rows_find : rows[rows.length - 1];
55481
+ return {
55482
+ table: table,
55483
+ row: row
55484
+ };
55485
+ }
55486
+ },
55487
+ {
55488
+ key: "onMouseDownBesideTableRow",
55489
+ value: /**
55490
+ * A press to the right of a table row puts the caret where Word's typing
55491
+ * goes from there: the start of the next row's first cell, or of the block
55492
+ * after the table for the last row (#1770). The browsers put it after the
55493
+ * table, whichever row it's beside, so typing starts a new line below it.
55494
+ * Their own press is stopped, as its drag would start after the table and
55495
+ * take in the rows below first
55496
+ */ function onMouseDownBesideTableRow(e) {
55497
+ var _this = this;
55498
+ var j = this.j;
55499
+ var beside = this.__rowBeside(e);
55500
+ if (!beside) {
55501
+ return;
55502
+ }
55503
+ // A press before the last one was let go must not stack its listeners
55504
+ this.__endPressBesideRow();
55505
+ e.preventDefault();
55506
+ this.__putCaretBesideRow(beside.table, beside.row);
55507
+ this.__pressBesideRow = {
55508
+ row: beside.row,
55509
+ caret: j.s.range.cloneRange()
55510
+ };
55511
+ j.e.on(j.ew, 'mousemove', this.__onDragFromRow);
55512
+ new Set([
55513
+ j.ew,
55514
+ j.ow
55515
+ ]).forEach(function(win) {
55516
+ return j.e.on(win, 'mouseup', _this.__onReleaseFromRow);
55517
+ });
55518
+ }
55519
+ },
55520
+ {
55521
+ key: "__onDragFromRow",
55522
+ value: /**
55523
+ * A drag from beside a row selects from the end of the row to the mouse,
55524
+ * and back beside the row it's the caret again
55525
+ */ function __onDragFromRow(e) {
55526
+ var _this___rowBeside;
55527
+ var s = this.j.s;
55528
+ var press = this.__pressBesideRow;
55529
+ if (!press || !(e.buttons & 1)) {
55530
+ this.__endPressBesideRow();
55531
+ return;
55532
+ }
55533
+ if (((_this___rowBeside = this.__rowBeside(e)) === null || _this___rowBeside === void 0 ? void 0 : _this___rowBeside.row) === press.row) {
55534
+ if (!s.isCollapsed()) {
55535
+ s.selectRange(press.caret.cloneRange());
55536
+ }
55537
+ return;
55538
+ }
55539
+ var cells = press.row.cells;
55540
+ var last = cells[cells.length - 1];
55541
+ if (s.insertCursorAtPoint(e.clientX, e.clientY)) {
55542
+ var _s_sel;
55543
+ var _s_range = s.range, startContainer = _s_range.startContainer, startOffset = _s_range.startOffset;
55544
+ (_s_sel = s.sel) === null || _s_sel === void 0 ? void 0 : _s_sel.setBaseAndExtent(last, last.childNodes.length, startContainer, startOffset);
55545
+ }
55546
+ }
55547
+ },
55548
+ {
55549
+ key: "__onReleaseFromRow",
55550
+ value: /**
55551
+ * In iframe mode, a press in an editor without the focus puts the caret at
55552
+ * its end, so a release that selected nothing puts it back
55553
+ */ function __onReleaseFromRow() {
55554
+ var press = this.__pressBesideRow;
55555
+ this.__endPressBesideRow();
55556
+ if (press && this.j.s.isCollapsed()) {
55557
+ this.j.s.selectRange(press.caret);
55558
+ }
55559
+ }
55560
+ },
55561
+ {
55562
+ key: "__endPressBesideRow",
55563
+ value: function __endPressBesideRow() {
55564
+ var _this = this;
55565
+ var j = this.j;
55566
+ this.__pressBesideRow = null;
55567
+ j.e.off(j.ew, 'mousemove', this.__onDragFromRow);
55568
+ new Set([
55569
+ j.ew,
55570
+ j.ow
55571
+ ]).forEach(function(win) {
55572
+ return j.e.off(win, 'mouseup', _this.__onReleaseFromRow);
55573
+ });
55574
+ }
55575
+ },
55576
+ {
55577
+ key: "__onDblClickBesideRow",
55578
+ value: /**
55579
+ * A double click beside a row is two clicks there, so add-new-line,
55580
+ * which adds a line on a double click with a caret, doesn't see it
55581
+ */ function __onDblClickBesideRow(e) {
55582
+ if (this.__rowBeside(e)) {
55583
+ this.j.e.stopPropagation('dblclick');
55584
+ return false;
55585
+ }
55586
+ }
55587
+ },
55588
+ {
55589
+ key: "__putCaretBesideRow",
55590
+ value: function __putCaretBesideRow(table, row) {
55591
+ var j = this.j;
55592
+ var rows = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_11__.toArray)(table.rows);
55593
+ var next = rows.slice(rows.indexOf(row) + 1).find(function(row) {
55594
+ return row.cells.length;
55595
+ });
55596
+ var after = table.nextSibling;
55597
+ while(after && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isEmptyTextNode(after)){
55598
+ after = after.nextSibling;
55599
+ }
55600
+ if (next) {
55601
+ j.s.setCursorIn(next.cells[0], true);
55602
+ } else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isBlock(after) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isTag(after, 'table') && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_9__.Dom.isContentEditable(after, j.editor)) {
55603
+ j.s.setCursorIn(after, true);
55604
+ } else {
55605
+ j.s.setCursorAfter(table);
55606
+ }
55607
+ }
55608
+ },
55150
55609
  {
55151
55610
  key: "onClickKeepPendingFormat",
55152
55611
  value: /**
@@ -55210,7 +55669,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
55210
55669
  }
55211
55670
  ]);
55212
55671
  return select;
55213
- }((0,_swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_6__._)(jodit_core_plugin__WEBPACK_IMPORTED_MODULE_12__.Plugin));
55672
+ }((0,_swc_helpers_wrap_native_super__WEBPACK_IMPORTED_MODULE_6__._)(jodit_core_plugin__WEBPACK_IMPORTED_MODULE_13__.Plugin));
55214
55673
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
55215
55674
  jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.autobind
55216
55675
  ], select.prototype, "onStartSelection", null);
@@ -55238,6 +55697,18 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
55238
55697
  ':click'
55239
55698
  ])
55240
55699
  ], select.prototype, "onClickRightOfNestedListItem", null);
55700
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
55701
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)(':mousedown')
55702
+ ], select.prototype, "onMouseDownBesideTableRow", null);
55703
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
55704
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.autobind
55705
+ ], select.prototype, "__onDragFromRow", null);
55706
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
55707
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.autobind
55708
+ ], select.prototype, "__onReleaseFromRow", null);
55709
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
55710
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.autobind
55711
+ ], select.prototype, "__onDblClickBesideRow", null);
55241
55712
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_5__.__decorate)([
55242
55713
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_8__.watch)([
55243
55714
  ':click'