jodit 4.19.5 → 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 (85) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +21 -8
  4. package/es2015/jodit.js +847 -155
  5. package/es2015/jodit.min.js +21 -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 +20 -7
  13. package/es2018/jodit.min.js +21 -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 +21 -8
  18. package/es2021/jodit.js +832 -154
  19. package/es2021/jodit.min.js +69 -56
  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 +31 -18
  28. package/es2021.en/jodit.js +832 -154
  29. package/es2021.en/jodit.min.js +31 -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 +947 -166
  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/config.d.ts +31 -0
  51. package/esm/core/constants.js +1 -1
  52. package/esm/core/selection/helpers/move-node-inside-start.js +5 -2
  53. package/esm/core/selection/style/apply-style.js +31 -2
  54. package/esm/jodit.js +14 -2
  55. package/esm/plugins/backspace/cases/check-join-neighbors.js +36 -7
  56. package/esm/plugins/backspace/cases/check-remove-empty-parent.js +3 -1
  57. package/esm/plugins/bold/bold.js +4 -1
  58. package/esm/plugins/delete/delete.d.ts +12 -0
  59. package/esm/plugins/delete/delete.js +50 -1
  60. package/esm/plugins/link/config.d.ts +31 -0
  61. package/esm/plugins/link/config.js +3 -0
  62. package/esm/plugins/link/link.d.ts +27 -0
  63. package/esm/plugins/link/link.js +144 -2
  64. package/esm/plugins/link/tlds.d.ts +18 -0
  65. package/esm/plugins/link/tlds.js +33 -0
  66. package/esm/plugins/link/typed-link.d.ts +23 -0
  67. package/esm/plugins/link/typed-link.js +92 -0
  68. package/esm/plugins/resize-cells/resize-cells.d.ts +25 -1
  69. package/esm/plugins/resize-cells/resize-cells.js +84 -15
  70. package/esm/plugins/select/select.d.ts +35 -0
  71. package/esm/plugins/select/select.js +153 -1
  72. package/esm/plugins/select-cells/select-cells.d.ts +24 -0
  73. package/esm/plugins/select-cells/select-cells.js +81 -18
  74. package/esm/types/style.d.ts +5 -0
  75. package/package.json +1 -1
  76. package/types/config.d.ts +31 -0
  77. package/types/plugins/delete/delete.d.ts +12 -0
  78. package/types/plugins/link/config.d.ts +31 -0
  79. package/types/plugins/link/link.d.ts +27 -0
  80. package/types/plugins/link/tlds.d.ts +18 -0
  81. package/types/plugins/link/typed-link.d.ts +23 -0
  82. package/types/plugins/resize-cells/resize-cells.d.ts +25 -1
  83. package/types/plugins/select/select.d.ts +35 -0
  84. package/types/plugins/select-cells/select-cells.d.ts +24 -0
  85. 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.5
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.5";
1827
+ */ const APP_VERSION = "4.19.7";
1828
1828
  // prettier-ignore
1829
1829
  const ES = "es2021";
1830
1830
  const IS_ES_MODERN = true;
@@ -11222,7 +11222,10 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
11222
11222
  * When the cursor is positioned in its place, it must be inside the element and not outside its border.
11223
11223
  * @private
11224
11224
  */ function moveNodeInsideStart(j, node, start) {
11225
- let sibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(node, start), anotherSibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(node, !start);
11225
+ // A text node of non-breaking spaces trims to nothing, but it's text the
11226
+ // node mustn't move past
11227
+ const isContent = (n)=>!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(n) || Boolean(n.nodeValue?.includes(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.NBSP_SPACE));
11228
+ let sibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(node, start, isContent), anotherSibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(node, !start, isContent);
11226
11229
  while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(sibling) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INSEPARABLE_TAGS) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(sibling, j.editor) && (!anotherSibling || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(node, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement, j.editor))){
11227
11230
  if (start || !sibling.firstChild) {
11228
11231
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(sibling, node);
@@ -13853,9 +13856,11 @@ const WRAP_NODES = new Set([
13853
13856
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13854
13857
  /* harmony export */ ApplyStyle: function() { return /* binding */ ApplyStyle; }
13855
13858
  /* harmony export */ });
13856
- /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51640);
13857
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(98394);
13858
- /* 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);
13859
13864
  /*!
13860
13865
  * Jodit Editor (https://xdsoft.net/jodit/)
13861
13866
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -13865,26 +13870,54 @@ const WRAP_NODES = new Set([
13865
13870
  */
13866
13871
 
13867
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
+ }
13868
13898
  /** @internal */ function ApplyStyle(jodit, cs) {
13869
13899
  const { s: sel, editor } = jodit;
13870
13900
  editor.firstChild?.normalize(); // FF fix for test "commandsTest - Exec command "bold"
13871
13901
  const fakes = sel.fakes();
13872
13902
  const collapsed = sel.isCollapsed();
13873
- let mode = _constants__WEBPACK_IMPORTED_MODULE_1__.INITIAL;
13903
+ let mode = _constants__WEBPACK_IMPORTED_MODULE_3__.INITIAL;
13874
13904
  try {
13875
13905
  // for...of closes the generator on an exception, releasing every
13876
13906
  // temporary wrapper before the selection is restored in finally.
13877
13907
  for (const font of sel.wrapInTagGen(fakes)){
13908
+ if (cs.options.exclude?.length) {
13909
+ takeOutOf(jodit, font, cs.options.exclude);
13910
+ }
13878
13911
  let state = {
13879
13912
  collapsed,
13880
13913
  mode,
13881
13914
  element: font,
13882
- next: _transactions__WEBPACK_IMPORTED_MODULE_2__.states.START,
13915
+ next: _transactions__WEBPACK_IMPORTED_MODULE_4__.states.START,
13883
13916
  jodit,
13884
13917
  style: cs
13885
13918
  };
13886
- const machine = new _api__WEBPACK_IMPORTED_MODULE_0__.FiniteStateMachine(_transactions__WEBPACK_IMPORTED_MODULE_2__.states.START, _transactions__WEBPACK_IMPORTED_MODULE_2__.transactions);
13887
- 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){
13888
13921
  state = machine.dispatch('exec', state);
13889
13922
  }
13890
13923
  // The first selected fragment determines how later fragments toggle.
@@ -18353,6 +18386,20 @@ const FOCUS_EVENTS = new Set([
18353
18386
  'focusin',
18354
18387
  'focusout'
18355
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
+ }
18356
18403
  const __defaultStyleDisplayKey = 'data-jodit-default-style-display';
18357
18404
  const __defaultClassesKey = 'data-jodit-default-classes';
18358
18405
  const NOEDIT = {
@@ -19409,7 +19456,7 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_10__.ViewWithToolbar
19409
19456
  }
19410
19457
  }
19411
19458
  const w = this.ew;
19412
- if (event instanceof w.KeyboardEvent && event.isComposing) {
19459
+ if (event instanceof w.KeyboardEvent && isInputMethodKey(event)) {
19413
19460
  return;
19414
19461
  }
19415
19462
  if (this.e && this.e.fire) {
@@ -28583,6 +28630,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28583
28630
  if (checkJoinBareText(jodit, fakeNode, backspace)) {
28584
28631
  return true;
28585
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
+ }
28586
28640
  let nextBox = fakeNode, mainClosestBox = nextBox;
28587
28641
  // Find the main big closest element
28588
28642
  while(nextBox && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(nextBox, backspace) && nextBox.parentElement !== jodit.editor){
@@ -28863,7 +28917,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28863
28917
  * in `<div>a|<p>b</p>c</div>` gives `<div>a|b<br>c</div>`
28864
28918
  */ function checkJoinBareText(jodit, fakeNode, backspace) {
28865
28919
  const block = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
28866
- 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)) {
28867
28921
  return false;
28868
28922
  }
28869
28923
  const filter = (0,jodit_plugins_backspace_helpers__WEBPACK_IMPORTED_MODULE_2__.getMoveFilter)(jodit);
@@ -28890,6 +28944,23 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28890
28944
  jodit.s.setCursorBefore(fakeNode);
28891
28945
  return true;
28892
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
+ }
28893
28964
  function checkMoveListContent(jodit, mainClosestBox, sibling, backspace) {
28894
28965
  // Process UL/LI/OL cases
28895
28966
  const siblingIsList = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.LIST_TAGS);
@@ -29339,7 +29410,6 @@ function isNotEditable(jodit, node) {
29339
29410
  if (!prn || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn)) {
29340
29411
  return false;
29341
29412
  }
29342
- const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
29343
29413
  do {
29344
29414
  if (prn && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(prn)) {
29345
29415
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(prn, fakeNode);
@@ -29354,6 +29424,9 @@ function isNotEditable(jodit, node) {
29354
29424
  if (found && (0,_check_join_two_lists__WEBPACK_IMPORTED_MODULE_2__.checkJoinTwoLists)(jodit, fakeNode, backspace)) {
29355
29425
  return true;
29356
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);
29357
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)) {
29358
29431
  setCursorIn(neighbor, !backspace);
29359
29432
  } else {
@@ -29819,8 +29892,15 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.delete = {
29819
29892
  }
29820
29893
  cssRules[key] = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(cssOptions[key]) ? cssOptions[key][0] : cssOptions[key];
29821
29894
  });
29895
+ const element = control.tags ? control.tags[0] : undefined;
29822
29896
  editor.s.commitStyle({
29823
- 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
+ ] : []
29824
29904
  });
29825
29905
  editor.synchronizeValues();
29826
29906
  return false;
@@ -32072,11 +32152,12 @@ __webpack_require__.r(__webpack_exports__);
32072
32152
  "use strict";
32073
32153
  /* unused harmony export deleteCommand */
32074
32154
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
32075
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27795);
32076
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28077);
32077
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65946);
32078
- /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4040);
32079
- /* 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);
32080
32161
  /*!
32081
32162
  * Jodit Editor (https://xdsoft.net/jodit/)
32082
32163
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -32092,6 +32173,7 @@ __webpack_require__.r(__webpack_exports__);
32092
32173
 
32093
32174
 
32094
32175
 
32176
+
32095
32177
  const NOT_EMPTY_CONTENT_TAGS = new Set([
32096
32178
  'img',
32097
32179
  'table',
@@ -32099,7 +32181,18 @@ const NOT_EMPTY_CONTENT_TAGS = new Set([
32099
32181
  'iframe',
32100
32182
  'hr'
32101
32183
  ]);
32102
- 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 {
32103
32196
  afterInit(jodit) {
32104
32197
  jodit.e.on('afterCommand.delete', (command)=>{
32105
32198
  if (command === 'delete') {
@@ -32120,11 +32213,11 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32120
32213
  */ __afterDeleteCommand() {
32121
32214
  const jodit = this.j;
32122
32215
  const current = jodit.s.current();
32123
- 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')) {
32124
32217
  jodit.s.removeNode(current.firstChild);
32125
32218
  }
32126
- 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))) {
32127
- 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);
32128
32221
  const node = jodit.s.setCursorIn(jodit.editor);
32129
32222
  jodit.s.removeNode(node);
32130
32223
  }
@@ -32144,14 +32237,15 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32144
32237
  range.deleteContents();
32145
32238
  const fake = jodit.createInside.fake();
32146
32239
  range.insertNode(fake);
32147
- const leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(fake, true);
32148
- 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);
32149
32242
  this.__moveContentInLeftSibling(fake, leftSibling, rightSibling);
32243
+ this.__keepSpacesVisible(fake);
32150
32244
  range.setStartBefore(fake);
32151
32245
  range.collapse(true);
32152
32246
  this.__moveCursorInEditableSibling(jodit, leftSibling, fake, range);
32153
32247
  this.__addBrInEmptyBlock(fake, range);
32154
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(fake);
32248
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
32155
32249
  jodit.s.selectRange(caret ?? range);
32156
32250
  return false;
32157
32251
  }
@@ -32165,23 +32259,23 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32165
32259
  * Returns where the caret goes, or null when no table is involved
32166
32260
  */ __clearSelectedCells(range) {
32167
32261
  const { editor, createInside } = this.j;
32168
- const startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell, editor);
32169
- 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);
32170
32264
  if (startCell === endCell) {
32171
32265
  return null;
32172
32266
  }
32173
- const startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(startCell, 'table', editor);
32174
- 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);
32175
32269
  const caret = range.cloneRange();
32176
32270
  caret.collapse(true);
32177
32271
  const parts = [];
32178
32272
  const addParts = (table)=>{
32179
- (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)=>{
32180
32274
  const part = range.cloneRange();
32181
- 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)) {
32182
32276
  part.setStart(cell, 0);
32183
32277
  }
32184
- 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)) {
32185
32279
  part.setEnd(cell, cell.childNodes.length);
32186
32280
  }
32187
32281
  parts.push([
@@ -32204,9 +32298,9 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32204
32298
  }
32205
32299
  parts.forEach(([cell, part])=>{
32206
32300
  part.deleteContents();
32207
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(cell)) {
32208
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.detach(cell);
32209
- 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'));
32210
32304
  }
32211
32305
  });
32212
32306
  return startTable ? caret : null;
@@ -32214,46 +32308,72 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32214
32308
  __moveContentInLeftSibling(fake, leftSibling, rightSibling) {
32215
32309
  leftSibling = this.__defineRightLeftBox(leftSibling);
32216
32310
  // Nothing is moved into a table, and a block left empty after it goes
32217
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(leftSibling, 'table')) {
32218
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(rightSibling)) {
32219
- 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);
32220
32314
  }
32221
32315
  return;
32222
32316
  }
32223
- 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)) {
32224
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, fake);
32225
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.moveContent(rightSibling, leftSibling);
32226
- 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);
32227
32321
  }
32228
- 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)) {
32229
32323
  const item = rightSibling.firstElementChild;
32230
32324
  // What's left of the right list's first item joins the left block,
32231
32325
  // up to a list nested in the item
32232
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(leftSibling)) {
32233
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, fake);
32234
- while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(item.firstChild)){
32235
- 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);
32236
32330
  }
32237
32331
  }
32238
32332
  // Remove empty right LI
32239
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(item)) {
32240
- 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);
32241
32335
  }
32242
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(rightSibling)) {
32243
- 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);
32244
32338
  }
32245
32339
  }
32246
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
+ }
32247
32367
  /**
32248
32368
  * If left sibling is list - return last leaf
32249
32369
  */ __defineRightLeftBox(leftSibling) {
32250
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(leftSibling)) {
32370
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(leftSibling)) {
32251
32371
  return leftSibling;
32252
32372
  }
32253
32373
  let lastLeaf = leftSibling.lastElementChild;
32254
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(lastLeaf)) {
32374
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(lastLeaf)) {
32255
32375
  lastLeaf = this.j.createInside.element('li');
32256
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, lastLeaf);
32376
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, lastLeaf);
32257
32377
  }
32258
32378
  return lastLeaf;
32259
32379
  }
@@ -32261,21 +32381,21 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32261
32381
  * Add BR in the empty block left at the caret
32262
32382
  */ __addBrInEmptyBlock(fake, range) {
32263
32383
  const jodit = this.j;
32264
- 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) {
32265
32385
  const br = jodit.createInside.element('br');
32266
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(fake, br);
32386
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.after(fake, br);
32267
32387
  range.setStartBefore(br);
32268
32388
  range.collapse(true);
32269
32389
  }
32270
32390
  }
32271
32391
  __moveCursorInEditableSibling(jodit, leftSibling, fake, range) {
32272
- if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText(leftSibling)) {
32273
- 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;
32274
- 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);
32275
32395
  if (leftText) {
32276
32396
  range.setStartAfter(leftText);
32277
32397
  range.collapse(true);
32278
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(fake);
32398
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
32279
32399
  }
32280
32400
  }
32281
32401
  }
@@ -32283,7 +32403,7 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32283
32403
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(deleteCommand, "requires", [
32284
32404
  'backspace'
32285
32405
  ]);
32286
- jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('deleteCommand', deleteCommand);
32406
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('deleteCommand', deleteCommand);
32287
32407
 
32288
32408
 
32289
32409
  /***/ }),
@@ -39952,6 +40072,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.link = {
39952
40072
  followOnDblClick: false,
39953
40073
  processVideoLink: true,
39954
40074
  processPastedLink: true,
40075
+ processTypedLink: false,
40076
+ typedLinkTlds: [],
40077
+ typedLinkFileEndings: [
40078
+ 'zip',
40079
+ 'mov',
40080
+ 'md',
40081
+ 'py',
40082
+ 'sh',
40083
+ 'pub'
40084
+ ],
39955
40085
  deriveUrlFromText: false,
39956
40086
  noFollowCheckbox: true,
39957
40087
  openInNewTabCheckbox: true,
@@ -40003,12 +40133,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40003
40133
  /* unused harmony export link */
40004
40134
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
40005
40135
  /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
40006
- /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(84839);
40007
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(27795);
40008
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
40009
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
40010
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
40011
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(65230);
40136
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
40137
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
40138
+ /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27795);
40139
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
40140
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(65946);
40141
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
40142
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(65230);
40143
+ /* harmony import */ var _typed_link__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(99763);
40012
40144
  /*!
40013
40145
  * Jodit Editor (https://xdsoft.net/jodit/)
40014
40146
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -40025,9 +40157,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40025
40157
 
40026
40158
 
40027
40159
 
40160
+
40161
+
40028
40162
  /**
40029
40163
  * Process link. Insert, dblclick or remove format
40030
- */ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
40164
+ */ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
40031
40165
  /** @override */ afterInit(jodit) {
40032
40166
  if (jodit.o.link.followOnDblClick) {
40033
40167
  jodit.e.on('dblclick.link', this.__onDblClickOnLink);
@@ -40036,6 +40170,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40036
40170
  if (jodit.o.link.processPastedLink) {
40037
40171
  jodit.e.on('processPaste.link', this.onProcessPasteLink);
40038
40172
  }
40173
+ if (jodit.o.link.processTypedLink) {
40174
+ this.__linkAfterEnter = jodit.async.microDebounce(this.__linkTyped);
40175
+ jodit.e.on('input.link', this.__onTypedSpace).on('beforeEnter.link', this.__onBeforeEnter).on('afterEnter.link', this.__onAfterEnter).on('mousedown.link blur.link beforeCommand.link', this.__forgetLink)// Without a namespace it runs ahead of table navigation,
40176
+ // which moves the caret on Tab, and of the backspace plugin
40177
+ .on('keydown', this.__onKeyDown, {
40178
+ top: true
40179
+ });
40180
+ }
40039
40181
  jodit.e.on('generateLinkForm.link', this.__generateForm);
40040
40182
  jodit.registerCommand('openLinkDialog', {
40041
40183
  exec: ()=>{
@@ -40049,7 +40191,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40049
40191
  dialog.setContent(htmlForm);
40050
40192
  dialog.open();
40051
40193
  jodit.async.requestIdleCallback(()=>{
40052
- const { url_input } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.refs)(htmlForm.container);
40194
+ const { url_input } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm.container);
40053
40195
  url_input?.focus();
40054
40196
  });
40055
40197
  },
@@ -40057,10 +40199,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40057
40199
  });
40058
40200
  }
40059
40201
  __onDblClickOnLink(e) {
40060
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(e.target, 'a')) {
40202
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
40061
40203
  return;
40062
40204
  }
40063
- const href = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(e.target, 'href');
40205
+ const href = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(e.target, 'href');
40064
40206
  if (href) {
40065
40207
  location.href = href;
40066
40208
  e.preventDefault();
@@ -40068,23 +40210,23 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40068
40210
  }
40069
40211
  onProcessPasteLink(ignore, html) {
40070
40212
  const { jodit } = this;
40071
- if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isURL)(html) || !jodit.o.link.processPastedLink) {
40213
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isURL)(html) || !jodit.o.link.processPastedLink) {
40072
40214
  return;
40073
40215
  }
40074
40216
  jodit.e.stopPropagation('processPaste');
40075
40217
  if (jodit.o.link.processVideoLink) {
40076
- const embed = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.call)(jodit.o.video?.parseUrlToVideoEmbed ?? jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.convertMediaUrlToVideoEmbed, html, {
40218
+ const embed = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.call)(jodit.o.video?.parseUrlToVideoEmbed ?? jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.convertMediaUrlToVideoEmbed, html, {
40077
40219
  width: jodit.o.video?.defaultWidth,
40078
40220
  height: jodit.o.video?.defaultHeight
40079
40221
  });
40080
40222
  if (embed !== html) {
40081
- const media = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.prepareEmbedCode)(jodit, embed);
40082
- return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isString)(media) ? jodit.createInside.fromHTML(media) : media;
40223
+ const media = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.prepareEmbedCode)(jodit, embed);
40224
+ return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(media) ? jodit.createInside.fromHTML(media) : media;
40083
40225
  }
40084
40226
  }
40085
40227
  if (jodit.s.isCollapsed()) {
40086
40228
  const a = jodit.createInside.element('a');
40087
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'href', html);
40229
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', html);
40088
40230
  a.textContent = html;
40089
40231
  jodit.e.fire('applyLink', jodit, a, null);
40090
40232
  return a;
@@ -40102,16 +40244,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40102
40244
  const i18n = jodit.i18n.bind(jodit);
40103
40245
  const { openInNewTabCheckbox, openInNewTabCheckboxDefaultChecked, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
40104
40246
  const html = formTemplate(jodit);
40105
- const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isString)(html) ? jodit.c.fromHTML(html, {
40247
+ const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) ? jodit.c.fromHTML(html, {
40106
40248
  target_checkbox_box: openInNewTabCheckbox,
40107
40249
  nofollow_checkbox_box: noFollowCheckbox
40108
40250
  }) : html;
40109
- const htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isElement(form) ? form : form.container;
40110
- const elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.refs)(htmlForm);
40251
+ const htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form) ? form : form.container;
40252
+ const elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm);
40111
40253
  const { insert, unlink, content_input_box } = elements;
40112
40254
  const { target_checkbox, nofollow_checkbox, url_input } = elements;
40113
40255
  const currentElement = current;
40114
- const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isImage(currentElement);
40256
+ const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isImage(currentElement);
40115
40257
  let { content_input } = elements;
40116
40258
  const { className_input } = elements, { className_select } = elements, { aria_label_input } = elements;
40117
40259
  if (!content_input) {
@@ -40124,12 +40266,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40124
40266
  htmlForm.classList.add(formClassName);
40125
40267
  }
40126
40268
  if (isImageContent) {
40127
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.hide(content_input_box);
40269
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(content_input_box);
40128
40270
  }
40129
40271
  let link;
40130
- const getSelectionText = ()=>link ? link.innerText : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.stripTags)(jodit.s.range.cloneContents(), jodit.ed);
40131
- if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.closest(current, 'a', jodit.editor)) {
40132
- link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.closest(current, 'a', jodit.editor);
40272
+ const getSelectionText = ()=>link ? link.innerText : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.stripTags)(jodit.s.range.cloneContents(), jodit.ed);
40273
+ if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(current, 'a', jodit.editor)) {
40274
+ link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(current, 'a', jodit.editor);
40133
40275
  } else {
40134
40276
  link = false;
40135
40277
  }
@@ -40137,22 +40279,22 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40137
40279
  content_input.value = getSelectionText();
40138
40280
  }
40139
40281
  if (aria_label_input) {
40140
- aria_label_input.value = link ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(link, 'aria-label') || '' : '';
40282
+ aria_label_input.value = link ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'aria-label') || '' : '';
40141
40283
  }
40142
40284
  if (link) {
40143
- url_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(link, 'href') || '';
40285
+ url_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href') || '';
40144
40286
  if (modeClassName) {
40145
40287
  readClassnames(modeClassName, className_input, link, className_select);
40146
40288
  }
40147
40289
  if (openInNewTabCheckbox && target_checkbox) {
40148
- target_checkbox.checked = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(link, 'target') === '_blank';
40290
+ target_checkbox.checked = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'target') === '_blank';
40149
40291
  }
40150
40292
  if (noFollowCheckbox && nofollow_checkbox) {
40151
- nofollow_checkbox.checked = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(link, 'rel') || '').split(/\s+/).includes('nofollow');
40293
+ nofollow_checkbox.checked = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'rel') || '').split(/\s+/).includes('nofollow');
40152
40294
  }
40153
40295
  insert.textContent = i18n('Update');
40154
40296
  } else {
40155
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.hide(unlink);
40297
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(unlink);
40156
40298
  if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
40157
40299
  url_input.value = guessUrlFromText(content_input.value);
40158
40300
  }
@@ -40167,7 +40309,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40167
40309
  jodit.s.restore();
40168
40310
  jodit.history.snapshot.restore(snapshot);
40169
40311
  if (link) {
40170
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.unwrap(link);
40312
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
40171
40313
  }
40172
40314
  jodit.synchronizeValues();
40173
40315
  close();
@@ -40188,12 +40330,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40188
40330
  const textWasChanged = getSelectionText() !== content_input.value.trim();
40189
40331
  const ci = jodit.createInside;
40190
40332
  let caretAfter = null;
40191
- if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isOrContains(jodit.editor, link)) {
40333
+ if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(jodit.editor, link)) {
40192
40334
  if (!jodit.s.isCollapsed()) {
40193
40335
  const node = jodit.s.current();
40194
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(node, 'img')) {
40336
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(node, 'img')) {
40195
40337
  links = [
40196
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.wrap(node, 'a', ci)
40338
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(node, 'a', ci)
40197
40339
  ];
40198
40340
  } else {
40199
40341
  links = jodit.s.wrapInTag('a');
@@ -40213,27 +40355,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40213
40355
  ];
40214
40356
  }
40215
40357
  links.forEach((a)=>{
40216
- ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'href', url_input.value);
40358
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', url_input.value);
40217
40359
  writeClasses(modeClassName, className_input, className_select, a);
40218
40360
  if (!isImageContent) {
40219
40361
  writeImage(a, content_input, textWasChanged, url_input);
40220
40362
  }
40221
40363
  if (openInNewTabCheckbox && target_checkbox) {
40222
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'target', target_checkbox.checked ? '_blank' : null);
40364
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'target', target_checkbox.checked ? '_blank' : null);
40223
40365
  }
40224
40366
  if (noFollowCheckbox && nofollow_checkbox) {
40225
- const relParts = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'rel') || '').split(/\s+/).filter(Boolean);
40367
+ const relParts = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel') || '').split(/\s+/).filter(Boolean);
40226
40368
  const hasNofollow = relParts.includes('nofollow');
40227
40369
  if (nofollow_checkbox.checked && !hasNofollow) {
40228
40370
  relParts.push('nofollow');
40229
40371
  } else if (!nofollow_checkbox.checked && hasNofollow) {
40230
40372
  relParts.splice(relParts.indexOf('nofollow'), 1);
40231
40373
  }
40232
- ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'rel', relParts.length ? relParts.join(' ') : null);
40374
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel', relParts.length ? relParts.join(' ') : null);
40233
40375
  }
40234
40376
  if (aria_label_input) {
40235
40377
  const ariaLabel = aria_label_input.value.trim();
40236
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'aria-label', ariaLabel || null);
40378
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'aria-label', ariaLabel || null);
40237
40379
  }
40238
40380
  jodit.e.fire('applyLink', jodit, a, form);
40239
40381
  });
@@ -40248,7 +40390,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40248
40390
  close();
40249
40391
  return false;
40250
40392
  };
40251
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isElement(form)) {
40393
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form)) {
40252
40394
  jodit.e.on(form, 'submit', (event)=>{
40253
40395
  event.preventDefault();
40254
40396
  event.stopImmediatePropagation();
@@ -40261,11 +40403,96 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40261
40403
  return form;
40262
40404
  }
40263
40405
  /** @override */ beforeDestruct(jodit) {
40264
- jodit.e.off('generateLinkForm.link', this.__generateForm).off('dblclick.link', this.__onDblClickOnLink).off(jodit.editor, 'click.link', this.__onClickReadOnlyLink).off('processPaste.link', this.onProcessPasteLink);
40406
+ jodit.e.off('generateLinkForm.link', this.__generateForm).off('dblclick.link', this.__onDblClickOnLink).off(jodit.editor, 'click.link', this.__onClickReadOnlyLink).off('processPaste.link', this.onProcessPasteLink).off('input.link', this.__onTypedSpace).off('beforeEnter.link', this.__onBeforeEnter).off('afterEnter.link', this.__onAfterEnter).off('mousedown.link blur.link beforeCommand.link', this.__forgetLink).off('keydown', this.__onKeyDown);
40407
+ }
40408
+ __onTypedSpace(event) {
40409
+ if (event.inputType !== 'insertText' || !event.data || /\S/.test(event.data)) {
40410
+ return;
40411
+ }
40412
+ const { range } = this.j.s;
40413
+ if (range.collapsed) {
40414
+ this.__linkTyped(range.startContainer, range.startOffset - event.data.length);
40415
+ }
40416
+ }
40417
+ __onBeforeEnter() {
40418
+ const { range } = this.j.s;
40419
+ this.__enteredAt = range.collapsed ? [
40420
+ range.startContainer,
40421
+ range.startOffset
40422
+ ] : null;
40423
+ }
40424
+ __onAfterEnter() {
40425
+ if (this.__enteredAt) {
40426
+ this.__linkAfterEnter(...this.__enteredAt);
40427
+ this.__enteredAt = null;
40428
+ }
40429
+ }
40430
+ __forgetLink() {
40431
+ this.__justLinked = null;
40432
+ }
40433
+ __onKeyDown(event) {
40434
+ const { jodit } = this;
40435
+ if (jodit.o.readonly) {
40436
+ return;
40437
+ }
40438
+ const link = this.__justLinked;
40439
+ const modified = event.ctrlKey || event.metaKey || event.altKey;
40440
+ if (!MODIFIER_KEYS.has(event.key)) {
40441
+ this.__justLinked = null;
40442
+ }
40443
+ if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_BACKSPACE && !modified && link?.isConnected) {
40444
+ this.__recordStep();
40445
+ jodit.s.save();
40446
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
40447
+ jodit.s.restore();
40448
+ this.__recordStep();
40449
+ // Or the backspace plugin takes a character too
40450
+ jodit.e.stopPropagation('keydown');
40451
+ return false;
40452
+ }
40453
+ const { range } = jodit.s;
40454
+ if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB && !modified && range.collapsed) {
40455
+ this.__linkTyped(range.startContainer, range.startOffset);
40456
+ }
40457
+ }
40458
+ /**
40459
+ * Links the address that ends at `end` in a text node, as a step of its
40460
+ * own in the history, so Undo straight after takes the link off and
40461
+ * leaves the text
40462
+ */ __linkTyped(node, end) {
40463
+ const { jodit } = this;
40464
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) || !node.isConnected || end < 0 || end > node.length || jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, NO_TYPED_LINKS, jodit.editor)) {
40465
+ return;
40466
+ }
40467
+ const found = (0,_typed_link__WEBPACK_IMPORTED_MODULE_9__.findTypedLink)(node.data, end, jodit.o.link.typedLinkTlds, jodit.o.link.typedLinkFileEndings);
40468
+ if (!found) {
40469
+ return;
40470
+ }
40471
+ const [start, stop, href] = found;
40472
+ this.__recordStep();
40473
+ // The text round the caret splits, and WebKit doesn't keep the caret
40474
+ // where it was
40475
+ jodit.s.save();
40476
+ const range = jodit.ed.createRange();
40477
+ range.setStart(node, start);
40478
+ range.setEnd(node, stop);
40479
+ const a = jodit.createInside.element('a');
40480
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', href);
40481
+ range.surroundContents(a);
40482
+ jodit.s.restore();
40483
+ jodit.e.fire('applyLink', jodit, a, null);
40484
+ this.__recordStep();
40485
+ this.__justLinked = a;
40486
+ }
40487
+ /**
40488
+ * Reports what's changed and makes it a history step of its own
40489
+ */ __recordStep() {
40490
+ this.j.setEditorValue();
40491
+ this.j.e.fire('internalChange');
40265
40492
  }
40266
40493
  __onClickReadOnlyLink(e) {
40267
40494
  const { jodit } = this;
40268
- if (jodit.o.readonly && jodit.o.link.preventReadOnlyNavigation && jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(e.target, 'a')) {
40495
+ if (jodit.o.readonly && jodit.o.link.preventReadOnlyNavigation && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
40269
40496
  e.preventDefault();
40270
40497
  }
40271
40498
  }
@@ -40275,22 +40502,59 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
40275
40502
  name: 'link',
40276
40503
  group: 'insert'
40277
40504
  }
40278
- ]);
40505
+ ]), /**
40506
+ * Where the caret was when Enter was pressed. Enter splits the line in a
40507
+ * history transaction, so the link waits until it's over
40508
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__enteredAt", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__linkAfterEnter", ()=>{}), /**
40509
+ * The link just made, which Backspace straight after takes off again, as
40510
+ * in CKEditor 5. Any other key but a modifier, a click or a command
40511
+ * forgets it
40512
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__justLinked", null);
40279
40513
  }
40280
40514
  }
40281
40515
  ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
40282
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
40516
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
40283
40517
  ], link.prototype, "__onDblClickOnLink", null);
40284
40518
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
40285
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
40519
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
40286
40520
  ], link.prototype, "onProcessPasteLink", null);
40287
40521
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
40288
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
40522
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
40289
40523
  ], link.prototype, "__generateForm", null);
40290
40524
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
40291
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
40525
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
40526
+ ], link.prototype, "__onTypedSpace", null);
40527
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
40528
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
40529
+ ], link.prototype, "__onBeforeEnter", null);
40530
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
40531
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
40532
+ ], link.prototype, "__onAfterEnter", null);
40533
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
40534
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
40535
+ ], link.prototype, "__forgetLink", null);
40536
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
40537
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
40538
+ ], link.prototype, "__onKeyDown", null);
40539
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
40540
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
40541
+ ], link.prototype, "__linkTyped", null);
40542
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
40543
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
40292
40544
  ], link.prototype, "__onClickReadOnlyLink", null);
40293
- jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('link', link);
40545
+ const NO_TYPED_LINKS = new Set([
40546
+ 'a',
40547
+ 'pre',
40548
+ 'code'
40549
+ ]);
40550
+ const MODIFIER_KEYS = new Set([
40551
+ 'Shift',
40552
+ 'Control',
40553
+ 'Alt',
40554
+ 'Meta',
40555
+ 'CapsLock'
40556
+ ]);
40557
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('link', link);
40294
40558
  /**
40295
40559
  * Guess a usable `href` from the selected text for the link dialog.
40296
40560
  * Returns an empty string when the text is not a plausible URL/email,
@@ -40305,7 +40569,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('link', link);
40305
40569
  return value;
40306
40570
  }
40307
40571
  // email address -> mailto:
40308
- if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
40572
+ if (_typed_link__WEBPACK_IMPORTED_MODULE_9__.EMAIL.test(value)) {
40309
40573
  return `mailto:${value}`;
40310
40574
  }
40311
40575
  // bare domain like example.com or www.example.com/path -> https://
@@ -40318,14 +40582,14 @@ function writeClasses(modeClassName, className_input, className_select, a) {
40318
40582
  if (modeClassName && (className_input ?? className_select)) {
40319
40583
  if (modeClassName === 'input') {
40320
40584
  if (className_input.value === '' && a.hasAttribute('class')) {
40321
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'class', null);
40585
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
40322
40586
  }
40323
40587
  if (className_input.value !== '') {
40324
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'class', className_input.value);
40588
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', className_input.value);
40325
40589
  }
40326
40590
  } else if (modeClassName === 'select') {
40327
40591
  if (a.hasAttribute('class')) {
40328
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'class', null);
40592
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
40329
40593
  }
40330
40594
  for(let i = 0; i < className_select.selectedOptions.length; i++){
40331
40595
  const className = className_select.selectedOptions.item(i)?.value;
@@ -40342,7 +40606,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
40342
40606
  switch(modeClassName){
40343
40607
  case 'input':
40344
40608
  if (className_input) {
40345
- className_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(link, 'class') || '';
40609
+ className_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
40346
40610
  }
40347
40611
  break;
40348
40612
  case 'select':
@@ -40353,7 +40617,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
40353
40617
  option.selected = false;
40354
40618
  }
40355
40619
  }
40356
- const classNames = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(link, 'class') || '';
40620
+ const classNames = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
40357
40621
  classNames.split(/\s+/).filter((cn)=>cn.trim().length > 0).forEach((className)=>{
40358
40622
  if (className) {
40359
40623
  for(let i = 0; i < className_select.options.length; i++){
@@ -40484,6 +40748,156 @@ const formTemplate = (editor)=>{
40484
40748
  /* harmony export */ ]);
40485
40749
 
40486
40750
 
40751
+ /***/ }),
40752
+
40753
+ /***/ 4441:
40754
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
40755
+
40756
+ "use strict";
40757
+ /*!
40758
+ * Jodit Editor (https://xdsoft.net/jodit/)
40759
+ * Released under MIT see LICENSE.txt in the project root for license information.
40760
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
40761
+ */ /**
40762
+ * @module plugins/link
40763
+ */ /**
40764
+ * The endings a bare domain links with, besides those `link.typedLinkTlds`
40765
+ * adds: the generic ones of at least 1 in 1,000 of the sites in Tranco's top
40766
+ * million (list GQ38K, https://tranco-list.eu/list/GQ38K), then every
40767
+ * two-letter one in IANA's list (version 2026102900,
40768
+ * https://data.iana.org/TLD/tlds-alpha-by-domain.txt). Together they're the
40769
+ * endings of 96% of those sites
40770
+ * @private
40771
+ */ const TLDS = new Set(`
40772
+ app biz casino click cloud club com dev edu gov info live net online org pro
40773
+ shop site space store tech top vip xyz
40774
+ ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi
40775
+ bj bm bn bo br bs bt bv bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu
40776
+ cv cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga
40777
+ gb gd ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id
40778
+ ie il im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la
40779
+ lb lc li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms
40780
+ mt mu mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph
40781
+ pk pl pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sj sk
40782
+ sl sm sn so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt
40783
+ tv tw tz ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw
40784
+ `.trim().split(/\s+/));
40785
+
40786
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, [
40787
+ /* harmony export */ "TLDS", 0, /* binding */ TLDS
40788
+ /* harmony export */ ]);
40789
+
40790
+
40791
+ /***/ }),
40792
+
40793
+ /***/ 99763:
40794
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
40795
+
40796
+ "use strict";
40797
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
40798
+ /* harmony export */ findTypedLink: function() { return /* binding */ findTypedLink; }
40799
+ /* harmony export */ });
40800
+ /* harmony import */ var jodit_core_helpers_checker_is_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91764);
40801
+ /* harmony import */ var _tlds__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4441);
40802
+ /*!
40803
+ * Jodit Editor (https://xdsoft.net/jodit/)
40804
+ * Released under MIT see LICENSE.txt in the project root for license information.
40805
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
40806
+ */ /**
40807
+ * @module plugins/link
40808
+ */
40809
+
40810
+ /**
40811
+ * An email address, for `mailto:`
40812
+ * @private
40813
+ */ const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
40814
+ const OPENING = new Set([
40815
+ '(',
40816
+ '[',
40817
+ '"',
40818
+ "'",
40819
+ '“',
40820
+ '‘',
40821
+ '<'
40822
+ ]);
40823
+ const CLOSING = new Set([
40824
+ '.',
40825
+ ',',
40826
+ ';',
40827
+ ':',
40828
+ '!',
40829
+ '?',
40830
+ '"',
40831
+ "'",
40832
+ '”',
40833
+ '’',
40834
+ '>'
40835
+ ]);
40836
+ const BRACKETS = {
40837
+ ')': '(',
40838
+ ']': '['
40839
+ };
40840
+ const LABEL = /^[a-z\d][a-z\d-]{0,62}$/i;
40841
+ /**
40842
+ * The address that ends at `end` in a line of text typed, back to the
40843
+ * whitespace before it, as `[start, end, href]`. Punctuation round it, such as
40844
+ * a sentence's full stop or a bracket the address doesn't open, stays out.
40845
+ * An address counts with a scheme, with `www.`, as an email address, or as a
40846
+ * bare domain that `isBareDomain` accepts, so `Node.js` or `e.g.` don't
40847
+ * @private
40848
+ */ function findTypedLink(text, end, tlds, fileEndings) {
40849
+ let start = end;
40850
+ while(start > 0 && !/\s/.test(text[start - 1])){
40851
+ start -= 1;
40852
+ }
40853
+ while(start < end && OPENING.has(text[start])){
40854
+ start += 1;
40855
+ }
40856
+ while(end > start){
40857
+ const char = text[end - 1];
40858
+ const opening = BRACKETS[char];
40859
+ if (CLOSING.has(char) || opening && !text.slice(start, end - 1).includes(opening)) {
40860
+ end -= 1;
40861
+ } else {
40862
+ break;
40863
+ }
40864
+ }
40865
+ const href = typedLinkHref(text.slice(start, end), tlds, fileEndings);
40866
+ return href ? [
40867
+ start,
40868
+ end,
40869
+ href
40870
+ ] : null;
40871
+ }
40872
+ function typedLinkHref(address, tlds, fileEndings) {
40873
+ const email = address.replace(/^mailto:/i, '');
40874
+ if (EMAIL.test(email)) {
40875
+ return `mailto:${email}`;
40876
+ }
40877
+ if (/^www\.[^\s.]+\.\S+$/i.test(address) || isBareDomain(address, tlds, fileEndings)) {
40878
+ return `https://${address}`;
40879
+ }
40880
+ return /^[a-z][a-z\d+.-]*:\/\//i.test(address) && (0,jodit_core_helpers_checker_is_url__WEBPACK_IMPORTED_MODULE_0__.isURL)(address) ? address : '';
40881
+ }
40882
+ /**
40883
+ * A domain typed without a scheme or `www.`, as `example.com`, `elections.nz`
40884
+ * or `bit.ly/enrol`. Its ending has to be in `TLDS` or `tlds`, typed in lower
40885
+ * case, so `Node.js` and a sentence run on, as in `home.It`, don't count, and
40886
+ * not in `fileEndings`, as in `photos.zip`. The first part has a letter,
40887
+ * which leaves out a time or a numbered step such as `11.am`
40888
+ */ function isBareDomain(address, tlds, fileEndings) {
40889
+ const cut = address.search(/[/?#]/);
40890
+ const host = cut < 0 ? address : address.slice(0, cut);
40891
+ const labels = host.split('.');
40892
+ const ending = labels[labels.length - 1];
40893
+ return labels.length > 1 && labels.every((label)=>LABEL.test(label) && !label.endsWith('-')) && (_tlds__WEBPACK_IMPORTED_MODULE_1__.TLDS.has(ending) || tlds.includes(ending)) && !fileEndings.includes(ending) && /[a-z]/i.test(labels[0]);
40894
+ }
40895
+
40896
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, [
40897
+ /* harmony export */ "EMAIL", 0, /* binding */ EMAIL
40898
+ /* harmony export */ ]);
40899
+
40900
+
40487
40901
  /***/ }),
40488
40902
 
40489
40903
  /***/ 51730:
@@ -42522,7 +42936,7 @@ const key = 'table_processor_observer-resize';
42522
42936
  /**
42523
42937
  * Click on resize handle
42524
42938
  */ onHandleMouseDown(event) {
42525
- if (this.j.isLocked) {
42939
+ if (this.j.isLocked || this.j.o.readonly) {
42526
42940
  return;
42527
42941
  }
42528
42942
  this.drag = true;
@@ -42557,10 +42971,15 @@ const key = 'table_processor_observer-resize';
42557
42971
  let box;
42558
42972
  this.minX = 0;
42559
42973
  this.maxX = 1000000;
42974
+ this.startTableWidth = this.workTable.offsetWidth;
42560
42975
  if (this.wholeTable != null) {
42561
- const tableBox = this.workTable.parentNode.getBoundingClientRect();
42976
+ const parent = this.workTable.parentNode;
42977
+ const tableBox = parent.getBoundingClientRect();
42562
42978
  this.minX = tableBox.left;
42563
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);
42564
42983
  } else {
42565
42984
  // find maximum columns
42566
42985
  const coordinate = this.module.formalCoordinate(this.workTable, this.workCell, true);
@@ -42574,6 +42993,17 @@ const key = 'table_processor_observer-resize';
42574
42993
  this.maxX = Math.min(box.left + box.width - jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.NEARBY / 2, this.maxX);
42575
42994
  }
42576
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
+ });
42577
43007
  }
42578
43008
  return false;
42579
43009
  }
@@ -42601,8 +43031,11 @@ const key = 'table_processor_observer-resize';
42601
43031
  x = this.maxX;
42602
43032
  }
42603
43033
  this.resizeDelta = x - this.startX + (!this.j.o.iframe ? 0 : workplacePosition.left);
42604
- this.restoreStyles();
42605
- this.resizeColumnsOrTable();
43034
+ if (this.wholeTable == null) {
43035
+ this.setColumnWidths();
43036
+ } else {
43037
+ this.resizeTable();
43038
+ }
42606
43039
  const tableBox = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.offset)(this.workTable, this.j, this.j.ed);
42607
43040
  Object.assign(this.resizeHandler.style, {
42608
43041
  left: this.startLeft + this.columnEdge() - this.startEdge + 'px',
@@ -42715,21 +43148,49 @@ const key = 'table_processor_observer-resize';
42715
43148
  };
42716
43149
  this.scrollFrame = this.j.async.requestAnimationFrame(scroll);
42717
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
+ }
42718
43161
  /**
42719
43162
  * Resize only one column
42720
43163
  */ resizeColumns() {
42721
43164
  const delta = this.resizeDelta;
42722
43165
  const marked = [];
42723
43166
  const tableModule = this.module;
42724
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, this.workCell, true)[1], delta, true, marked);
42725
- 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);
42726
- 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
+ });
42727
43188
  }
42728
43189
  /**
42729
43190
  * Resize whole table
42730
43191
  */ resizeTable() {
42731
43192
  const delta = this.resizeDelta * (this.isRTL ? -1 : 1);
42732
- 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;
42733
43194
  // for RTL use mirror logic
42734
43195
  const rightSide = !this.wholeTable;
42735
43196
  const needChangeWidth = this.isRTL ? !rightSide : rightSide;
@@ -42738,10 +43199,9 @@ const key = 'table_processor_observer-resize';
42738
43199
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, 'width', (width + delta) / parentWidth * 100 + '%');
42739
43200
  } else {
42740
43201
  const side = this.isRTL ? 'marginRight' : 'marginLeft';
42741
- const margin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
42742
43202
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, {
42743
43203
  width: (width - delta) / parentWidth * 100 + '%',
42744
- [side]: (margin + delta) / parentWidth * 100 + '%'
43204
+ [side]: (this.startMargin + delta) / parentWidth * 100 + '%'
42745
43205
  });
42746
43206
  }
42747
43207
  }
@@ -42817,9 +43277,10 @@ const key = 'table_processor_observer-resize';
42817
43277
  if (!editor.o.tableAllowCellResize) {
42818
43278
  return;
42819
43279
  }
42820
- editor.e.off(this.j.ow, '.resize-cells').off('.resize-cells').on('change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells', ()=>{
43280
+ const observeTables = ()=>{
42821
43281
  ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', editor.editor).forEach(this.observe);
42822
- }).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', ()=>{
42823
43284
  if (!this.drag || this.workRow) {
42824
43285
  return;
42825
43286
  }
@@ -42835,6 +43296,8 @@ const key = 'table_processor_observer-resize';
42835
43296
  tableModule.normalizeTable(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(td, 'table', editor.editor));
42836
43297
  });
42837
43298
  });
43299
+ // None of those events comes with the editor's starting value
43300
+ observeTables();
42838
43301
  }
42839
43302
  /**
42840
43303
  * Add to every Table listeners
@@ -42848,7 +43311,9 @@ const key = 'table_processor_observer-resize';
42848
43311
  this.hideResizeHandle();
42849
43312
  }
42850
43313
  }).on(table, 'mousemove.resize-cells touchmove.resize-cells', this.j.async.throttle((event)=>{
42851
- 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) {
42852
43317
  return;
42853
43318
  }
42854
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);
@@ -42881,8 +43346,15 @@ const key = 'table_processor_observer-resize';
42881
43346
  }
42882
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), /**
42883
43348
  * The table's and its cells' styles as a column drag started, put back
42884
- * before each new width
43349
+ * as it ends, before the final widths
42885
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), /**
42886
43358
  * The row whose height the handle sets, or null while it sets a width
42887
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), /**
42888
43360
  * The boxes that scroll the row, with their styles, as a row drag turns
@@ -44632,7 +45104,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.tableAllowCellSelecti
44632
45104
 
44633
45105
 
44634
45106
  const key = 'table_processor_observer';
44635
- const MOUSE_MOVE_LABEL = 'onMoveTableSelectCell';
44636
45107
  class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
44637
45108
  /**
44638
45109
  * Shortcut for Jodit.modules.Table
@@ -44647,6 +45118,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
44647
45118
  // move the caret, as table-keyboard-navigation's do
44648
45119
  .on('keydown', this.__onKeyDown, {
44649
45120
  top: true
45121
+ }).on('clickEditor', this.__onClickAfterDrag, {
45122
+ top: true
44650
45123
  }).on('keydown.select-cells', (event)=>{
44651
45124
  if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB) {
44652
45125
  this.unselectCells();
@@ -44764,18 +45237,35 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
44764
45237
  }
44765
45238
  this.__isSelectionMode = true;
44766
45239
  this.__selectedCell = cell;
45240
+ this.__movedTo = cell;
44767
45241
  this.__tableModule.addSelection(cell);
44768
- this.j.e.on(table, 'mousemove.select-cells touchmove.select-cells', // Don't use decorator because need clear label on mouseup
44769
- this.j.async.throttle(this.__onMove.bind(this, table), {
44770
- label: MOUSE_MOVE_LABEL,
44771
- timeout: this.j.defaultTimeout / 2
44772
- })).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)));
44773
45247
  return false;
44774
45248
  }
44775
45249
  onOutsideClick() {
44776
45250
  this.__selectedCell = null;
44777
45251
  this.__onRemoveSelection();
44778
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
+ }
44779
45269
  onChange() {
44780
45270
  if (!this.j.isLocked && !this.__isSelectionMode) {
44781
45271
  this.__onRemoveSelection();
@@ -44793,16 +45283,20 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
44793
45283
  // Inside Shadow DOM `document.elementFromPoint` returns the shadow
44794
45284
  // host, so the lookup must start from the shadow root
44795
45285
  const node = (this.j.o.shadowRoot ?? this.j.ed).elementFromPoint(e.clientX, e.clientY);
44796
- if (!node) {
44797
- return;
44798
- }
44799
- 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, [
44800
45287
  'td',
44801
45288
  'th'
44802
45289
  ], table);
44803
45290
  if (!cell || !this.__selectedCell) {
44804
45291
  return;
44805
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;
44806
45300
  if (cell !== this.__selectedCell) {
44807
45301
  this.j.lock(key);
44808
45302
  }
@@ -44860,10 +45354,32 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
44860
45354
  if (ownTable && ownTable !== table) {
44861
45355
  return; // Nested tables
44862
45356
  }
44863
- const bound = this.__tableModule.getSelectedBound(table, [
45357
+ this.__showCellsPopup(table, [
44864
45358
  cell,
44865
45359
  this.__selectedCell
44866
- ]), 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);
44867
45383
  const max = box[bound[1][0]]?.[bound[1][1]], min = box[bound[0][0]]?.[bound[0][1]];
44868
45384
  // `getSelectedBound` keeps its `Infinity` sentinel when none of the
44869
45385
  // selected cells belong to this table's matrix — e.g. after a
@@ -44883,10 +45399,16 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
44883
45399
  height: maxOffset.top - minOffset.top + maxOffset.height
44884
45400
  };
44885
45401
  }, 'cells');
44886
- (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)=>{
44887
45405
  this.j.e.off(table, 'mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells');
44888
45406
  });
44889
- 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;
44890
45412
  }
44891
45413
  /**
44892
45414
  * Remove selection for all cells
@@ -45056,7 +45578,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45056
45578
  }
45057
45579
  /** @override */ beforeDestruct(jodit) {
45058
45580
  this.__onRemoveSelection();
45059
- 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);
45060
45583
  }
45061
45584
  constructor(...args){
45062
45585
  super(...args), /**
@@ -45067,7 +45590,12 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45067
45590
  * First selected cell
45068
45591
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__selectedCell", null), /**
45069
45592
  * User is selecting cells now
45070
- */ (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);
45071
45599
  }
45072
45600
  }
45073
45601
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(selectCells, "requires", [
@@ -45085,6 +45613,15 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45085
45613
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
45086
45614
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':outsideClick')
45087
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);
45088
45625
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
45089
45626
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':change')
45090
45627
  ], selectCells.prototype, "onChange", null);
@@ -45136,10 +45673,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45136
45673
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
45137
45674
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
45138
45675
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
45139
- /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(57821);
45140
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
45141
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4099);
45142
- /* 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);
45143
45681
  /*!
45144
45682
  * Jodit Editor (https://xdsoft.net/jodit/)
45145
45683
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -45158,6 +45696,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45158
45696
 
45159
45697
 
45160
45698
 
45699
+
45161
45700
  /**
45162
45701
  * A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
45163
45702
  *
@@ -45168,22 +45707,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45168
45707
  * console.log(img.src);
45169
45708
  * })
45170
45709
  * ```
45171
- */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
45710
+ */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__.Plugin {
45172
45711
  afterInit(jodit) {
45173
45712
  this.proxyEventsList.forEach((eventName)=>{
45174
45713
  jodit.e.on(eventName + '.select', this.onStartSelection);
45175
45714
  });
45715
+ jodit.e.on('dblclick', this.__onDblClickBesideRow, {
45716
+ top: true
45717
+ });
45176
45718
  }
45177
45719
  beforeDestruct(jodit) {
45178
45720
  this.proxyEventsList.forEach((eventName)=>{
45179
- jodit.e.on(eventName + '.select', this.onStartSelection);
45721
+ jodit.e.off(eventName + '.select', this.onStartSelection);
45180
45722
  });
45723
+ this.__endPressBesideRow();
45724
+ jodit.e.off('dblclick', this.__onDblClickBesideRow);
45181
45725
  }
45182
45726
  onStartSelection(e) {
45183
45727
  const { j } = this;
45184
45728
  let result, target = e.target;
45185
45729
  while(result === undefined && target && target !== j.editor){
45186
- 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);
45187
45731
  target = target.parentElement;
45188
45732
  }
45189
45733
  if (e.type === 'click' && result === undefined && target === j.editor) {
@@ -45203,10 +45747,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45203
45747
  }
45204
45748
  // Selecting the text of a popup input with the mouse and releasing
45205
45749
  // the button past the popup's edge is not a click outside of it.
45206
- 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)) {
45207
45751
  return;
45208
45752
  }
45209
- 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);
45210
45754
  if (!box) {
45211
45755
  this.j.e.fire('outsideClick', e);
45212
45756
  }
@@ -45252,6 +45796,125 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45252
45796
  s.setCursorAfter(text);
45253
45797
  }
45254
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
+ }
45255
45918
  /**
45256
45919
  * Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
45257
45920
  * a collapsed cursor leaves empty marker elements with the caret inside; a
@@ -45313,7 +45976,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45313
45976
  * Where the last press started. Chrome reports a drag that begins in one
45314
45977
  * element and ends in another as a `click` on their common ancestor, so a
45315
45978
  * press inside a popup is remembered to tell such a drag from a real click.
45316
- */ (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);
45317
45983
  }
45318
45984
  }
45319
45985
  ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
@@ -45343,6 +46009,18 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45343
46009
  ':click'
45344
46010
  ])
45345
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);
45346
46024
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
45347
46025
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
45348
46026
  ':click'