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/es2015/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.19.6
4
+ * Version: v4.19.7
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1830,7 +1830,7 @@ __webpack_require__.r(__webpack_exports__);
1830
1830
  * ```
1831
1831
  * @packageDocumentation
1832
1832
  * @module constants
1833
- */ const APP_VERSION = "4.19.6";
1833
+ */ const APP_VERSION = "4.19.7";
1834
1834
  // prettier-ignore
1835
1835
  const ES = "es2015";
1836
1836
  const IS_ES_MODERN = true;
@@ -13954,9 +13954,11 @@ const WRAP_NODES = new Set([
13954
13954
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13955
13955
  /* harmony export */ ApplyStyle: function() { return /* binding */ ApplyStyle; }
13956
13956
  /* harmony export */ });
13957
- /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51640);
13958
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(98394);
13959
- /* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(78462);
13957
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
13958
+ /* harmony import */ var jodit_core_helpers_utils_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28723);
13959
+ /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(51640);
13960
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(98394);
13961
+ /* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78462);
13960
13962
  /*!
13961
13963
  * Jodit Editor (https://xdsoft.net/jodit/)
13962
13964
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -13966,27 +13968,56 @@ const WRAP_NODES = new Set([
13966
13968
  */
13967
13969
 
13968
13970
 
13971
+
13972
+
13973
+ /**
13974
+ * Take a selected fragment out of the elements its style takes the place
13975
+ * of: one around it is split, so the fragment leaves it, and one in it is
13976
+ * unwrapped
13977
+ */ function takeOutOf(jodit, font, tags) {
13978
+ const range = jodit.s.createRange();
13979
+ let outer = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(font.parentNode, tags, jodit.editor);
13980
+ while(outer){
13981
+ range.selectNodeContents(outer);
13982
+ range.setEndBefore(font);
13983
+ const before = range.cloneContents();
13984
+ range.selectNodeContents(outer);
13985
+ range.setStartAfter(font);
13986
+ // Split only when there's more in it, as a split leaves empty copies
13987
+ // of the elements between
13988
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(before) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(range.cloneContents())) {
13989
+ (0,_api__WEBPACK_IMPORTED_MODULE_2__.extractSelectedPart)(outer, font, jodit);
13990
+ }
13991
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.unwrap(outer);
13992
+ outer = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(font.parentNode, tags, jodit.editor);
13993
+ }
13994
+ ;(0,jodit_core_helpers_utils_selector__WEBPACK_IMPORTED_MODULE_1__.$$)(tags.join(','), font).forEach((inner)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.unwrap(inner));
13995
+ }
13969
13996
  /** @internal */ function ApplyStyle(jodit, cs) {
13970
13997
  var _editor_firstChild;
13971
13998
  const { s: sel, editor } = jodit;
13972
13999
  (_editor_firstChild = editor.firstChild) === null || _editor_firstChild === void 0 ? void 0 : _editor_firstChild.normalize(); // FF fix for test "commandsTest - Exec command "bold"
13973
14000
  const fakes = sel.fakes();
13974
14001
  const collapsed = sel.isCollapsed();
13975
- let mode = _constants__WEBPACK_IMPORTED_MODULE_1__.INITIAL;
14002
+ let mode = _constants__WEBPACK_IMPORTED_MODULE_3__.INITIAL;
13976
14003
  try {
13977
14004
  // for...of closes the generator on an exception, releasing every
13978
14005
  // temporary wrapper before the selection is restored in finally.
13979
14006
  for (const font of sel.wrapInTagGen(fakes)){
14007
+ var _cs_options_exclude;
14008
+ if ((_cs_options_exclude = cs.options.exclude) === null || _cs_options_exclude === void 0 ? void 0 : _cs_options_exclude.length) {
14009
+ takeOutOf(jodit, font, cs.options.exclude);
14010
+ }
13980
14011
  let state = {
13981
14012
  collapsed,
13982
14013
  mode,
13983
14014
  element: font,
13984
- next: _transactions__WEBPACK_IMPORTED_MODULE_2__.states.START,
14015
+ next: _transactions__WEBPACK_IMPORTED_MODULE_4__.states.START,
13985
14016
  jodit,
13986
14017
  style: cs
13987
14018
  };
13988
- const machine = new _api__WEBPACK_IMPORTED_MODULE_0__.FiniteStateMachine(_transactions__WEBPACK_IMPORTED_MODULE_2__.states.START, _transactions__WEBPACK_IMPORTED_MODULE_2__.transactions);
13989
- while(!jodit.isInDestruct && machine.getState() !== _transactions__WEBPACK_IMPORTED_MODULE_2__.states.END){
14019
+ const machine = new _api__WEBPACK_IMPORTED_MODULE_2__.FiniteStateMachine(_transactions__WEBPACK_IMPORTED_MODULE_4__.states.START, _transactions__WEBPACK_IMPORTED_MODULE_4__.transactions);
14020
+ while(!jodit.isInDestruct && machine.getState() !== _transactions__WEBPACK_IMPORTED_MODULE_4__.states.END){
13990
14021
  state = machine.dispatch('exec', state);
13991
14022
  }
13992
14023
  // The first selected fragment determines how later fragments toggle.
@@ -18514,6 +18545,20 @@ const FOCUS_EVENTS = new Set([
18514
18545
  'focusin',
18515
18546
  'focusout'
18516
18547
  ]);
18548
+ const EDITING_KEYS = new Set([
18549
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_ENTER,
18550
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_BACKSPACE,
18551
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_DELETE
18552
+ ]);
18553
+ /**
18554
+ * Whether the input method (IME) is using the key. Safari fires the keydown
18555
+ * that ends a composition, as the Enter that confirms Japanese text, after
18556
+ * `compositionend`, and types Korean without one, so `isComposing` is false and
18557
+ * only keyCode 229 tells. Only the keys the editor turns into edits are held
18558
+ * back: the handlers that follow typing still see the rest.
18559
+ */ function isInputMethodKey(event) {
18560
+ return event.isComposing || event.keyCode === 229 && EDITING_KEYS.has(event.key);
18561
+ }
18517
18562
  const __defaultStyleDisplayKey = 'data-jodit-default-style-display';
18518
18563
  const __defaultClassesKey = 'data-jodit-default-classes';
18519
18564
  const NOEDIT = {
@@ -19572,7 +19617,7 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_11__.ViewWithToolbar
19572
19617
  }
19573
19618
  }
19574
19619
  const w = this.ew;
19575
- if (event instanceof w.KeyboardEvent && event.isComposing) {
19620
+ if (event instanceof w.KeyboardEvent && isInputMethodKey(event)) {
19576
19621
  return;
19577
19622
  }
19578
19623
  if (this.e && this.e.fire) {
@@ -28895,6 +28940,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28895
28940
  if (checkJoinBareText(jodit, fakeNode, backspace)) {
28896
28941
  return true;
28897
28942
  }
28943
+ // Old content can have an inline element round blocks beside the text:
28944
+ // moved inside them, the line joins the block as it would bare text
28945
+ // (#1781)
28946
+ const inline = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
28947
+ if (joinsBareText(jodit, edgeBlock(inline, backspace)) && moveInlineInside(inline, jodit.editor)) {
28948
+ return joinNeighbors(jodit, fakeNode, backspace, moved);
28949
+ }
28898
28950
  let nextBox = fakeNode, mainClosestBox = nextBox;
28899
28951
  // Find the main big closest element
28900
28952
  while(nextBox && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(nextBox, backspace) && nextBox.parentElement !== jodit.editor){
@@ -29175,7 +29227,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
29175
29227
  * in `<div>a|<p>b</p>c</div>` gives `<div>a|b<br>c</div>`
29176
29228
  */ function checkJoinBareText(jodit, fakeNode, backspace) {
29177
29229
  const block = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
29178
- 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((node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node))) {
29230
+ if (!joinsBareText(jodit, block)) {
29179
29231
  return false;
29180
29232
  }
29181
29233
  const filter = (0,jodit_plugins_backspace_helpers__WEBPACK_IMPORTED_MODULE_2__.getMoveFilter)(jodit);
@@ -29202,6 +29254,24 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
29202
29254
  jodit.s.setCursorBefore(fakeNode);
29203
29255
  return true;
29204
29256
  }
29257
+ /**
29258
+ * Whether a block joins the bare text beside it: not a list, a table or a
29259
+ * cell, and holding no block of its own
29260
+ */ function joinsBareText(jodit, block) {
29261
+ 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((node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node));
29262
+ }
29263
+ /**
29264
+ * The block an inline element holds on its side facing the caret, through
29265
+ * the inline elements in it: the `<p>` of `<span><strong><p>…</p></strong></span>`
29266
+ */ function edgeBlock(node, backspace) {
29267
+ let edge = node;
29268
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(edge) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(edge)){
29269
+ var _ref;
29270
+ const children = Array.from(edge.childNodes).filter((child)=>!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child));
29271
+ edge = (_ref = backspace ? children[children.length - 1] : children[0]) !== null && _ref !== void 0 ? _ref : null;
29272
+ }
29273
+ return edge === node ? null : edge;
29274
+ }
29205
29275
  function checkMoveListContent(jodit, mainClosestBox, sibling, backspace) {
29206
29276
  // Process UL/LI/OL cases
29207
29277
  const siblingIsList = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.LIST_TAGS);
@@ -29653,7 +29723,6 @@ function isNotEditable(jodit, node) {
29653
29723
  if (!prn || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn)) {
29654
29724
  return false;
29655
29725
  }
29656
- const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
29657
29726
  do {
29658
29727
  if (prn && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(prn)) {
29659
29728
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(prn, fakeNode);
@@ -29668,6 +29737,9 @@ function isNotEditable(jodit, node) {
29668
29737
  if (found && (0,_check_join_two_lists__WEBPACK_IMPORTED_MODULE_2__.checkJoinTwoLists)(jodit, fakeNode, backspace)) {
29669
29738
  return true;
29670
29739
  }
29740
+ // Looked for once the empty elements have gone, as the one beside the
29741
+ // caret can be in them: the `<br>` that Delete in `<p>|<br></p>` leaves
29742
+ const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
29671
29743
  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)) {
29672
29744
  setCursorIn(neighbor, !backspace);
29673
29745
  } else {
@@ -30134,8 +30206,15 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.delete = {
30134
30206
  }
30135
30207
  cssRules[key] = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isArray)(cssOptions[key]) ? cssOptions[key][0] : cssOptions[key];
30136
30208
  });
30209
+ const element = control.tags ? control.tags[0] : undefined;
30137
30210
  editor.s.commitStyle({
30138
- element: control.tags ? control.tags[0] : undefined
30211
+ element,
30212
+ // As in the browsers and Word, each takes the other's place
30213
+ exclude: element === 'sub' ? [
30214
+ 'sup'
30215
+ ] : element === 'sup' ? [
30216
+ 'sub'
30217
+ ] : []
30139
30218
  });
30140
30219
  editor.synchronizeValues();
30141
30220
  return false;
@@ -32711,11 +32790,12 @@ __webpack_require__.r(__webpack_exports__);
32711
32790
  "use strict";
32712
32791
  /* unused harmony export deleteCommand */
32713
32792
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
32714
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27795);
32715
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28077);
32716
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65946);
32717
- /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4040);
32718
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(91206);
32793
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
32794
+ /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27795);
32795
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28077);
32796
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
32797
+ /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4040);
32798
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
32719
32799
  /*!
32720
32800
  * Jodit Editor (https://xdsoft.net/jodit/)
32721
32801
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -32731,6 +32811,7 @@ __webpack_require__.r(__webpack_exports__);
32731
32811
 
32732
32812
 
32733
32813
 
32814
+
32734
32815
  const NOT_EMPTY_CONTENT_TAGS = new Set([
32735
32816
  'img',
32736
32817
  'table',
@@ -32738,7 +32819,19 @@ const NOT_EMPTY_CONTENT_TAGS = new Set([
32738
32819
  'iframe',
32739
32820
  'hr'
32740
32821
  ]);
32741
- class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
32822
+ const KEEPS_SPACES = new Set([
32823
+ 'pre',
32824
+ 'pre-wrap',
32825
+ 'break-spaces'
32826
+ ]);
32827
+ /**
32828
+ * A plain space beside this neighbor isn't shown: there is none, or it's a
32829
+ * line break, a block or text starting (or ending) with a plain space
32830
+ */ function hidesSpace(neighbor, edge) {
32831
+ var _neighbor_nodeValue;
32832
+ return !neighbor || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(neighbor, 'br') || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(neighbor) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(neighbor) && edge.test((_neighbor_nodeValue = neighbor.nodeValue) !== null && _neighbor_nodeValue !== void 0 ? _neighbor_nodeValue : '');
32833
+ }
32834
+ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
32742
32835
  afterInit(jodit) {
32743
32836
  jodit.e.on('afterCommand.delete', (command)=>{
32744
32837
  if (command === 'delete') {
@@ -32759,11 +32852,11 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32759
32852
  */ __afterDeleteCommand() {
32760
32853
  const jodit = this.j;
32761
32854
  const current = jodit.s.current();
32762
- if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(current.firstChild, 'br')) {
32855
+ if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(current.firstChild, 'br')) {
32763
32856
  jodit.s.removeNode(current.firstChild);
32764
32857
  }
32765
- if (!(0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_4__.trim)(jodit.editor.textContent || '') && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.first(jodit.editor, (node)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(node, NOT_EMPTY_CONTENT_TAGS)) && (!current || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(current, 'table', jodit.editor))) {
32766
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.detach(jodit.editor);
32858
+ if (!(0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_5__.trim)(jodit.editor.textContent || '') && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.first(jodit.editor, (node)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(node, NOT_EMPTY_CONTENT_TAGS)) && (!current || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(current, 'table', jodit.editor))) {
32859
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.detach(jodit.editor);
32767
32860
  const node = jodit.s.setCursorIn(jodit.editor);
32768
32861
  jodit.s.removeNode(node);
32769
32862
  }
@@ -32783,14 +32876,15 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32783
32876
  range.deleteContents();
32784
32877
  const fake = jodit.createInside.fake();
32785
32878
  range.insertNode(fake);
32786
- const leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(fake, true);
32787
- const rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(fake, false);
32879
+ const leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.findSibling(fake, true);
32880
+ const rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.findSibling(fake, false);
32788
32881
  this.__moveContentInLeftSibling(fake, leftSibling, rightSibling);
32882
+ this.__keepSpacesVisible(fake);
32789
32883
  range.setStartBefore(fake);
32790
32884
  range.collapse(true);
32791
32885
  this.__moveCursorInEditableSibling(jodit, leftSibling, fake, range);
32792
32886
  this.__addBrInEmptyBlock(fake, range);
32793
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(fake);
32887
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
32794
32888
  jodit.s.selectRange(caret !== null && caret !== void 0 ? caret : range);
32795
32889
  return false;
32796
32890
  }
@@ -32804,23 +32898,23 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32804
32898
  * Returns where the caret goes, or null when no table is involved
32805
32899
  */ __clearSelectedCells(range) {
32806
32900
  const { editor, createInside } = this.j;
32807
- const startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell, editor);
32808
- const endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell, editor);
32901
+ const startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell, editor);
32902
+ const endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell, editor);
32809
32903
  if (startCell === endCell) {
32810
32904
  return null;
32811
32905
  }
32812
- const startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(startCell, 'table', editor);
32813
- const endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(endCell, 'table', editor);
32906
+ const startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(startCell, 'table', editor);
32907
+ const endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(endCell, 'table', editor);
32814
32908
  const caret = range.cloneRange();
32815
32909
  caret.collapse(true);
32816
32910
  const parts = [];
32817
32911
  const addParts = (table)=>{
32818
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.toArray)(table.rows).flatMap((row)=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.toArray)(row.cells)).filter((cell)=>range.intersectsNode(cell)).forEach((cell)=>{
32912
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.toArray)(table.rows).flatMap((row)=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.toArray)(row.cells)).filter((cell)=>range.intersectsNode(cell)).forEach((cell)=>{
32819
32913
  const part = range.cloneRange();
32820
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(cell, range.startContainer)) {
32914
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.startContainer)) {
32821
32915
  part.setStart(cell, 0);
32822
32916
  }
32823
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(cell, range.endContainer)) {
32917
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.endContainer)) {
32824
32918
  part.setEnd(cell, cell.childNodes.length);
32825
32919
  }
32826
32920
  parts.push([
@@ -32843,9 +32937,9 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32843
32937
  }
32844
32938
  parts.forEach(([cell, part])=>{
32845
32939
  part.deleteContents();
32846
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(cell)) {
32847
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.detach(cell);
32848
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(cell, createInside.element('br'));
32940
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(cell)) {
32941
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.detach(cell);
32942
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(cell, createInside.element('br'));
32849
32943
  }
32850
32944
  });
32851
32945
  return startTable ? caret : null;
@@ -32853,46 +32947,76 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32853
32947
  __moveContentInLeftSibling(fake, leftSibling, rightSibling) {
32854
32948
  leftSibling = this.__defineRightLeftBox(leftSibling);
32855
32949
  // Nothing is moved into a table, and a block left empty after it goes
32856
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(leftSibling, 'table')) {
32857
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(rightSibling)) {
32858
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32950
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(leftSibling, 'table')) {
32951
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
32952
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32859
32953
  }
32860
32954
  return;
32861
32955
  }
32862
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(rightSibling) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(rightSibling, 'table') && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(leftSibling)) {
32863
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, fake);
32864
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.moveContent(rightSibling, leftSibling);
32865
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32956
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(rightSibling) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(rightSibling, 'table') && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(leftSibling)) {
32957
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, fake);
32958
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.moveContent(rightSibling, leftSibling);
32959
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32866
32960
  }
32867
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(rightSibling.firstElementChild)) {
32961
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(rightSibling.firstElementChild)) {
32868
32962
  const item = rightSibling.firstElementChild;
32869
32963
  // What's left of the right list's first item joins the left block,
32870
32964
  // up to a list nested in the item
32871
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(leftSibling)) {
32872
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, fake);
32873
- while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(item.firstChild)){
32874
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, item.firstChild);
32965
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(leftSibling)) {
32966
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, fake);
32967
+ while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(item.firstChild)){
32968
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, item.firstChild);
32875
32969
  }
32876
32970
  }
32877
32971
  // Remove empty right LI
32878
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(item)) {
32879
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(item);
32972
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item)) {
32973
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(item);
32880
32974
  }
32881
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(rightSibling)) {
32882
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32975
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
32976
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32883
32977
  }
32884
32978
  }
32885
32979
  }
32980
+ /**
32981
+ * A plain space the deletion leaves at an edge of the block, before a line
32982
+ * break or next to another space isn't shown, and the browser drops it when
32983
+ * the next char is typed. It becomes non-breaking, as in the browsers' own
32984
+ * delete and in Backspace without a selection (#1522)
32985
+ */ __keepSpacesVisible(fake) {
32986
+ var _Dom_closest;
32987
+ const { jodit } = this;
32988
+ const block = (_Dom_closest = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor)) !== null && _Dom_closest !== void 0 ? _Dom_closest : jodit.editor;
32989
+ if (KEEPS_SPACES.has(jodit.ew.getComputedStyle(block).whiteSpace)) {
32990
+ return;
32991
+ }
32992
+ const before = this.__findNeighbor(fake, true, block);
32993
+ const after = this.__findNeighbor(fake, false, block);
32994
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(before) && hidesSpace(after, /^ /)) {
32995
+ before.nodeValue = before.nodeValue.replace(/ +$/, (spaces)=>jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.NBSP_SPACE.repeat(spaces.length));
32996
+ }
32997
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(after) && hidesSpace(before, / $/)) {
32998
+ after.nodeValue = after.nodeValue.replace(/^ +/, (spaces)=>jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.NBSP_SPACE.repeat(spaces.length));
32999
+ }
33000
+ }
33001
+ /**
33002
+ * The text, line break or other element next to the caret in its block,
33003
+ * looking inside inline elements
33004
+ */ __findNeighbor(fake, left, block) {
33005
+ return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.call)(left ? jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.prev : jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.next, fake, (node)=>{
33006
+ var _node_nodeValue;
33007
+ return jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(node) ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.trimInv)((_node_nodeValue = node.nodeValue) !== null && _node_nodeValue !== void 0 ? _node_nodeValue : '').length > 0 : !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isComment(node) && !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isInlineBlock(node) && node.firstChild);
33008
+ }, block);
33009
+ }
32886
33010
  /**
32887
33011
  * If left sibling is list - return last leaf
32888
33012
  */ __defineRightLeftBox(leftSibling) {
32889
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(leftSibling)) {
33013
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(leftSibling)) {
32890
33014
  return leftSibling;
32891
33015
  }
32892
33016
  let lastLeaf = leftSibling.lastElementChild;
32893
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(lastLeaf)) {
33017
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(lastLeaf)) {
32894
33018
  lastLeaf = this.j.createInside.element('li');
32895
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, lastLeaf);
33019
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, lastLeaf);
32896
33020
  }
32897
33021
  return lastLeaf;
32898
33022
  }
@@ -32900,22 +33024,22 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32900
33024
  * Add BR in the empty block left at the caret
32901
33025
  */ __addBrInEmptyBlock(fake, range) {
32902
33026
  const jodit = this.j;
32903
- if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
33027
+ if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
32904
33028
  const br = jodit.createInside.element('br');
32905
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(fake, br);
33029
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.after(fake, br);
32906
33030
  range.setStartBefore(br);
32907
33031
  range.collapse(true);
32908
33032
  }
32909
33033
  }
32910
33034
  __moveCursorInEditableSibling(jodit, leftSibling, fake, range) {
32911
- if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText(leftSibling)) {
33035
+ if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(leftSibling)) {
32912
33036
  var _Dom_closest;
32913
- const root = (_Dom_closest = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock, jodit.editor)) !== null && _Dom_closest !== void 0 ? _Dom_closest : jodit.editor;
32914
- const leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText, root);
33037
+ const root = (_Dom_closest = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor)) !== null && _Dom_closest !== void 0 ? _Dom_closest : jodit.editor;
33038
+ const leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText, root);
32915
33039
  if (leftText) {
32916
33040
  range.setStartAfter(leftText);
32917
33041
  range.collapse(true);
32918
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(fake);
33042
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
32919
33043
  }
32920
33044
  }
32921
33045
  }
@@ -32923,7 +33047,7 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32923
33047
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(deleteCommand, "requires", [
32924
33048
  'backspace'
32925
33049
  ]);
32926
- jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('deleteCommand', deleteCommand);
33050
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('deleteCommand', deleteCommand);
32927
33051
 
32928
33052
 
32929
33053
  /***/ }),
@@ -43930,7 +44054,7 @@ const key = 'table_processor_observer-resize';
43930
44054
  /**
43931
44055
  * Click on resize handle
43932
44056
  */ onHandleMouseDown(event) {
43933
- if (this.j.isLocked) {
44057
+ if (this.j.isLocked || this.j.o.readonly) {
43934
44058
  return;
43935
44059
  }
43936
44060
  this.drag = true;
@@ -43965,10 +44089,15 @@ const key = 'table_processor_observer-resize';
43965
44089
  let box;
43966
44090
  this.minX = 0;
43967
44091
  this.maxX = 1000000;
44092
+ this.startTableWidth = this.workTable.offsetWidth;
43968
44093
  if (this.wholeTable != null) {
43969
- const tableBox = this.workTable.parentNode.getBoundingClientRect();
44094
+ const parent = this.workTable.parentNode;
44095
+ const tableBox = parent.getBoundingClientRect();
43970
44096
  this.minX = tableBox.left;
43971
44097
  this.maxX = this.minX + tableBox.width;
44098
+ const side = this.isRTL ? 'marginRight' : 'marginLeft';
44099
+ this.startParentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getContentWidth)(parent, this.j.ew);
44100
+ this.startMargin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
43972
44101
  } else {
43973
44102
  // find maximum columns
43974
44103
  const coordinate = this.module.formalCoordinate(this.workTable, this.workCell, true);
@@ -43982,6 +44111,17 @@ const key = 'table_processor_observer-resize';
43982
44111
  this.maxX = Math.min(box.left + box.width - jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.NEARBY / 2, this.maxX);
43983
44112
  }
43984
44113
  });
44114
+ const matrix = this.module.formalMatrix(this.workTable);
44115
+ this.startWidths = this.resizedColumns().map((column)=>{
44116
+ const cells = matrix.map((row)=>row[column]);
44117
+ const index = cells.findIndex((td)=>td.colSpan === 1 || cells.length === 1);
44118
+ const cell = cells[index];
44119
+ return [
44120
+ cell,
44121
+ cell ? cell.offsetWidth : 0,
44122
+ cells.slice(Math.max(index, 0) + 1)
44123
+ ];
44124
+ });
43985
44125
  }
43986
44126
  return false;
43987
44127
  }
@@ -44010,8 +44150,11 @@ const key = 'table_processor_observer-resize';
44010
44150
  x = this.maxX;
44011
44151
  }
44012
44152
  this.resizeDelta = x - this.startX + (!this.j.o.iframe ? 0 : workplacePosition.left);
44013
- this.restoreStyles();
44014
- this.resizeColumnsOrTable();
44153
+ if (this.wholeTable == null) {
44154
+ this.setColumnWidths();
44155
+ } else {
44156
+ this.resizeTable();
44157
+ }
44015
44158
  const tableBox = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.offset)(this.workTable, this.j, this.j.ed);
44016
44159
  Object.assign(this.resizeHandler.style, {
44017
44160
  left: this.startLeft + this.columnEdge() - this.startEdge + 'px',
@@ -44124,21 +44267,49 @@ const key = 'table_processor_observer-resize';
44124
44267
  };
44125
44268
  this.scrollFrame = this.j.async.requestAnimationFrame(scroll);
44126
44269
  }
44270
+ /**
44271
+ * The two columns a column drag resizes: the work cell's last, and the
44272
+ * next cell's first
44273
+ */ resizedColumns() {
44274
+ const nextTD = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.call)(this.isRTL ? jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.prev : jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.next, this.workCell, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isCell, this.workCell.parentNode);
44275
+ return [
44276
+ this.module.formalCoordinate(this.workTable, this.workCell, true)[1],
44277
+ this.module.formalCoordinate(this.workTable, nextTD)[1]
44278
+ ];
44279
+ }
44127
44280
  /**
44128
44281
  * Resize only one column
44129
44282
  */ resizeColumns() {
44130
44283
  const delta = this.resizeDelta;
44131
44284
  const marked = [];
44132
44285
  const tableModule = this.module;
44133
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, this.workCell, true)[1], delta, true, marked);
44134
- const nextTD = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.call)(this.isRTL ? jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.prev : jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.next, this.workCell, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isCell, this.workCell.parentNode);
44135
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, nextTD)[1], -delta, false, marked);
44286
+ const [column, nextColumn] = this.resizedColumns();
44287
+ tableModule.setColumnWidthByDelta(this.workTable, column, delta, true, marked);
44288
+ tableModule.setColumnWidthByDelta(this.workTable, nextColumn, -delta, false, marked);
44289
+ }
44290
+ /**
44291
+ * Sets the widths `resizeColumns` would while the handle is dragged, from
44292
+ * the widths the drag started with, so that a move doesn't put back every
44293
+ * cell's style and lay the table out again to measure them
44294
+ */ setColumnWidths() {
44295
+ this.startWidths.forEach(([cell, width, below], index)=>{
44296
+ const delta = index ? -this.resizeDelta : this.resizeDelta;
44297
+ if (cell) {
44298
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(cell, 'width', ((width + delta) / this.startTableWidth * 100).toFixed(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.ACCURACY) + '%');
44299
+ }
44300
+ below.forEach((td)=>{
44301
+ td.style.removeProperty('width');
44302
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(td, 'style')) {
44303
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(td, 'style', null);
44304
+ }
44305
+ });
44306
+ });
44136
44307
  }
44137
44308
  /**
44138
44309
  * Resize whole table
44139
44310
  */ resizeTable() {
44140
44311
  const delta = this.resizeDelta * (this.isRTL ? -1 : 1);
44141
- const width = this.workTable.offsetWidth, parentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getContentWidth)(this.workTable.parentNode, this.j.ew);
44312
+ const width = this.startTableWidth, parentWidth = this.startParentWidth;
44142
44313
  // for RTL use mirror logic
44143
44314
  const rightSide = !this.wholeTable;
44144
44315
  const needChangeWidth = this.isRTL ? !rightSide : rightSide;
@@ -44147,10 +44318,9 @@ const key = 'table_processor_observer-resize';
44147
44318
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, 'width', (width + delta) / parentWidth * 100 + '%');
44148
44319
  } else {
44149
44320
  const side = this.isRTL ? 'marginRight' : 'marginLeft';
44150
- const margin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
44151
44321
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, {
44152
44322
  width: (width - delta) / parentWidth * 100 + '%',
44153
- [side]: (margin + delta) / parentWidth * 100 + '%'
44323
+ [side]: (this.startMargin + delta) / parentWidth * 100 + '%'
44154
44324
  });
44155
44325
  }
44156
44326
  }
@@ -44226,9 +44396,10 @@ const key = 'table_processor_observer-resize';
44226
44396
  if (!editor.o.tableAllowCellResize) {
44227
44397
  return;
44228
44398
  }
44229
- editor.e.off(this.j.ow, '.resize-cells').off('.resize-cells').on('change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells', ()=>{
44399
+ const observeTables = ()=>{
44230
44400
  ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', editor.editor).forEach(this.observe);
44231
- }).on(this.j.ow, 'scroll.resize-cells', ()=>{
44401
+ };
44402
+ 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', ()=>{
44232
44403
  if (!this.drag || this.workRow) {
44233
44404
  return;
44234
44405
  }
@@ -44244,6 +44415,8 @@ const key = 'table_processor_observer-resize';
44244
44415
  tableModule.normalizeTable(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(td, 'table', editor.editor));
44245
44416
  });
44246
44417
  });
44418
+ // None of those events comes with the editor's starting value
44419
+ observeTables();
44247
44420
  }
44248
44421
  /**
44249
44422
  * Add to every Table listeners
@@ -44257,7 +44430,9 @@ const key = 'table_processor_observer-resize';
44257
44430
  this.hideResizeHandle();
44258
44431
  }
44259
44432
  }).on(table, 'mousemove.resize-cells touchmove.resize-cells', this.j.async.throttle((event)=>{
44260
- if (this.j.isLocked) {
44433
+ // A drag from a cell isn't a resize, and the handle on
44434
+ // a border it passes would take its moves (#1778)
44435
+ if (this.j.isLocked || this.j.o.readonly || event.buttons) {
44261
44436
  return;
44262
44437
  }
44263
44438
  const cell = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.up(event.target, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isCell, table);
@@ -44290,8 +44465,15 @@ const key = 'table_processor_observer-resize';
44290
44465
  }
44291
44466
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "hideTimeout", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "drag", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "wholeTable", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "workCell", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "workTable", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "minX", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "maxX", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startX", 0), /**
44292
44467
  * The table's and its cells' styles as a column drag started, put back
44293
- * before each new width
44468
+ * as it ends, before the final widths
44294
44469
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startStyles", []), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startLeft", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startEdge", 0), /**
44470
+ * For each of the two columns a drag resizes, the cell whose width
44471
+ * `setColumnWidthByDelta` sets, with its width as the drag started, and
44472
+ * the cells below it, whose widths it clears
44473
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startWidths", []), /**
44474
+ * The table's width as the drag started, and for a drag of its edge, the
44475
+ * width inside what holds it and its margin on that side
44476
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startTableWidth", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startParentWidth", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startMargin", 0), /**
44295
44477
  * The row whose height the handle sets, or null while it sets a width
44296
44478
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "workRow", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startY", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startHeight", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "rowStyle", null), /**
44297
44479
  * The boxes that scroll the row, with their styles, as a row drag turns
@@ -46073,7 +46255,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.tableAllowCellSelecti
46073
46255
 
46074
46256
 
46075
46257
  const key = 'table_processor_observer';
46076
- const MOUSE_MOVE_LABEL = 'onMoveTableSelectCell';
46077
46258
  class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
46078
46259
  /**
46079
46260
  * Shortcut for Jodit.modules.Table
@@ -46088,6 +46269,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46088
46269
  // move the caret, as table-keyboard-navigation's do
46089
46270
  .on('keydown', this.__onKeyDown, {
46090
46271
  top: true
46272
+ }).on('clickEditor', this.__onClickAfterDrag, {
46273
+ top: true
46091
46274
  }).on('keydown.select-cells', (event)=>{
46092
46275
  if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB) {
46093
46276
  this.unselectCells();
@@ -46207,18 +46390,36 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46207
46390
  }
46208
46391
  this.__isSelectionMode = true;
46209
46392
  this.__selectedCell = cell;
46393
+ this.__movedTo = cell;
46210
46394
  this.__tableModule.addSelection(cell);
46211
- this.j.e.on(table, 'mousemove.select-cells touchmove.select-cells', // Don't use decorator because need clear label on mouseup
46212
- this.j.async.throttle(this.__onMove.bind(this, table), {
46213
- label: MOUSE_MOVE_LABEL,
46214
- timeout: this.j.defaultTimeout / 2
46215
- })).on(table, 'mouseup.select-cells touchend.select-cells', this.__onStopSelection.bind(this, table));
46395
+ 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));
46396
+ new Set([
46397
+ this.j.ew,
46398
+ this.j.ow
46399
+ ]).forEach((win)=>this.j.e.on(win, 'mouseup.select-cells touchend.select-cells', this.__onRelease.bind(this, table)));
46216
46400
  return false;
46217
46401
  }
46218
46402
  onOutsideClick() {
46219
46403
  this.__selectedCell = null;
46220
46404
  this.__onRemoveSelection();
46221
46405
  }
46406
+ onMouseDown() {
46407
+ this.__keepMarks = false;
46408
+ }
46409
+ /**
46410
+ * The click that ends a drag let go outside the table, and inside the
46411
+ * editor, lands on the editor. Taken on, it would unmark the cells and
46412
+ * close their popup. As for the click on a row after a drag over the
46413
+ * cells, the browser's own selection from the drag goes
46414
+ */ __onClickAfterDrag() {
46415
+ if (this.__keepMarks) {
46416
+ var _this_j_s_sel;
46417
+ this.__keepMarks = false;
46418
+ (_this_j_s_sel = this.j.s.sel) === null || _this_j_s_sel === void 0 ? void 0 : _this_j_s_sel.removeAllRanges();
46419
+ this.j.e.stopPropagation('clickEditor');
46420
+ return false;
46421
+ }
46422
+ }
46222
46423
  onChange() {
46223
46424
  if (!this.j.isLocked && !this.__isSelectionMode) {
46224
46425
  this.__onRemoveSelection();
@@ -46237,16 +46438,20 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46237
46438
  // Inside Shadow DOM `document.elementFromPoint` returns the shadow
46238
46439
  // host, so the lookup must start from the shadow root
46239
46440
  const 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);
46240
- if (!node) {
46241
- return;
46242
- }
46243
- const cell = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
46441
+ const cell = node && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
46244
46442
  'td',
46245
46443
  'th'
46246
46444
  ], table);
46247
46445
  if (!cell || !this.__selectedCell) {
46248
46446
  return;
46249
46447
  }
46448
+ // The marks change only when the mouse goes into another cell, and then
46449
+ // at once rather than throttled, as the browser's own selection from
46450
+ // the drag shows in the cells between until they do (#1778)
46451
+ if (cell === this.__movedTo) {
46452
+ return;
46453
+ }
46454
+ this.__movedTo = cell;
46250
46455
  if (cell !== this.__selectedCell) {
46251
46456
  this.j.lock(key);
46252
46457
  }
@@ -46285,7 +46490,6 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46285
46490
  * Stop a selection process
46286
46491
  */ __onStopSelection(table, e) {
46287
46492
  var _this_j_o_shadowRoot;
46288
- var _box_bound__, _box_bound__1;
46289
46493
  if (!this.__selectedCell) {
46290
46494
  return;
46291
46495
  }
@@ -46308,10 +46512,33 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46308
46512
  if (ownTable && ownTable !== table) {
46309
46513
  return; // Nested tables
46310
46514
  }
46311
- const bound = this.__tableModule.getSelectedBound(table, [
46515
+ this.__showCellsPopup(table, [
46312
46516
  cell,
46313
46517
  this.__selectedCell
46314
- ]), box = this.__tableModule.formalMatrix(table);
46518
+ ]);
46519
+ this.__stopListening();
46520
+ }
46521
+ /**
46522
+ * A drag let go outside the table doesn't reach the table's `mouseup`, so
46523
+ * the window's ends it, leaving the cells marked as they were (#1774)
46524
+ */ __onRelease(table, e) {
46525
+ if (this.__isSelectionMode) {
46526
+ this.__isSelectionMode = false;
46527
+ if (!this.j.isLockedNotBy(key)) {
46528
+ this.j.unlock();
46529
+ }
46530
+ const cells = this.__tableModule.getAllSelectedCells();
46531
+ // One let go outside the editor clicks outside it, which unmarks them
46532
+ if (cells.length > 1 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.j.editor, e.target)) {
46533
+ this.__keepMarks = true;
46534
+ this.__showCellsPopup(table, cells);
46535
+ }
46536
+ }
46537
+ this.__stopListening();
46538
+ }
46539
+ __showCellsPopup(table, cells) {
46540
+ var _box_bound__, _box_bound__1;
46541
+ const bound = this.__tableModule.getSelectedBound(table, cells), box = this.__tableModule.formalMatrix(table);
46315
46542
  const 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]];
46316
46543
  // `getSelectedBound` keeps its `Infinity` sentinel when none of the
46317
46544
  // selected cells belong to this table's matrix — e.g. after a
@@ -46331,10 +46558,16 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46331
46558
  height: maxOffset.top - minOffset.top + maxOffset.height
46332
46559
  };
46333
46560
  }, 'cells');
46334
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', this.j.editor).forEach((table)=>{
46561
+ }
46562
+ __stopListening() {
46563
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', this.j.editor).forEach((table)=>{
46335
46564
  this.j.e.off(table, 'mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells');
46336
46565
  });
46337
- this.j.async.clearTimeout(MOUSE_MOVE_LABEL);
46566
+ new Set([
46567
+ this.j.ew,
46568
+ this.j.ow
46569
+ ]).forEach((win)=>this.j.e.off(win, 'mouseup.select-cells touchend.select-cells'));
46570
+ this.__movedTo = null;
46338
46571
  }
46339
46572
  /**
46340
46573
  * Remove selection for all cells
@@ -46505,7 +46738,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46505
46738
  }
46506
46739
  /** @override */ beforeDestruct(jodit) {
46507
46740
  this.__onRemoveSelection();
46508
- jodit.e.off('.select-cells').off('keydown', this.__onKeyDown);
46741
+ this.__stopListening();
46742
+ jodit.e.off('.select-cells').off('keydown', this.__onKeyDown).off('clickEditor', this.__onClickAfterDrag);
46509
46743
  }
46510
46744
  constructor(...args){
46511
46745
  super(...args), /**
@@ -46516,7 +46750,12 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46516
46750
  * First selected cell
46517
46751
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__selectedCell", null), /**
46518
46752
  * User is selecting cells now
46519
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isSelectionMode", false);
46753
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isSelectionMode", false), /**
46754
+ * The cell the marks were last drawn to
46755
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__movedTo", null), /**
46756
+ * A drag let go outside the table ends in a click on the editor, which
46757
+ * would unmark its cells
46758
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__keepMarks", false);
46520
46759
  }
46521
46760
  }
46522
46761
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(selectCells, "requires", [
@@ -46534,6 +46773,15 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46534
46773
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46535
46774
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':outsideClick')
46536
46775
  ], selectCells.prototype, "onOutsideClick", null);
46776
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46777
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
46778
+ ':mousedown',
46779
+ ':touchstart'
46780
+ ])
46781
+ ], selectCells.prototype, "onMouseDown", null);
46782
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46783
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
46784
+ ], selectCells.prototype, "__onClickAfterDrag", null);
46537
46785
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46538
46786
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':change')
46539
46787
  ], selectCells.prototype, "onChange", null);
@@ -46585,10 +46833,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46585
46833
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
46586
46834
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
46587
46835
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
46588
- /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(57821);
46589
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
46590
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4099);
46591
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(47670);
46836
+ /* harmony import */ var jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(88475);
46837
+ /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(57821);
46838
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(91206);
46839
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(4099);
46840
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(47670);
46592
46841
  /*!
46593
46842
  * Jodit Editor (https://xdsoft.net/jodit/)
46594
46843
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -46607,6 +46856,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46607
46856
 
46608
46857
 
46609
46858
 
46859
+
46610
46860
  /**
46611
46861
  * A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
46612
46862
  *
@@ -46617,22 +46867,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46617
46867
  * console.log(img.src);
46618
46868
  * })
46619
46869
  * ```
46620
- */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
46870
+ */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__.Plugin {
46621
46871
  afterInit(jodit) {
46622
46872
  this.proxyEventsList.forEach((eventName)=>{
46623
46873
  jodit.e.on(eventName + '.select', this.onStartSelection);
46624
46874
  });
46875
+ jodit.e.on('dblclick', this.__onDblClickBesideRow, {
46876
+ top: true
46877
+ });
46625
46878
  }
46626
46879
  beforeDestruct(jodit) {
46627
46880
  this.proxyEventsList.forEach((eventName)=>{
46628
- jodit.e.on(eventName + '.select', this.onStartSelection);
46881
+ jodit.e.off(eventName + '.select', this.onStartSelection);
46629
46882
  });
46883
+ this.__endPressBesideRow();
46884
+ jodit.e.off('dblclick', this.__onDblClickBesideRow);
46630
46885
  }
46631
46886
  onStartSelection(e) {
46632
46887
  const { j } = this;
46633
46888
  let result, target = e.target;
46634
46889
  while(result === undefined && target && target !== j.editor){
46635
- result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
46890
+ result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_7__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
46636
46891
  target = target.parentElement;
46637
46892
  }
46638
46893
  if (e.type === 'click' && result === undefined && target === j.editor) {
@@ -46652,10 +46907,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46652
46907
  }
46653
46908
  // Selecting the text of a popup input with the mouse and releasing
46654
46909
  // the button past the popup's edge is not a click outside of it.
46655
- if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup)) {
46910
+ if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup)) {
46656
46911
  return;
46657
46912
  }
46658
- const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup);
46913
+ const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup);
46659
46914
  if (!box) {
46660
46915
  this.j.e.fire('outsideClick', e);
46661
46916
  }
@@ -46701,6 +46956,128 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46701
46956
  s.setCursorAfter(text);
46702
46957
  }
46703
46958
  }
46959
+ /**
46960
+ * The table row the mouse is to the right of
46961
+ */ __rowBeside(e) {
46962
+ var _rows_find;
46963
+ const { j } = this;
46964
+ const target = e.target;
46965
+ if (j.o.readonly || e.button !== 0 || e.detail > 2 || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isHTMLElement(target) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(target, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isCell, j.editor)) {
46966
+ return null;
46967
+ }
46968
+ const table = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(target.children).find((elm)=>{
46969
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(elm, 'table')) {
46970
+ return false;
46971
+ }
46972
+ const box = elm.getBoundingClientRect();
46973
+ return e.clientX >= box.right && e.clientY >= box.top && e.clientY < box.bottom;
46974
+ });
46975
+ const rows = table ? (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(table.rows).filter((row)=>row.cells.length) : [];
46976
+ if (!table || !rows.length) {
46977
+ return null;
46978
+ }
46979
+ const row = (_rows_find = rows.find((row)=>e.clientY < row.getBoundingClientRect().bottom)) !== null && _rows_find !== void 0 ? _rows_find : rows[rows.length - 1];
46980
+ return {
46981
+ table,
46982
+ row
46983
+ };
46984
+ }
46985
+ /**
46986
+ * A press to the right of a table row puts the caret where Word's typing
46987
+ * goes from there: the start of the next row's first cell, or of the block
46988
+ * after the table for the last row (#1770). The browsers put it after the
46989
+ * table, whichever row it's beside, so typing starts a new line below it.
46990
+ * Their own press is stopped, as its drag would start after the table and
46991
+ * take in the rows below first
46992
+ */ onMouseDownBesideTableRow(e) {
46993
+ const { j } = this;
46994
+ const beside = this.__rowBeside(e);
46995
+ if (!beside) {
46996
+ return;
46997
+ }
46998
+ // A press before the last one was let go must not stack its listeners
46999
+ this.__endPressBesideRow();
47000
+ e.preventDefault();
47001
+ this.__putCaretBesideRow(beside.table, beside.row);
47002
+ this.__pressBesideRow = {
47003
+ row: beside.row,
47004
+ caret: j.s.range.cloneRange()
47005
+ };
47006
+ j.e.on(j.ew, 'mousemove', this.__onDragFromRow);
47007
+ new Set([
47008
+ j.ew,
47009
+ j.ow
47010
+ ]).forEach((win)=>j.e.on(win, 'mouseup', this.__onReleaseFromRow));
47011
+ }
47012
+ /**
47013
+ * A drag from beside a row selects from the end of the row to the mouse,
47014
+ * and back beside the row it's the caret again
47015
+ */ __onDragFromRow(e) {
47016
+ var _this___rowBeside;
47017
+ const { s } = this.j;
47018
+ const press = this.__pressBesideRow;
47019
+ if (!press || !(e.buttons & 1)) {
47020
+ this.__endPressBesideRow();
47021
+ return;
47022
+ }
47023
+ if (((_this___rowBeside = this.__rowBeside(e)) === null || _this___rowBeside === void 0 ? void 0 : _this___rowBeside.row) === press.row) {
47024
+ if (!s.isCollapsed()) {
47025
+ s.selectRange(press.caret.cloneRange());
47026
+ }
47027
+ return;
47028
+ }
47029
+ const { cells } = press.row;
47030
+ const last = cells[cells.length - 1];
47031
+ if (s.insertCursorAtPoint(e.clientX, e.clientY)) {
47032
+ var _s_sel;
47033
+ const { startContainer, startOffset } = s.range;
47034
+ (_s_sel = s.sel) === null || _s_sel === void 0 ? void 0 : _s_sel.setBaseAndExtent(last, last.childNodes.length, startContainer, startOffset);
47035
+ }
47036
+ }
47037
+ /**
47038
+ * In iframe mode, a press in an editor without the focus puts the caret at
47039
+ * its end, so a release that selected nothing puts it back
47040
+ */ __onReleaseFromRow() {
47041
+ const press = this.__pressBesideRow;
47042
+ this.__endPressBesideRow();
47043
+ if (press && this.j.s.isCollapsed()) {
47044
+ this.j.s.selectRange(press.caret);
47045
+ }
47046
+ }
47047
+ __endPressBesideRow() {
47048
+ const { j } = this;
47049
+ this.__pressBesideRow = null;
47050
+ j.e.off(j.ew, 'mousemove', this.__onDragFromRow);
47051
+ new Set([
47052
+ j.ew,
47053
+ j.ow
47054
+ ]).forEach((win)=>j.e.off(win, 'mouseup', this.__onReleaseFromRow));
47055
+ }
47056
+ /**
47057
+ * A double click beside a row is two clicks there, so add-new-line,
47058
+ * which adds a line on a double click with a caret, doesn't see it
47059
+ */ __onDblClickBesideRow(e) {
47060
+ if (this.__rowBeside(e)) {
47061
+ this.j.e.stopPropagation('dblclick');
47062
+ return false;
47063
+ }
47064
+ }
47065
+ __putCaretBesideRow(table, row) {
47066
+ const { j } = this;
47067
+ const rows = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(table.rows);
47068
+ const next = rows.slice(rows.indexOf(row) + 1).find((row)=>row.cells.length);
47069
+ let after = table.nextSibling;
47070
+ while(after && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(after)){
47071
+ after = after.nextSibling;
47072
+ }
47073
+ if (next) {
47074
+ j.s.setCursorIn(next.cells[0], true);
47075
+ } else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock(after) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(after, 'table') && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isContentEditable(after, j.editor)) {
47076
+ j.s.setCursorIn(after, true);
47077
+ } else {
47078
+ j.s.setCursorAfter(table);
47079
+ }
47080
+ }
46704
47081
  /**
46705
47082
  * Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
46706
47083
  * a collapsed cursor leaves empty marker elements with the caret inside; a
@@ -46764,7 +47141,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46764
47141
  * Where the last press started. Chrome reports a drag that begins in one
46765
47142
  * element and ends in another as a `click` on their common ancestor, so a
46766
47143
  * press inside a popup is remembered to tell such a drag from a real click.
46767
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null);
47144
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null), /**
47145
+ * The row a press to its right was beside, and the caret it put there,
47146
+ * while the button is down
47147
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressBesideRow", null);
46768
47148
  }
46769
47149
  }
46770
47150
  ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
@@ -46794,6 +47174,18 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46794
47174
  ':click'
46795
47175
  ])
46796
47176
  ], select.prototype, "onClickRightOfNestedListItem", null);
47177
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47178
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':mousedown')
47179
+ ], select.prototype, "onMouseDownBesideTableRow", null);
47180
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47181
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
47182
+ ], select.prototype, "__onDragFromRow", null);
47183
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47184
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
47185
+ ], select.prototype, "__onReleaseFromRow", null);
47186
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47187
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
47188
+ ], select.prototype, "__onDblClickBesideRow", null);
46797
47189
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46798
47190
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
46799
47191
  ':click'