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
@@ -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
  */
@@ -1824,7 +1824,7 @@ __webpack_require__.r(__webpack_exports__);
1824
1824
  * ```
1825
1825
  * @packageDocumentation
1826
1826
  * @module constants
1827
- */ const APP_VERSION = "4.19.6";
1827
+ */ const APP_VERSION = "4.19.7";
1828
1828
  // prettier-ignore
1829
1829
  const ES = "es2021";
1830
1830
  const IS_ES_MODERN = true;
@@ -13856,9 +13856,11 @@ const WRAP_NODES = new Set([
13856
13856
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13857
13857
  /* harmony export */ ApplyStyle: function() { return /* binding */ ApplyStyle; }
13858
13858
  /* harmony export */ });
13859
- /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51640);
13860
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(98394);
13861
- /* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(78462);
13859
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
13860
+ /* harmony import */ var jodit_core_helpers_utils_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28723);
13861
+ /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(51640);
13862
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(98394);
13863
+ /* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78462);
13862
13864
  /*!
13863
13865
  * Jodit Editor (https://xdsoft.net/jodit/)
13864
13866
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -13868,26 +13870,54 @@ const WRAP_NODES = new Set([
13868
13870
  */
13869
13871
 
13870
13872
 
13873
+
13874
+
13875
+ /**
13876
+ * Take a selected fragment out of the elements its style takes the place
13877
+ * of: one around it is split, so the fragment leaves it, and one in it is
13878
+ * unwrapped
13879
+ */ function takeOutOf(jodit, font, tags) {
13880
+ const range = jodit.s.createRange();
13881
+ let outer = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(font.parentNode, tags, jodit.editor);
13882
+ while(outer){
13883
+ range.selectNodeContents(outer);
13884
+ range.setEndBefore(font);
13885
+ const before = range.cloneContents();
13886
+ range.selectNodeContents(outer);
13887
+ range.setStartAfter(font);
13888
+ // Split only when there's more in it, as a split leaves empty copies
13889
+ // of the elements between
13890
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(before) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(range.cloneContents())) {
13891
+ (0,_api__WEBPACK_IMPORTED_MODULE_2__.extractSelectedPart)(outer, font, jodit);
13892
+ }
13893
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.unwrap(outer);
13894
+ outer = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(font.parentNode, tags, jodit.editor);
13895
+ }
13896
+ ;(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));
13897
+ }
13871
13898
  /** @internal */ function ApplyStyle(jodit, cs) {
13872
13899
  const { s: sel, editor } = jodit;
13873
13900
  editor.firstChild?.normalize(); // FF fix for test "commandsTest - Exec command "bold"
13874
13901
  const fakes = sel.fakes();
13875
13902
  const collapsed = sel.isCollapsed();
13876
- let mode = _constants__WEBPACK_IMPORTED_MODULE_1__.INITIAL;
13903
+ let mode = _constants__WEBPACK_IMPORTED_MODULE_3__.INITIAL;
13877
13904
  try {
13878
13905
  // for...of closes the generator on an exception, releasing every
13879
13906
  // temporary wrapper before the selection is restored in finally.
13880
13907
  for (const font of sel.wrapInTagGen(fakes)){
13908
+ if (cs.options.exclude?.length) {
13909
+ takeOutOf(jodit, font, cs.options.exclude);
13910
+ }
13881
13911
  let state = {
13882
13912
  collapsed,
13883
13913
  mode,
13884
13914
  element: font,
13885
- next: _transactions__WEBPACK_IMPORTED_MODULE_2__.states.START,
13915
+ next: _transactions__WEBPACK_IMPORTED_MODULE_4__.states.START,
13886
13916
  jodit,
13887
13917
  style: cs
13888
13918
  };
13889
- const machine = new _api__WEBPACK_IMPORTED_MODULE_0__.FiniteStateMachine(_transactions__WEBPACK_IMPORTED_MODULE_2__.states.START, _transactions__WEBPACK_IMPORTED_MODULE_2__.transactions);
13890
- while(!jodit.isInDestruct && machine.getState() !== _transactions__WEBPACK_IMPORTED_MODULE_2__.states.END){
13919
+ const machine = new _api__WEBPACK_IMPORTED_MODULE_2__.FiniteStateMachine(_transactions__WEBPACK_IMPORTED_MODULE_4__.states.START, _transactions__WEBPACK_IMPORTED_MODULE_4__.transactions);
13920
+ while(!jodit.isInDestruct && machine.getState() !== _transactions__WEBPACK_IMPORTED_MODULE_4__.states.END){
13891
13921
  state = machine.dispatch('exec', state);
13892
13922
  }
13893
13923
  // The first selected fragment determines how later fragments toggle.
@@ -18356,6 +18386,20 @@ const FOCUS_EVENTS = new Set([
18356
18386
  'focusin',
18357
18387
  'focusout'
18358
18388
  ]);
18389
+ const EDITING_KEYS = new Set([
18390
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_ENTER,
18391
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_BACKSPACE,
18392
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_DELETE
18393
+ ]);
18394
+ /**
18395
+ * Whether the input method (IME) is using the key. Safari fires the keydown
18396
+ * that ends a composition, as the Enter that confirms Japanese text, after
18397
+ * `compositionend`, and types Korean without one, so `isComposing` is false and
18398
+ * only keyCode 229 tells. Only the keys the editor turns into edits are held
18399
+ * back: the handlers that follow typing still see the rest.
18400
+ */ function isInputMethodKey(event) {
18401
+ return event.isComposing || event.keyCode === 229 && EDITING_KEYS.has(event.key);
18402
+ }
18359
18403
  const __defaultStyleDisplayKey = 'data-jodit-default-style-display';
18360
18404
  const __defaultClassesKey = 'data-jodit-default-classes';
18361
18405
  const NOEDIT = {
@@ -19412,7 +19456,7 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_10__.ViewWithToolbar
19412
19456
  }
19413
19457
  }
19414
19458
  const w = this.ew;
19415
- if (event instanceof w.KeyboardEvent && event.isComposing) {
19459
+ if (event instanceof w.KeyboardEvent && isInputMethodKey(event)) {
19416
19460
  return;
19417
19461
  }
19418
19462
  if (this.e && this.e.fire) {
@@ -28586,6 +28630,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28586
28630
  if (checkJoinBareText(jodit, fakeNode, backspace)) {
28587
28631
  return true;
28588
28632
  }
28633
+ // Old content can have an inline element round blocks beside the text:
28634
+ // moved inside them, the line joins the block as it would bare text
28635
+ // (#1781)
28636
+ const inline = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
28637
+ if (joinsBareText(jodit, edgeBlock(inline, backspace)) && moveInlineInside(inline, jodit.editor)) {
28638
+ return joinNeighbors(jodit, fakeNode, backspace, moved);
28639
+ }
28589
28640
  let nextBox = fakeNode, mainClosestBox = nextBox;
28590
28641
  // Find the main big closest element
28591
28642
  while(nextBox && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(nextBox, backspace) && nextBox.parentElement !== jodit.editor){
@@ -28866,7 +28917,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28866
28917
  * in `<div>a|<p>b</p>c</div>` gives `<div>a|b<br>c</div>`
28867
28918
  */ function checkJoinBareText(jodit, fakeNode, backspace) {
28868
28919
  const block = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
28869
- 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))) {
28920
+ if (!joinsBareText(jodit, block)) {
28870
28921
  return false;
28871
28922
  }
28872
28923
  const filter = (0,jodit_plugins_backspace_helpers__WEBPACK_IMPORTED_MODULE_2__.getMoveFilter)(jodit);
@@ -28893,6 +28944,23 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28893
28944
  jodit.s.setCursorBefore(fakeNode);
28894
28945
  return true;
28895
28946
  }
28947
+ /**
28948
+ * Whether a block joins the bare text beside it: not a list, a table or a
28949
+ * cell, and holding no block of its own
28950
+ */ function joinsBareText(jodit, block) {
28951
+ 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));
28952
+ }
28953
+ /**
28954
+ * The block an inline element holds on its side facing the caret, through
28955
+ * the inline elements in it: the `<p>` of `<span><strong><p>…</p></strong></span>`
28956
+ */ function edgeBlock(node, backspace) {
28957
+ let edge = node;
28958
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(edge) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(edge)){
28959
+ const children = Array.from(edge.childNodes).filter((child)=>!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child));
28960
+ edge = (backspace ? children[children.length - 1] : children[0]) ?? null;
28961
+ }
28962
+ return edge === node ? null : edge;
28963
+ }
28896
28964
  function checkMoveListContent(jodit, mainClosestBox, sibling, backspace) {
28897
28965
  // Process UL/LI/OL cases
28898
28966
  const siblingIsList = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.LIST_TAGS);
@@ -29342,7 +29410,6 @@ function isNotEditable(jodit, node) {
29342
29410
  if (!prn || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn)) {
29343
29411
  return false;
29344
29412
  }
29345
- const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
29346
29413
  do {
29347
29414
  if (prn && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(prn)) {
29348
29415
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(prn, fakeNode);
@@ -29357,6 +29424,9 @@ function isNotEditable(jodit, node) {
29357
29424
  if (found && (0,_check_join_two_lists__WEBPACK_IMPORTED_MODULE_2__.checkJoinTwoLists)(jodit, fakeNode, backspace)) {
29358
29425
  return true;
29359
29426
  }
29427
+ // Looked for once the empty elements have gone, as the one beside the
29428
+ // caret can be in them: the `<br>` that Delete in `<p>|<br></p>` leaves
29429
+ const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
29360
29430
  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)) {
29361
29431
  setCursorIn(neighbor, !backspace);
29362
29432
  } else {
@@ -29822,8 +29892,15 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.delete = {
29822
29892
  }
29823
29893
  cssRules[key] = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(cssOptions[key]) ? cssOptions[key][0] : cssOptions[key];
29824
29894
  });
29895
+ const element = control.tags ? control.tags[0] : undefined;
29825
29896
  editor.s.commitStyle({
29826
- element: control.tags ? control.tags[0] : undefined
29897
+ element,
29898
+ // As in the browsers and Word, each takes the other's place
29899
+ exclude: element === 'sub' ? [
29900
+ 'sup'
29901
+ ] : element === 'sup' ? [
29902
+ 'sub'
29903
+ ] : []
29827
29904
  });
29828
29905
  editor.synchronizeValues();
29829
29906
  return false;
@@ -32075,11 +32152,12 @@ __webpack_require__.r(__webpack_exports__);
32075
32152
  "use strict";
32076
32153
  /* unused harmony export deleteCommand */
32077
32154
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
32078
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27795);
32079
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28077);
32080
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65946);
32081
- /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4040);
32082
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(91206);
32155
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
32156
+ /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27795);
32157
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28077);
32158
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
32159
+ /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4040);
32160
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
32083
32161
  /*!
32084
32162
  * Jodit Editor (https://xdsoft.net/jodit/)
32085
32163
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -32095,6 +32173,7 @@ __webpack_require__.r(__webpack_exports__);
32095
32173
 
32096
32174
 
32097
32175
 
32176
+
32098
32177
  const NOT_EMPTY_CONTENT_TAGS = new Set([
32099
32178
  'img',
32100
32179
  'table',
@@ -32102,7 +32181,18 @@ const NOT_EMPTY_CONTENT_TAGS = new Set([
32102
32181
  'iframe',
32103
32182
  'hr'
32104
32183
  ]);
32105
- class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
32184
+ const KEEPS_SPACES = new Set([
32185
+ 'pre',
32186
+ 'pre-wrap',
32187
+ 'break-spaces'
32188
+ ]);
32189
+ /**
32190
+ * A plain space beside this neighbor isn't shown: there is none, or it's a
32191
+ * line break, a block or text starting (or ending) with a plain space
32192
+ */ function hidesSpace(neighbor, edge) {
32193
+ 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 ?? '');
32194
+ }
32195
+ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
32106
32196
  afterInit(jodit) {
32107
32197
  jodit.e.on('afterCommand.delete', (command)=>{
32108
32198
  if (command === 'delete') {
@@ -32123,11 +32213,11 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32123
32213
  */ __afterDeleteCommand() {
32124
32214
  const jodit = this.j;
32125
32215
  const current = jodit.s.current();
32126
- if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(current.firstChild, 'br')) {
32216
+ if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(current.firstChild, 'br')) {
32127
32217
  jodit.s.removeNode(current.firstChild);
32128
32218
  }
32129
- 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))) {
32130
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.detach(jodit.editor);
32219
+ 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))) {
32220
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.detach(jodit.editor);
32131
32221
  const node = jodit.s.setCursorIn(jodit.editor);
32132
32222
  jodit.s.removeNode(node);
32133
32223
  }
@@ -32147,14 +32237,15 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32147
32237
  range.deleteContents();
32148
32238
  const fake = jodit.createInside.fake();
32149
32239
  range.insertNode(fake);
32150
- const leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(fake, true);
32151
- const rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(fake, false);
32240
+ const leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.findSibling(fake, true);
32241
+ const rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.findSibling(fake, false);
32152
32242
  this.__moveContentInLeftSibling(fake, leftSibling, rightSibling);
32243
+ this.__keepSpacesVisible(fake);
32153
32244
  range.setStartBefore(fake);
32154
32245
  range.collapse(true);
32155
32246
  this.__moveCursorInEditableSibling(jodit, leftSibling, fake, range);
32156
32247
  this.__addBrInEmptyBlock(fake, range);
32157
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(fake);
32248
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
32158
32249
  jodit.s.selectRange(caret ?? range);
32159
32250
  return false;
32160
32251
  }
@@ -32168,23 +32259,23 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32168
32259
  * Returns where the caret goes, or null when no table is involved
32169
32260
  */ __clearSelectedCells(range) {
32170
32261
  const { editor, createInside } = this.j;
32171
- const startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell, editor);
32172
- const endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell, editor);
32262
+ const startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell, editor);
32263
+ const endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell, editor);
32173
32264
  if (startCell === endCell) {
32174
32265
  return null;
32175
32266
  }
32176
- const startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(startCell, 'table', editor);
32177
- const endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(endCell, 'table', editor);
32267
+ const startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(startCell, 'table', editor);
32268
+ const endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(endCell, 'table', editor);
32178
32269
  const caret = range.cloneRange();
32179
32270
  caret.collapse(true);
32180
32271
  const parts = [];
32181
32272
  const addParts = (table)=>{
32182
- (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)=>{
32273
+ (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)=>{
32183
32274
  const part = range.cloneRange();
32184
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(cell, range.startContainer)) {
32275
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.startContainer)) {
32185
32276
  part.setStart(cell, 0);
32186
32277
  }
32187
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(cell, range.endContainer)) {
32278
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.endContainer)) {
32188
32279
  part.setEnd(cell, cell.childNodes.length);
32189
32280
  }
32190
32281
  parts.push([
@@ -32207,9 +32298,9 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32207
32298
  }
32208
32299
  parts.forEach(([cell, part])=>{
32209
32300
  part.deleteContents();
32210
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(cell)) {
32211
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.detach(cell);
32212
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(cell, createInside.element('br'));
32301
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(cell)) {
32302
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.detach(cell);
32303
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(cell, createInside.element('br'));
32213
32304
  }
32214
32305
  });
32215
32306
  return startTable ? caret : null;
@@ -32217,46 +32308,72 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32217
32308
  __moveContentInLeftSibling(fake, leftSibling, rightSibling) {
32218
32309
  leftSibling = this.__defineRightLeftBox(leftSibling);
32219
32310
  // Nothing is moved into a table, and a block left empty after it goes
32220
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(leftSibling, 'table')) {
32221
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(rightSibling)) {
32222
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32311
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(leftSibling, 'table')) {
32312
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
32313
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32223
32314
  }
32224
32315
  return;
32225
32316
  }
32226
- 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)) {
32227
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, fake);
32228
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.moveContent(rightSibling, leftSibling);
32229
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32317
+ 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)) {
32318
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, fake);
32319
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.moveContent(rightSibling, leftSibling);
32320
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32230
32321
  }
32231
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(rightSibling.firstElementChild)) {
32322
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(rightSibling.firstElementChild)) {
32232
32323
  const item = rightSibling.firstElementChild;
32233
32324
  // What's left of the right list's first item joins the left block,
32234
32325
  // up to a list nested in the item
32235
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(leftSibling)) {
32236
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, fake);
32237
- while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(item.firstChild)){
32238
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, item.firstChild);
32326
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(leftSibling)) {
32327
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, fake);
32328
+ while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(item.firstChild)){
32329
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, item.firstChild);
32239
32330
  }
32240
32331
  }
32241
32332
  // Remove empty right LI
32242
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(item)) {
32243
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(item);
32333
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item)) {
32334
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(item);
32244
32335
  }
32245
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(rightSibling)) {
32246
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32336
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
32337
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32247
32338
  }
32248
32339
  }
32249
32340
  }
32341
+ /**
32342
+ * A plain space the deletion leaves at an edge of the block, before a line
32343
+ * break or next to another space isn't shown, and the browser drops it when
32344
+ * the next char is typed. It becomes non-breaking, as in the browsers' own
32345
+ * delete and in Backspace without a selection (#1522)
32346
+ */ __keepSpacesVisible(fake) {
32347
+ const { jodit } = this;
32348
+ const block = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor) ?? jodit.editor;
32349
+ if (KEEPS_SPACES.has(jodit.ew.getComputedStyle(block).whiteSpace)) {
32350
+ return;
32351
+ }
32352
+ const before = this.__findNeighbor(fake, true, block);
32353
+ const after = this.__findNeighbor(fake, false, block);
32354
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(before) && hidesSpace(after, /^ /)) {
32355
+ before.nodeValue = before.nodeValue.replace(/ +$/, (spaces)=>jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.NBSP_SPACE.repeat(spaces.length));
32356
+ }
32357
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(after) && hidesSpace(before, / $/)) {
32358
+ after.nodeValue = after.nodeValue.replace(/^ +/, (spaces)=>jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.NBSP_SPACE.repeat(spaces.length));
32359
+ }
32360
+ }
32361
+ /**
32362
+ * The text, line break or other element next to the caret in its block,
32363
+ * looking inside inline elements
32364
+ */ __findNeighbor(fake, left, block) {
32365
+ 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)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(node) ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.trimInv)(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), block);
32366
+ }
32250
32367
  /**
32251
32368
  * If left sibling is list - return last leaf
32252
32369
  */ __defineRightLeftBox(leftSibling) {
32253
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(leftSibling)) {
32370
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(leftSibling)) {
32254
32371
  return leftSibling;
32255
32372
  }
32256
32373
  let lastLeaf = leftSibling.lastElementChild;
32257
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(lastLeaf)) {
32374
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(lastLeaf)) {
32258
32375
  lastLeaf = this.j.createInside.element('li');
32259
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, lastLeaf);
32376
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, lastLeaf);
32260
32377
  }
32261
32378
  return lastLeaf;
32262
32379
  }
@@ -32264,21 +32381,21 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32264
32381
  * Add BR in the empty block left at the caret
32265
32382
  */ __addBrInEmptyBlock(fake, range) {
32266
32383
  const jodit = this.j;
32267
- if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
32384
+ if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
32268
32385
  const br = jodit.createInside.element('br');
32269
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(fake, br);
32386
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.after(fake, br);
32270
32387
  range.setStartBefore(br);
32271
32388
  range.collapse(true);
32272
32389
  }
32273
32390
  }
32274
32391
  __moveCursorInEditableSibling(jodit, leftSibling, fake, range) {
32275
- if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText(leftSibling)) {
32276
- const root = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock, jodit.editor) ?? jodit.editor;
32277
- const leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText, root);
32392
+ if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(leftSibling)) {
32393
+ const root = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor) ?? jodit.editor;
32394
+ const leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText, root);
32278
32395
  if (leftText) {
32279
32396
  range.setStartAfter(leftText);
32280
32397
  range.collapse(true);
32281
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(fake);
32398
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
32282
32399
  }
32283
32400
  }
32284
32401
  }
@@ -32286,7 +32403,7 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32286
32403
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(deleteCommand, "requires", [
32287
32404
  'backspace'
32288
32405
  ]);
32289
- jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('deleteCommand', deleteCommand);
32406
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('deleteCommand', deleteCommand);
32290
32407
 
32291
32408
 
32292
32409
  /***/ }),
@@ -42819,7 +42936,7 @@ const key = 'table_processor_observer-resize';
42819
42936
  /**
42820
42937
  * Click on resize handle
42821
42938
  */ onHandleMouseDown(event) {
42822
- if (this.j.isLocked) {
42939
+ if (this.j.isLocked || this.j.o.readonly) {
42823
42940
  return;
42824
42941
  }
42825
42942
  this.drag = true;
@@ -42854,10 +42971,15 @@ const key = 'table_processor_observer-resize';
42854
42971
  let box;
42855
42972
  this.minX = 0;
42856
42973
  this.maxX = 1000000;
42974
+ this.startTableWidth = this.workTable.offsetWidth;
42857
42975
  if (this.wholeTable != null) {
42858
- const tableBox = this.workTable.parentNode.getBoundingClientRect();
42976
+ const parent = this.workTable.parentNode;
42977
+ const tableBox = parent.getBoundingClientRect();
42859
42978
  this.minX = tableBox.left;
42860
42979
  this.maxX = this.minX + tableBox.width;
42980
+ const side = this.isRTL ? 'marginRight' : 'marginLeft';
42981
+ this.startParentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getContentWidth)(parent, this.j.ew);
42982
+ this.startMargin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
42861
42983
  } else {
42862
42984
  // find maximum columns
42863
42985
  const coordinate = this.module.formalCoordinate(this.workTable, this.workCell, true);
@@ -42871,6 +42993,17 @@ const key = 'table_processor_observer-resize';
42871
42993
  this.maxX = Math.min(box.left + box.width - jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.NEARBY / 2, this.maxX);
42872
42994
  }
42873
42995
  });
42996
+ const matrix = this.module.formalMatrix(this.workTable);
42997
+ this.startWidths = this.resizedColumns().map((column)=>{
42998
+ const cells = matrix.map((row)=>row[column]);
42999
+ const index = cells.findIndex((td)=>td.colSpan === 1 || cells.length === 1);
43000
+ const cell = cells[index];
43001
+ return [
43002
+ cell,
43003
+ cell ? cell.offsetWidth : 0,
43004
+ cells.slice(Math.max(index, 0) + 1)
43005
+ ];
43006
+ });
42874
43007
  }
42875
43008
  return false;
42876
43009
  }
@@ -42898,8 +43031,11 @@ const key = 'table_processor_observer-resize';
42898
43031
  x = this.maxX;
42899
43032
  }
42900
43033
  this.resizeDelta = x - this.startX + (!this.j.o.iframe ? 0 : workplacePosition.left);
42901
- this.restoreStyles();
42902
- this.resizeColumnsOrTable();
43034
+ if (this.wholeTable == null) {
43035
+ this.setColumnWidths();
43036
+ } else {
43037
+ this.resizeTable();
43038
+ }
42903
43039
  const tableBox = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.offset)(this.workTable, this.j, this.j.ed);
42904
43040
  Object.assign(this.resizeHandler.style, {
42905
43041
  left: this.startLeft + this.columnEdge() - this.startEdge + 'px',
@@ -43012,21 +43148,49 @@ const key = 'table_processor_observer-resize';
43012
43148
  };
43013
43149
  this.scrollFrame = this.j.async.requestAnimationFrame(scroll);
43014
43150
  }
43151
+ /**
43152
+ * The two columns a column drag resizes: the work cell's last, and the
43153
+ * next cell's first
43154
+ */ resizedColumns() {
43155
+ 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);
43156
+ return [
43157
+ this.module.formalCoordinate(this.workTable, this.workCell, true)[1],
43158
+ this.module.formalCoordinate(this.workTable, nextTD)[1]
43159
+ ];
43160
+ }
43015
43161
  /**
43016
43162
  * Resize only one column
43017
43163
  */ resizeColumns() {
43018
43164
  const delta = this.resizeDelta;
43019
43165
  const marked = [];
43020
43166
  const tableModule = this.module;
43021
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, this.workCell, true)[1], delta, true, marked);
43022
- 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);
43023
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, nextTD)[1], -delta, false, marked);
43167
+ const [column, nextColumn] = this.resizedColumns();
43168
+ tableModule.setColumnWidthByDelta(this.workTable, column, delta, true, marked);
43169
+ tableModule.setColumnWidthByDelta(this.workTable, nextColumn, -delta, false, marked);
43170
+ }
43171
+ /**
43172
+ * Sets the widths `resizeColumns` would while the handle is dragged, from
43173
+ * the widths the drag started with, so that a move doesn't put back every
43174
+ * cell's style and lay the table out again to measure them
43175
+ */ setColumnWidths() {
43176
+ this.startWidths.forEach(([cell, width, below], index)=>{
43177
+ const delta = index ? -this.resizeDelta : this.resizeDelta;
43178
+ if (cell) {
43179
+ (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) + '%');
43180
+ }
43181
+ below.forEach((td)=>{
43182
+ td.style.removeProperty('width');
43183
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(td, 'style')) {
43184
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(td, 'style', null);
43185
+ }
43186
+ });
43187
+ });
43024
43188
  }
43025
43189
  /**
43026
43190
  * Resize whole table
43027
43191
  */ resizeTable() {
43028
43192
  const delta = this.resizeDelta * (this.isRTL ? -1 : 1);
43029
- const width = this.workTable.offsetWidth, parentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getContentWidth)(this.workTable.parentNode, this.j.ew);
43193
+ const width = this.startTableWidth, parentWidth = this.startParentWidth;
43030
43194
  // for RTL use mirror logic
43031
43195
  const rightSide = !this.wholeTable;
43032
43196
  const needChangeWidth = this.isRTL ? !rightSide : rightSide;
@@ -43035,10 +43199,9 @@ const key = 'table_processor_observer-resize';
43035
43199
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, 'width', (width + delta) / parentWidth * 100 + '%');
43036
43200
  } else {
43037
43201
  const side = this.isRTL ? 'marginRight' : 'marginLeft';
43038
- const margin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
43039
43202
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, {
43040
43203
  width: (width - delta) / parentWidth * 100 + '%',
43041
- [side]: (margin + delta) / parentWidth * 100 + '%'
43204
+ [side]: (this.startMargin + delta) / parentWidth * 100 + '%'
43042
43205
  });
43043
43206
  }
43044
43207
  }
@@ -43114,9 +43277,10 @@ const key = 'table_processor_observer-resize';
43114
43277
  if (!editor.o.tableAllowCellResize) {
43115
43278
  return;
43116
43279
  }
43117
- editor.e.off(this.j.ow, '.resize-cells').off('.resize-cells').on('change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells', ()=>{
43280
+ const observeTables = ()=>{
43118
43281
  ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', editor.editor).forEach(this.observe);
43119
- }).on(this.j.ow, 'scroll.resize-cells', ()=>{
43282
+ };
43283
+ 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', ()=>{
43120
43284
  if (!this.drag || this.workRow) {
43121
43285
  return;
43122
43286
  }
@@ -43132,6 +43296,8 @@ const key = 'table_processor_observer-resize';
43132
43296
  tableModule.normalizeTable(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(td, 'table', editor.editor));
43133
43297
  });
43134
43298
  });
43299
+ // None of those events comes with the editor's starting value
43300
+ observeTables();
43135
43301
  }
43136
43302
  /**
43137
43303
  * Add to every Table listeners
@@ -43145,7 +43311,9 @@ const key = 'table_processor_observer-resize';
43145
43311
  this.hideResizeHandle();
43146
43312
  }
43147
43313
  }).on(table, 'mousemove.resize-cells touchmove.resize-cells', this.j.async.throttle((event)=>{
43148
- if (this.j.isLocked) {
43314
+ // A drag from a cell isn't a resize, and the handle on
43315
+ // a border it passes would take its moves (#1778)
43316
+ if (this.j.isLocked || this.j.o.readonly || event.buttons) {
43149
43317
  return;
43150
43318
  }
43151
43319
  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);
@@ -43178,8 +43346,15 @@ const key = 'table_processor_observer-resize';
43178
43346
  }
43179
43347
  }), (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), /**
43180
43348
  * The table's and its cells' styles as a column drag started, put back
43181
- * before each new width
43349
+ * as it ends, before the final widths
43182
43350
  */ (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), /**
43351
+ * For each of the two columns a drag resizes, the cell whose width
43352
+ * `setColumnWidthByDelta` sets, with its width as the drag started, and
43353
+ * the cells below it, whose widths it clears
43354
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startWidths", []), /**
43355
+ * The table's width as the drag started, and for a drag of its edge, the
43356
+ * width inside what holds it and its margin on that side
43357
+ */ (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), /**
43183
43358
  * The row whose height the handle sets, or null while it sets a width
43184
43359
  */ (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), /**
43185
43360
  * The boxes that scroll the row, with their styles, as a row drag turns
@@ -44929,7 +45104,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.tableAllowCellSelecti
44929
45104
 
44930
45105
 
44931
45106
  const key = 'table_processor_observer';
44932
- const MOUSE_MOVE_LABEL = 'onMoveTableSelectCell';
44933
45107
  class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
44934
45108
  /**
44935
45109
  * Shortcut for Jodit.modules.Table
@@ -44944,6 +45118,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
44944
45118
  // move the caret, as table-keyboard-navigation's do
44945
45119
  .on('keydown', this.__onKeyDown, {
44946
45120
  top: true
45121
+ }).on('clickEditor', this.__onClickAfterDrag, {
45122
+ top: true
44947
45123
  }).on('keydown.select-cells', (event)=>{
44948
45124
  if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB) {
44949
45125
  this.unselectCells();
@@ -45061,18 +45237,35 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45061
45237
  }
45062
45238
  this.__isSelectionMode = true;
45063
45239
  this.__selectedCell = cell;
45240
+ this.__movedTo = cell;
45064
45241
  this.__tableModule.addSelection(cell);
45065
- this.j.e.on(table, 'mousemove.select-cells touchmove.select-cells', // Don't use decorator because need clear label on mouseup
45066
- this.j.async.throttle(this.__onMove.bind(this, table), {
45067
- label: MOUSE_MOVE_LABEL,
45068
- timeout: this.j.defaultTimeout / 2
45069
- })).on(table, 'mouseup.select-cells touchend.select-cells', this.__onStopSelection.bind(this, table));
45242
+ 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));
45243
+ new Set([
45244
+ this.j.ew,
45245
+ this.j.ow
45246
+ ]).forEach((win)=>this.j.e.on(win, 'mouseup.select-cells touchend.select-cells', this.__onRelease.bind(this, table)));
45070
45247
  return false;
45071
45248
  }
45072
45249
  onOutsideClick() {
45073
45250
  this.__selectedCell = null;
45074
45251
  this.__onRemoveSelection();
45075
45252
  }
45253
+ onMouseDown() {
45254
+ this.__keepMarks = false;
45255
+ }
45256
+ /**
45257
+ * The click that ends a drag let go outside the table, and inside the
45258
+ * editor, lands on the editor. Taken on, it would unmark the cells and
45259
+ * close their popup. As for the click on a row after a drag over the
45260
+ * cells, the browser's own selection from the drag goes
45261
+ */ __onClickAfterDrag() {
45262
+ if (this.__keepMarks) {
45263
+ this.__keepMarks = false;
45264
+ this.j.s.sel?.removeAllRanges();
45265
+ this.j.e.stopPropagation('clickEditor');
45266
+ return false;
45267
+ }
45268
+ }
45076
45269
  onChange() {
45077
45270
  if (!this.j.isLocked && !this.__isSelectionMode) {
45078
45271
  this.__onRemoveSelection();
@@ -45090,16 +45283,20 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45090
45283
  // Inside Shadow DOM `document.elementFromPoint` returns the shadow
45091
45284
  // host, so the lookup must start from the shadow root
45092
45285
  const node = (this.j.o.shadowRoot ?? this.j.ed).elementFromPoint(e.clientX, e.clientY);
45093
- if (!node) {
45094
- return;
45095
- }
45096
- const cell = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
45286
+ const cell = node && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
45097
45287
  'td',
45098
45288
  'th'
45099
45289
  ], table);
45100
45290
  if (!cell || !this.__selectedCell) {
45101
45291
  return;
45102
45292
  }
45293
+ // The marks change only when the mouse goes into another cell, and then
45294
+ // at once rather than throttled, as the browser's own selection from
45295
+ // the drag shows in the cells between until they do (#1778)
45296
+ if (cell === this.__movedTo) {
45297
+ return;
45298
+ }
45299
+ this.__movedTo = cell;
45103
45300
  if (cell !== this.__selectedCell) {
45104
45301
  this.j.lock(key);
45105
45302
  }
@@ -45157,10 +45354,32 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45157
45354
  if (ownTable && ownTable !== table) {
45158
45355
  return; // Nested tables
45159
45356
  }
45160
- const bound = this.__tableModule.getSelectedBound(table, [
45357
+ this.__showCellsPopup(table, [
45161
45358
  cell,
45162
45359
  this.__selectedCell
45163
- ]), box = this.__tableModule.formalMatrix(table);
45360
+ ]);
45361
+ this.__stopListening();
45362
+ }
45363
+ /**
45364
+ * A drag let go outside the table doesn't reach the table's `mouseup`, so
45365
+ * the window's ends it, leaving the cells marked as they were (#1774)
45366
+ */ __onRelease(table, e) {
45367
+ if (this.__isSelectionMode) {
45368
+ this.__isSelectionMode = false;
45369
+ if (!this.j.isLockedNotBy(key)) {
45370
+ this.j.unlock();
45371
+ }
45372
+ const cells = this.__tableModule.getAllSelectedCells();
45373
+ // One let go outside the editor clicks outside it, which unmarks them
45374
+ if (cells.length > 1 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.j.editor, e.target)) {
45375
+ this.__keepMarks = true;
45376
+ this.__showCellsPopup(table, cells);
45377
+ }
45378
+ }
45379
+ this.__stopListening();
45380
+ }
45381
+ __showCellsPopup(table, cells) {
45382
+ const bound = this.__tableModule.getSelectedBound(table, cells), box = this.__tableModule.formalMatrix(table);
45164
45383
  const max = box[bound[1][0]]?.[bound[1][1]], min = box[bound[0][0]]?.[bound[0][1]];
45165
45384
  // `getSelectedBound` keeps its `Infinity` sentinel when none of the
45166
45385
  // selected cells belong to this table's matrix — e.g. after a
@@ -45180,10 +45399,16 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45180
45399
  height: maxOffset.top - minOffset.top + maxOffset.height
45181
45400
  };
45182
45401
  }, 'cells');
45183
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', this.j.editor).forEach((table)=>{
45402
+ }
45403
+ __stopListening() {
45404
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', this.j.editor).forEach((table)=>{
45184
45405
  this.j.e.off(table, 'mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells');
45185
45406
  });
45186
- this.j.async.clearTimeout(MOUSE_MOVE_LABEL);
45407
+ new Set([
45408
+ this.j.ew,
45409
+ this.j.ow
45410
+ ]).forEach((win)=>this.j.e.off(win, 'mouseup.select-cells touchend.select-cells'));
45411
+ this.__movedTo = null;
45187
45412
  }
45188
45413
  /**
45189
45414
  * Remove selection for all cells
@@ -45353,7 +45578,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45353
45578
  }
45354
45579
  /** @override */ beforeDestruct(jodit) {
45355
45580
  this.__onRemoveSelection();
45356
- jodit.e.off('.select-cells').off('keydown', this.__onKeyDown);
45581
+ this.__stopListening();
45582
+ jodit.e.off('.select-cells').off('keydown', this.__onKeyDown).off('clickEditor', this.__onClickAfterDrag);
45357
45583
  }
45358
45584
  constructor(...args){
45359
45585
  super(...args), /**
@@ -45364,7 +45590,12 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45364
45590
  * First selected cell
45365
45591
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__selectedCell", null), /**
45366
45592
  * User is selecting cells now
45367
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isSelectionMode", false);
45593
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isSelectionMode", false), /**
45594
+ * The cell the marks were last drawn to
45595
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__movedTo", null), /**
45596
+ * A drag let go outside the table ends in a click on the editor, which
45597
+ * would unmark its cells
45598
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__keepMarks", false);
45368
45599
  }
45369
45600
  }
45370
45601
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(selectCells, "requires", [
@@ -45382,6 +45613,15 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45382
45613
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
45383
45614
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':outsideClick')
45384
45615
  ], selectCells.prototype, "onOutsideClick", null);
45616
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
45617
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
45618
+ ':mousedown',
45619
+ ':touchstart'
45620
+ ])
45621
+ ], selectCells.prototype, "onMouseDown", null);
45622
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
45623
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
45624
+ ], selectCells.prototype, "__onClickAfterDrag", null);
45385
45625
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
45386
45626
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':change')
45387
45627
  ], selectCells.prototype, "onChange", null);
@@ -45433,10 +45673,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45433
45673
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
45434
45674
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
45435
45675
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
45436
- /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(57821);
45437
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
45438
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4099);
45439
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(47670);
45676
+ /* harmony import */ var jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(88475);
45677
+ /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(57821);
45678
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(91206);
45679
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(4099);
45680
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(47670);
45440
45681
  /*!
45441
45682
  * Jodit Editor (https://xdsoft.net/jodit/)
45442
45683
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -45455,6 +45696,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45455
45696
 
45456
45697
 
45457
45698
 
45699
+
45458
45700
  /**
45459
45701
  * A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
45460
45702
  *
@@ -45465,22 +45707,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45465
45707
  * console.log(img.src);
45466
45708
  * })
45467
45709
  * ```
45468
- */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
45710
+ */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__.Plugin {
45469
45711
  afterInit(jodit) {
45470
45712
  this.proxyEventsList.forEach((eventName)=>{
45471
45713
  jodit.e.on(eventName + '.select', this.onStartSelection);
45472
45714
  });
45715
+ jodit.e.on('dblclick', this.__onDblClickBesideRow, {
45716
+ top: true
45717
+ });
45473
45718
  }
45474
45719
  beforeDestruct(jodit) {
45475
45720
  this.proxyEventsList.forEach((eventName)=>{
45476
- jodit.e.on(eventName + '.select', this.onStartSelection);
45721
+ jodit.e.off(eventName + '.select', this.onStartSelection);
45477
45722
  });
45723
+ this.__endPressBesideRow();
45724
+ jodit.e.off('dblclick', this.__onDblClickBesideRow);
45478
45725
  }
45479
45726
  onStartSelection(e) {
45480
45727
  const { j } = this;
45481
45728
  let result, target = e.target;
45482
45729
  while(result === undefined && target && target !== j.editor){
45483
- result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
45730
+ result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_7__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
45484
45731
  target = target.parentElement;
45485
45732
  }
45486
45733
  if (e.type === 'click' && result === undefined && target === j.editor) {
@@ -45500,10 +45747,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45500
45747
  }
45501
45748
  // Selecting the text of a popup input with the mouse and releasing
45502
45749
  // the button past the popup's edge is not a click outside of it.
45503
- if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup)) {
45750
+ if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup)) {
45504
45751
  return;
45505
45752
  }
45506
- const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup);
45753
+ const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup);
45507
45754
  if (!box) {
45508
45755
  this.j.e.fire('outsideClick', e);
45509
45756
  }
@@ -45549,6 +45796,125 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45549
45796
  s.setCursorAfter(text);
45550
45797
  }
45551
45798
  }
45799
+ /**
45800
+ * The table row the mouse is to the right of
45801
+ */ __rowBeside(e) {
45802
+ const { j } = this;
45803
+ const target = e.target;
45804
+ 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)) {
45805
+ return null;
45806
+ }
45807
+ const table = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(target.children).find((elm)=>{
45808
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(elm, 'table')) {
45809
+ return false;
45810
+ }
45811
+ const box = elm.getBoundingClientRect();
45812
+ return e.clientX >= box.right && e.clientY >= box.top && e.clientY < box.bottom;
45813
+ });
45814
+ const rows = table ? (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(table.rows).filter((row)=>row.cells.length) : [];
45815
+ if (!table || !rows.length) {
45816
+ return null;
45817
+ }
45818
+ const row = rows.find((row)=>e.clientY < row.getBoundingClientRect().bottom) ?? rows[rows.length - 1];
45819
+ return {
45820
+ table,
45821
+ row
45822
+ };
45823
+ }
45824
+ /**
45825
+ * A press to the right of a table row puts the caret where Word's typing
45826
+ * goes from there: the start of the next row's first cell, or of the block
45827
+ * after the table for the last row (#1770). The browsers put it after the
45828
+ * table, whichever row it's beside, so typing starts a new line below it.
45829
+ * Their own press is stopped, as its drag would start after the table and
45830
+ * take in the rows below first
45831
+ */ onMouseDownBesideTableRow(e) {
45832
+ const { j } = this;
45833
+ const beside = this.__rowBeside(e);
45834
+ if (!beside) {
45835
+ return;
45836
+ }
45837
+ // A press before the last one was let go must not stack its listeners
45838
+ this.__endPressBesideRow();
45839
+ e.preventDefault();
45840
+ this.__putCaretBesideRow(beside.table, beside.row);
45841
+ this.__pressBesideRow = {
45842
+ row: beside.row,
45843
+ caret: j.s.range.cloneRange()
45844
+ };
45845
+ j.e.on(j.ew, 'mousemove', this.__onDragFromRow);
45846
+ new Set([
45847
+ j.ew,
45848
+ j.ow
45849
+ ]).forEach((win)=>j.e.on(win, 'mouseup', this.__onReleaseFromRow));
45850
+ }
45851
+ /**
45852
+ * A drag from beside a row selects from the end of the row to the mouse,
45853
+ * and back beside the row it's the caret again
45854
+ */ __onDragFromRow(e) {
45855
+ const { s } = this.j;
45856
+ const press = this.__pressBesideRow;
45857
+ if (!press || !(e.buttons & 1)) {
45858
+ this.__endPressBesideRow();
45859
+ return;
45860
+ }
45861
+ if (this.__rowBeside(e)?.row === press.row) {
45862
+ if (!s.isCollapsed()) {
45863
+ s.selectRange(press.caret.cloneRange());
45864
+ }
45865
+ return;
45866
+ }
45867
+ const { cells } = press.row;
45868
+ const last = cells[cells.length - 1];
45869
+ if (s.insertCursorAtPoint(e.clientX, e.clientY)) {
45870
+ const { startContainer, startOffset } = s.range;
45871
+ s.sel?.setBaseAndExtent(last, last.childNodes.length, startContainer, startOffset);
45872
+ }
45873
+ }
45874
+ /**
45875
+ * In iframe mode, a press in an editor without the focus puts the caret at
45876
+ * its end, so a release that selected nothing puts it back
45877
+ */ __onReleaseFromRow() {
45878
+ const press = this.__pressBesideRow;
45879
+ this.__endPressBesideRow();
45880
+ if (press && this.j.s.isCollapsed()) {
45881
+ this.j.s.selectRange(press.caret);
45882
+ }
45883
+ }
45884
+ __endPressBesideRow() {
45885
+ const { j } = this;
45886
+ this.__pressBesideRow = null;
45887
+ j.e.off(j.ew, 'mousemove', this.__onDragFromRow);
45888
+ new Set([
45889
+ j.ew,
45890
+ j.ow
45891
+ ]).forEach((win)=>j.e.off(win, 'mouseup', this.__onReleaseFromRow));
45892
+ }
45893
+ /**
45894
+ * A double click beside a row is two clicks there, so add-new-line,
45895
+ * which adds a line on a double click with a caret, doesn't see it
45896
+ */ __onDblClickBesideRow(e) {
45897
+ if (this.__rowBeside(e)) {
45898
+ this.j.e.stopPropagation('dblclick');
45899
+ return false;
45900
+ }
45901
+ }
45902
+ __putCaretBesideRow(table, row) {
45903
+ const { j } = this;
45904
+ const rows = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(table.rows);
45905
+ const next = rows.slice(rows.indexOf(row) + 1).find((row)=>row.cells.length);
45906
+ let after = table.nextSibling;
45907
+ while(after && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(after)){
45908
+ after = after.nextSibling;
45909
+ }
45910
+ if (next) {
45911
+ j.s.setCursorIn(next.cells[0], true);
45912
+ } 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)) {
45913
+ j.s.setCursorIn(after, true);
45914
+ } else {
45915
+ j.s.setCursorAfter(table);
45916
+ }
45917
+ }
45552
45918
  /**
45553
45919
  * Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
45554
45920
  * a collapsed cursor leaves empty marker elements with the caret inside; a
@@ -45610,7 +45976,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45610
45976
  * Where the last press started. Chrome reports a drag that begins in one
45611
45977
  * element and ends in another as a `click` on their common ancestor, so a
45612
45978
  * press inside a popup is remembered to tell such a drag from a real click.
45613
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null);
45979
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null), /**
45980
+ * The row a press to its right was beside, and the caret it put there,
45981
+ * while the button is down
45982
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressBesideRow", null);
45614
45983
  }
45615
45984
  }
45616
45985
  ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
@@ -45640,6 +46009,18 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45640
46009
  ':click'
45641
46010
  ])
45642
46011
  ], select.prototype, "onClickRightOfNestedListItem", null);
46012
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46013
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':mousedown')
46014
+ ], select.prototype, "onMouseDownBesideTableRow", null);
46015
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46016
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
46017
+ ], select.prototype, "__onDragFromRow", null);
46018
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46019
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
46020
+ ], select.prototype, "__onReleaseFromRow", null);
46021
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46022
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
46023
+ ], select.prototype, "__onDblClickBesideRow", null);
45643
46024
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
45644
46025
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
45645
46026
  ':click'