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
package/es2015/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.19.5
4
+ * Version: v4.19.7
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1830,7 +1830,7 @@ __webpack_require__.r(__webpack_exports__);
1830
1830
  * ```
1831
1831
  * @packageDocumentation
1832
1832
  * @module constants
1833
- */ const APP_VERSION = "4.19.5";
1833
+ */ const APP_VERSION = "4.19.7";
1834
1834
  // prettier-ignore
1835
1835
  const ES = "es2015";
1836
1836
  const IS_ES_MODERN = true;
@@ -11285,7 +11285,13 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
11285
11285
  * When the cursor is positioned in its place, it must be inside the element and not outside its border.
11286
11286
  * @private
11287
11287
  */ function moveNodeInsideStart(j, node, start) {
11288
- 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);
11288
+ // A text node of non-breaking spaces trims to nothing, but it's text the
11289
+ // node mustn't move past
11290
+ const isContent = (n)=>{
11291
+ var _n_nodeValue;
11292
+ return !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(n) || Boolean((_n_nodeValue = n.nodeValue) === null || _n_nodeValue === void 0 ? void 0 : _n_nodeValue.includes(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.NBSP_SPACE));
11293
+ };
11294
+ 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);
11289
11295
  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))){
11290
11296
  if (start || !sibling.firstChild) {
11291
11297
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(sibling, node);
@@ -13948,9 +13954,11 @@ const WRAP_NODES = new Set([
13948
13954
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13949
13955
  /* harmony export */ ApplyStyle: function() { return /* binding */ ApplyStyle; }
13950
13956
  /* harmony export */ });
13951
- /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51640);
13952
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(98394);
13953
- /* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(78462);
13957
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
13958
+ /* harmony import */ var jodit_core_helpers_utils_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28723);
13959
+ /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(51640);
13960
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(98394);
13961
+ /* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78462);
13954
13962
  /*!
13955
13963
  * Jodit Editor (https://xdsoft.net/jodit/)
13956
13964
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -13960,27 +13968,56 @@ const WRAP_NODES = new Set([
13960
13968
  */
13961
13969
 
13962
13970
 
13971
+
13972
+
13973
+ /**
13974
+ * Take a selected fragment out of the elements its style takes the place
13975
+ * of: one around it is split, so the fragment leaves it, and one in it is
13976
+ * unwrapped
13977
+ */ function takeOutOf(jodit, font, tags) {
13978
+ const range = jodit.s.createRange();
13979
+ let outer = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(font.parentNode, tags, jodit.editor);
13980
+ while(outer){
13981
+ range.selectNodeContents(outer);
13982
+ range.setEndBefore(font);
13983
+ const before = range.cloneContents();
13984
+ range.selectNodeContents(outer);
13985
+ range.setStartAfter(font);
13986
+ // Split only when there's more in it, as a split leaves empty copies
13987
+ // of the elements between
13988
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(before) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(range.cloneContents())) {
13989
+ (0,_api__WEBPACK_IMPORTED_MODULE_2__.extractSelectedPart)(outer, font, jodit);
13990
+ }
13991
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.unwrap(outer);
13992
+ outer = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(font.parentNode, tags, jodit.editor);
13993
+ }
13994
+ ;(0,jodit_core_helpers_utils_selector__WEBPACK_IMPORTED_MODULE_1__.$$)(tags.join(','), font).forEach((inner)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.unwrap(inner));
13995
+ }
13963
13996
  /** @internal */ function ApplyStyle(jodit, cs) {
13964
13997
  var _editor_firstChild;
13965
13998
  const { s: sel, editor } = jodit;
13966
13999
  (_editor_firstChild = editor.firstChild) === null || _editor_firstChild === void 0 ? void 0 : _editor_firstChild.normalize(); // FF fix for test "commandsTest - Exec command "bold"
13967
14000
  const fakes = sel.fakes();
13968
14001
  const collapsed = sel.isCollapsed();
13969
- let mode = _constants__WEBPACK_IMPORTED_MODULE_1__.INITIAL;
14002
+ let mode = _constants__WEBPACK_IMPORTED_MODULE_3__.INITIAL;
13970
14003
  try {
13971
14004
  // for...of closes the generator on an exception, releasing every
13972
14005
  // temporary wrapper before the selection is restored in finally.
13973
14006
  for (const font of sel.wrapInTagGen(fakes)){
14007
+ var _cs_options_exclude;
14008
+ if ((_cs_options_exclude = cs.options.exclude) === null || _cs_options_exclude === void 0 ? void 0 : _cs_options_exclude.length) {
14009
+ takeOutOf(jodit, font, cs.options.exclude);
14010
+ }
13974
14011
  let state = {
13975
14012
  collapsed,
13976
14013
  mode,
13977
14014
  element: font,
13978
- next: _transactions__WEBPACK_IMPORTED_MODULE_2__.states.START,
14015
+ next: _transactions__WEBPACK_IMPORTED_MODULE_4__.states.START,
13979
14016
  jodit,
13980
14017
  style: cs
13981
14018
  };
13982
- const machine = new _api__WEBPACK_IMPORTED_MODULE_0__.FiniteStateMachine(_transactions__WEBPACK_IMPORTED_MODULE_2__.states.START, _transactions__WEBPACK_IMPORTED_MODULE_2__.transactions);
13983
- while(!jodit.isInDestruct && machine.getState() !== _transactions__WEBPACK_IMPORTED_MODULE_2__.states.END){
14019
+ const machine = new _api__WEBPACK_IMPORTED_MODULE_2__.FiniteStateMachine(_transactions__WEBPACK_IMPORTED_MODULE_4__.states.START, _transactions__WEBPACK_IMPORTED_MODULE_4__.transactions);
14020
+ while(!jodit.isInDestruct && machine.getState() !== _transactions__WEBPACK_IMPORTED_MODULE_4__.states.END){
13984
14021
  state = machine.dispatch('exec', state);
13985
14022
  }
13986
14023
  // The first selected fragment determines how later fragments toggle.
@@ -18508,6 +18545,20 @@ const FOCUS_EVENTS = new Set([
18508
18545
  'focusin',
18509
18546
  'focusout'
18510
18547
  ]);
18548
+ const EDITING_KEYS = new Set([
18549
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_ENTER,
18550
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_BACKSPACE,
18551
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_DELETE
18552
+ ]);
18553
+ /**
18554
+ * Whether the input method (IME) is using the key. Safari fires the keydown
18555
+ * that ends a composition, as the Enter that confirms Japanese text, after
18556
+ * `compositionend`, and types Korean without one, so `isComposing` is false and
18557
+ * only keyCode 229 tells. Only the keys the editor turns into edits are held
18558
+ * back: the handlers that follow typing still see the rest.
18559
+ */ function isInputMethodKey(event) {
18560
+ return event.isComposing || event.keyCode === 229 && EDITING_KEYS.has(event.key);
18561
+ }
18511
18562
  const __defaultStyleDisplayKey = 'data-jodit-default-style-display';
18512
18563
  const __defaultClassesKey = 'data-jodit-default-classes';
18513
18564
  const NOEDIT = {
@@ -19566,7 +19617,7 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_11__.ViewWithToolbar
19566
19617
  }
19567
19618
  }
19568
19619
  const w = this.ew;
19569
- if (event instanceof w.KeyboardEvent && event.isComposing) {
19620
+ if (event instanceof w.KeyboardEvent && isInputMethodKey(event)) {
19570
19621
  return;
19571
19622
  }
19572
19623
  if (this.e && this.e.fire) {
@@ -28889,6 +28940,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28889
28940
  if (checkJoinBareText(jodit, fakeNode, backspace)) {
28890
28941
  return true;
28891
28942
  }
28943
+ // Old content can have an inline element round blocks beside the text:
28944
+ // moved inside them, the line joins the block as it would bare text
28945
+ // (#1781)
28946
+ const inline = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
28947
+ if (joinsBareText(jodit, edgeBlock(inline, backspace)) && moveInlineInside(inline, jodit.editor)) {
28948
+ return joinNeighbors(jodit, fakeNode, backspace, moved);
28949
+ }
28892
28950
  let nextBox = fakeNode, mainClosestBox = nextBox;
28893
28951
  // Find the main big closest element
28894
28952
  while(nextBox && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(nextBox, backspace) && nextBox.parentElement !== jodit.editor){
@@ -29169,7 +29227,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
29169
29227
  * in `<div>a|<p>b</p>c</div>` gives `<div>a|b<br>c</div>`
29170
29228
  */ function checkJoinBareText(jodit, fakeNode, backspace) {
29171
29229
  const block = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
29172
- if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(block) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(block) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(block) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(block, 'table') || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(block) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(block, jodit.editor) || Array.from(block.childNodes).some((node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node))) {
29230
+ if (!joinsBareText(jodit, block)) {
29173
29231
  return false;
29174
29232
  }
29175
29233
  const filter = (0,jodit_plugins_backspace_helpers__WEBPACK_IMPORTED_MODULE_2__.getMoveFilter)(jodit);
@@ -29196,6 +29254,24 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
29196
29254
  jodit.s.setCursorBefore(fakeNode);
29197
29255
  return true;
29198
29256
  }
29257
+ /**
29258
+ * Whether a block joins the bare text beside it: not a list, a table or a
29259
+ * cell, and holding no block of its own
29260
+ */ function joinsBareText(jodit, block) {
29261
+ return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(block) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(block) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(block) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(block, 'table') && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(block) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(block, jodit.editor) && !Array.from(block.childNodes).some((node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node));
29262
+ }
29263
+ /**
29264
+ * The block an inline element holds on its side facing the caret, through
29265
+ * the inline elements in it: the `<p>` of `<span><strong><p>…</p></strong></span>`
29266
+ */ function edgeBlock(node, backspace) {
29267
+ let edge = node;
29268
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(edge) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(edge)){
29269
+ var _ref;
29270
+ const children = Array.from(edge.childNodes).filter((child)=>!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child));
29271
+ edge = (_ref = backspace ? children[children.length - 1] : children[0]) !== null && _ref !== void 0 ? _ref : null;
29272
+ }
29273
+ return edge === node ? null : edge;
29274
+ }
29199
29275
  function checkMoveListContent(jodit, mainClosestBox, sibling, backspace) {
29200
29276
  // Process UL/LI/OL cases
29201
29277
  const siblingIsList = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.LIST_TAGS);
@@ -29647,7 +29723,6 @@ function isNotEditable(jodit, node) {
29647
29723
  if (!prn || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn)) {
29648
29724
  return false;
29649
29725
  }
29650
- const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
29651
29726
  do {
29652
29727
  if (prn && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(prn)) {
29653
29728
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(prn, fakeNode);
@@ -29662,6 +29737,9 @@ function isNotEditable(jodit, node) {
29662
29737
  if (found && (0,_check_join_two_lists__WEBPACK_IMPORTED_MODULE_2__.checkJoinTwoLists)(jodit, fakeNode, backspace)) {
29663
29738
  return true;
29664
29739
  }
29740
+ // Looked for once the empty elements have gone, as the one beside the
29741
+ // caret can be in them: the `<br>` that Delete in `<p>|<br></p>` leaves
29742
+ const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
29665
29743
  if (neighbor && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText(neighbor) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(neighbor, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INSEPARABLE_TAGS)) {
29666
29744
  setCursorIn(neighbor, !backspace);
29667
29745
  } else {
@@ -30128,8 +30206,15 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.delete = {
30128
30206
  }
30129
30207
  cssRules[key] = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isArray)(cssOptions[key]) ? cssOptions[key][0] : cssOptions[key];
30130
30208
  });
30209
+ const element = control.tags ? control.tags[0] : undefined;
30131
30210
  editor.s.commitStyle({
30132
- element: control.tags ? control.tags[0] : undefined
30211
+ element,
30212
+ // As in the browsers and Word, each takes the other's place
30213
+ exclude: element === 'sub' ? [
30214
+ 'sup'
30215
+ ] : element === 'sup' ? [
30216
+ 'sub'
30217
+ ] : []
30133
30218
  });
30134
30219
  editor.synchronizeValues();
30135
30220
  return false;
@@ -32705,11 +32790,12 @@ __webpack_require__.r(__webpack_exports__);
32705
32790
  "use strict";
32706
32791
  /* unused harmony export deleteCommand */
32707
32792
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
32708
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27795);
32709
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28077);
32710
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65946);
32711
- /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4040);
32712
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(91206);
32793
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
32794
+ /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27795);
32795
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28077);
32796
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
32797
+ /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4040);
32798
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
32713
32799
  /*!
32714
32800
  * Jodit Editor (https://xdsoft.net/jodit/)
32715
32801
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -32725,6 +32811,7 @@ __webpack_require__.r(__webpack_exports__);
32725
32811
 
32726
32812
 
32727
32813
 
32814
+
32728
32815
  const NOT_EMPTY_CONTENT_TAGS = new Set([
32729
32816
  'img',
32730
32817
  'table',
@@ -32732,7 +32819,19 @@ const NOT_EMPTY_CONTENT_TAGS = new Set([
32732
32819
  'iframe',
32733
32820
  'hr'
32734
32821
  ]);
32735
- class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
32822
+ const KEEPS_SPACES = new Set([
32823
+ 'pre',
32824
+ 'pre-wrap',
32825
+ 'break-spaces'
32826
+ ]);
32827
+ /**
32828
+ * A plain space beside this neighbor isn't shown: there is none, or it's a
32829
+ * line break, a block or text starting (or ending) with a plain space
32830
+ */ function hidesSpace(neighbor, edge) {
32831
+ var _neighbor_nodeValue;
32832
+ return !neighbor || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(neighbor, 'br') || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(neighbor) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(neighbor) && edge.test((_neighbor_nodeValue = neighbor.nodeValue) !== null && _neighbor_nodeValue !== void 0 ? _neighbor_nodeValue : '');
32833
+ }
32834
+ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
32736
32835
  afterInit(jodit) {
32737
32836
  jodit.e.on('afterCommand.delete', (command)=>{
32738
32837
  if (command === 'delete') {
@@ -32753,11 +32852,11 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32753
32852
  */ __afterDeleteCommand() {
32754
32853
  const jodit = this.j;
32755
32854
  const current = jodit.s.current();
32756
- if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(current.firstChild, 'br')) {
32855
+ if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(current.firstChild, 'br')) {
32757
32856
  jodit.s.removeNode(current.firstChild);
32758
32857
  }
32759
- 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))) {
32760
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.detach(jodit.editor);
32858
+ if (!(0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_5__.trim)(jodit.editor.textContent || '') && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.first(jodit.editor, (node)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(node, NOT_EMPTY_CONTENT_TAGS)) && (!current || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(current, 'table', jodit.editor))) {
32859
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.detach(jodit.editor);
32761
32860
  const node = jodit.s.setCursorIn(jodit.editor);
32762
32861
  jodit.s.removeNode(node);
32763
32862
  }
@@ -32777,14 +32876,15 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32777
32876
  range.deleteContents();
32778
32877
  const fake = jodit.createInside.fake();
32779
32878
  range.insertNode(fake);
32780
- const leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(fake, true);
32781
- const rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(fake, false);
32879
+ const leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.findSibling(fake, true);
32880
+ const rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.findSibling(fake, false);
32782
32881
  this.__moveContentInLeftSibling(fake, leftSibling, rightSibling);
32882
+ this.__keepSpacesVisible(fake);
32783
32883
  range.setStartBefore(fake);
32784
32884
  range.collapse(true);
32785
32885
  this.__moveCursorInEditableSibling(jodit, leftSibling, fake, range);
32786
32886
  this.__addBrInEmptyBlock(fake, range);
32787
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(fake);
32887
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
32788
32888
  jodit.s.selectRange(caret !== null && caret !== void 0 ? caret : range);
32789
32889
  return false;
32790
32890
  }
@@ -32798,23 +32898,23 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32798
32898
  * Returns where the caret goes, or null when no table is involved
32799
32899
  */ __clearSelectedCells(range) {
32800
32900
  const { editor, createInside } = this.j;
32801
- const startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell, editor);
32802
- const endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell, editor);
32901
+ const startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell, editor);
32902
+ const endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell, editor);
32803
32903
  if (startCell === endCell) {
32804
32904
  return null;
32805
32905
  }
32806
- const startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(startCell, 'table', editor);
32807
- const endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(endCell, 'table', editor);
32906
+ const startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(startCell, 'table', editor);
32907
+ const endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(endCell, 'table', editor);
32808
32908
  const caret = range.cloneRange();
32809
32909
  caret.collapse(true);
32810
32910
  const parts = [];
32811
32911
  const addParts = (table)=>{
32812
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.toArray)(table.rows).flatMap((row)=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.toArray)(row.cells)).filter((cell)=>range.intersectsNode(cell)).forEach((cell)=>{
32912
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.toArray)(table.rows).flatMap((row)=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.toArray)(row.cells)).filter((cell)=>range.intersectsNode(cell)).forEach((cell)=>{
32813
32913
  const part = range.cloneRange();
32814
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(cell, range.startContainer)) {
32914
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.startContainer)) {
32815
32915
  part.setStart(cell, 0);
32816
32916
  }
32817
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(cell, range.endContainer)) {
32917
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.endContainer)) {
32818
32918
  part.setEnd(cell, cell.childNodes.length);
32819
32919
  }
32820
32920
  parts.push([
@@ -32837,9 +32937,9 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32837
32937
  }
32838
32938
  parts.forEach(([cell, part])=>{
32839
32939
  part.deleteContents();
32840
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(cell)) {
32841
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.detach(cell);
32842
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(cell, createInside.element('br'));
32940
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(cell)) {
32941
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.detach(cell);
32942
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(cell, createInside.element('br'));
32843
32943
  }
32844
32944
  });
32845
32945
  return startTable ? caret : null;
@@ -32847,46 +32947,76 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32847
32947
  __moveContentInLeftSibling(fake, leftSibling, rightSibling) {
32848
32948
  leftSibling = this.__defineRightLeftBox(leftSibling);
32849
32949
  // Nothing is moved into a table, and a block left empty after it goes
32850
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(leftSibling, 'table')) {
32851
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(rightSibling)) {
32852
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32950
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(leftSibling, 'table')) {
32951
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
32952
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32853
32953
  }
32854
32954
  return;
32855
32955
  }
32856
- 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)) {
32857
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, fake);
32858
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.moveContent(rightSibling, leftSibling);
32859
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32956
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(rightSibling) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(rightSibling, 'table') && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(leftSibling)) {
32957
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, fake);
32958
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.moveContent(rightSibling, leftSibling);
32959
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32860
32960
  }
32861
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(rightSibling.firstElementChild)) {
32961
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(rightSibling.firstElementChild)) {
32862
32962
  const item = rightSibling.firstElementChild;
32863
32963
  // What's left of the right list's first item joins the left block,
32864
32964
  // up to a list nested in the item
32865
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(leftSibling)) {
32866
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, fake);
32867
- while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(item.firstChild)){
32868
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, item.firstChild);
32965
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(leftSibling)) {
32966
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, fake);
32967
+ while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(item.firstChild)){
32968
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, item.firstChild);
32869
32969
  }
32870
32970
  }
32871
32971
  // Remove empty right LI
32872
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(item)) {
32873
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(item);
32972
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item)) {
32973
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(item);
32874
32974
  }
32875
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(rightSibling)) {
32876
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32975
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
32976
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32877
32977
  }
32878
32978
  }
32879
32979
  }
32980
+ /**
32981
+ * A plain space the deletion leaves at an edge of the block, before a line
32982
+ * break or next to another space isn't shown, and the browser drops it when
32983
+ * the next char is typed. It becomes non-breaking, as in the browsers' own
32984
+ * delete and in Backspace without a selection (#1522)
32985
+ */ __keepSpacesVisible(fake) {
32986
+ var _Dom_closest;
32987
+ const { jodit } = this;
32988
+ const block = (_Dom_closest = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor)) !== null && _Dom_closest !== void 0 ? _Dom_closest : jodit.editor;
32989
+ if (KEEPS_SPACES.has(jodit.ew.getComputedStyle(block).whiteSpace)) {
32990
+ return;
32991
+ }
32992
+ const before = this.__findNeighbor(fake, true, block);
32993
+ const after = this.__findNeighbor(fake, false, block);
32994
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(before) && hidesSpace(after, /^ /)) {
32995
+ before.nodeValue = before.nodeValue.replace(/ +$/, (spaces)=>jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.NBSP_SPACE.repeat(spaces.length));
32996
+ }
32997
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(after) && hidesSpace(before, / $/)) {
32998
+ after.nodeValue = after.nodeValue.replace(/^ +/, (spaces)=>jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.NBSP_SPACE.repeat(spaces.length));
32999
+ }
33000
+ }
33001
+ /**
33002
+ * The text, line break or other element next to the caret in its block,
33003
+ * looking inside inline elements
33004
+ */ __findNeighbor(fake, left, block) {
33005
+ return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.call)(left ? jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.prev : jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.next, fake, (node)=>{
33006
+ var _node_nodeValue;
33007
+ return jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(node) ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.trimInv)((_node_nodeValue = node.nodeValue) !== null && _node_nodeValue !== void 0 ? _node_nodeValue : '').length > 0 : !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isComment(node) && !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isInlineBlock(node) && node.firstChild);
33008
+ }, block);
33009
+ }
32880
33010
  /**
32881
33011
  * If left sibling is list - return last leaf
32882
33012
  */ __defineRightLeftBox(leftSibling) {
32883
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(leftSibling)) {
33013
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(leftSibling)) {
32884
33014
  return leftSibling;
32885
33015
  }
32886
33016
  let lastLeaf = leftSibling.lastElementChild;
32887
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(lastLeaf)) {
33017
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(lastLeaf)) {
32888
33018
  lastLeaf = this.j.createInside.element('li');
32889
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, lastLeaf);
33019
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, lastLeaf);
32890
33020
  }
32891
33021
  return lastLeaf;
32892
33022
  }
@@ -32894,22 +33024,22 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32894
33024
  * Add BR in the empty block left at the caret
32895
33025
  */ __addBrInEmptyBlock(fake, range) {
32896
33026
  const jodit = this.j;
32897
- if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
33027
+ if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
32898
33028
  const br = jodit.createInside.element('br');
32899
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(fake, br);
33029
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.after(fake, br);
32900
33030
  range.setStartBefore(br);
32901
33031
  range.collapse(true);
32902
33032
  }
32903
33033
  }
32904
33034
  __moveCursorInEditableSibling(jodit, leftSibling, fake, range) {
32905
- if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText(leftSibling)) {
33035
+ if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(leftSibling)) {
32906
33036
  var _Dom_closest;
32907
- const root = (_Dom_closest = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock, jodit.editor)) !== null && _Dom_closest !== void 0 ? _Dom_closest : jodit.editor;
32908
- const leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText, root);
33037
+ const root = (_Dom_closest = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor)) !== null && _Dom_closest !== void 0 ? _Dom_closest : jodit.editor;
33038
+ const leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText, root);
32909
33039
  if (leftText) {
32910
33040
  range.setStartAfter(leftText);
32911
33041
  range.collapse(true);
32912
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(fake);
33042
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
32913
33043
  }
32914
33044
  }
32915
33045
  }
@@ -32917,7 +33047,7 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32917
33047
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(deleteCommand, "requires", [
32918
33048
  'backspace'
32919
33049
  ]);
32920
- jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('deleteCommand', deleteCommand);
33050
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('deleteCommand', deleteCommand);
32921
33051
 
32922
33052
 
32923
33053
  /***/ }),
@@ -41040,6 +41170,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.link = {
41040
41170
  followOnDblClick: false,
41041
41171
  processVideoLink: true,
41042
41172
  processPastedLink: true,
41173
+ processTypedLink: false,
41174
+ typedLinkTlds: [],
41175
+ typedLinkFileEndings: [
41176
+ 'zip',
41177
+ 'mov',
41178
+ 'md',
41179
+ 'py',
41180
+ 'sh',
41181
+ 'pub'
41182
+ ],
41043
41183
  deriveUrlFromText: false,
41044
41184
  noFollowCheckbox: true,
41045
41185
  openInNewTabCheckbox: true,
@@ -41091,12 +41231,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41091
41231
  /* unused harmony export link */
41092
41232
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
41093
41233
  /* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
41094
- /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(84839);
41095
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(27795);
41096
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(28077);
41097
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
41098
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
41099
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(65230);
41234
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
41235
+ /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
41236
+ /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27795);
41237
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
41238
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(65946);
41239
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
41240
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(65230);
41241
+ /* harmony import */ var _typed_link__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(99763);
41100
41242
  /*!
41101
41243
  * Jodit Editor (https://xdsoft.net/jodit/)
41102
41244
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -41113,9 +41255,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41113
41255
 
41114
41256
 
41115
41257
 
41258
+
41259
+
41116
41260
  /**
41117
41261
  * Process link. Insert, dblclick or remove format
41118
- */ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
41262
+ */ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
41119
41263
  /** @override */ afterInit(jodit) {
41120
41264
  if (jodit.o.link.followOnDblClick) {
41121
41265
  jodit.e.on('dblclick.link', this.__onDblClickOnLink);
@@ -41124,6 +41268,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41124
41268
  if (jodit.o.link.processPastedLink) {
41125
41269
  jodit.e.on('processPaste.link', this.onProcessPasteLink);
41126
41270
  }
41271
+ if (jodit.o.link.processTypedLink) {
41272
+ this.__linkAfterEnter = jodit.async.microDebounce(this.__linkTyped);
41273
+ 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,
41274
+ // which moves the caret on Tab, and of the backspace plugin
41275
+ .on('keydown', this.__onKeyDown, {
41276
+ top: true
41277
+ });
41278
+ }
41127
41279
  jodit.e.on('generateLinkForm.link', this.__generateForm);
41128
41280
  jodit.registerCommand('openLinkDialog', {
41129
41281
  exec: ()=>{
@@ -41137,7 +41289,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41137
41289
  dialog.setContent(htmlForm);
41138
41290
  dialog.open();
41139
41291
  jodit.async.requestIdleCallback(()=>{
41140
- const { url_input } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.refs)(htmlForm.container);
41292
+ const { url_input } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm.container);
41141
41293
  url_input === null || url_input === void 0 ? void 0 : url_input.focus();
41142
41294
  });
41143
41295
  },
@@ -41145,10 +41297,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41145
41297
  });
41146
41298
  }
41147
41299
  __onDblClickOnLink(e) {
41148
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(e.target, 'a')) {
41300
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
41149
41301
  return;
41150
41302
  }
41151
- const href = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(e.target, 'href');
41303
+ const href = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(e.target, 'href');
41152
41304
  if (href) {
41153
41305
  location.href = href;
41154
41306
  e.preventDefault();
@@ -41156,25 +41308,25 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41156
41308
  }
41157
41309
  onProcessPasteLink(ignore, html) {
41158
41310
  const { jodit } = this;
41159
- if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isURL)(html) || !jodit.o.link.processPastedLink) {
41311
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isURL)(html) || !jodit.o.link.processPastedLink) {
41160
41312
  return;
41161
41313
  }
41162
41314
  jodit.e.stopPropagation('processPaste');
41163
41315
  if (jodit.o.link.processVideoLink) {
41164
41316
  var _ref;
41165
41317
  var _jodit_o_video, _jodit_o_video1, _jodit_o_video2;
41166
- const embed = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.call)((_ref = (_jodit_o_video = jodit.o.video) === null || _jodit_o_video === void 0 ? void 0 : _jodit_o_video.parseUrlToVideoEmbed) !== null && _ref !== void 0 ? _ref : jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.convertMediaUrlToVideoEmbed, html, {
41318
+ const embed = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.call)((_ref = (_jodit_o_video = jodit.o.video) === null || _jodit_o_video === void 0 ? void 0 : _jodit_o_video.parseUrlToVideoEmbed) !== null && _ref !== void 0 ? _ref : jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.convertMediaUrlToVideoEmbed, html, {
41167
41319
  width: (_jodit_o_video1 = jodit.o.video) === null || _jodit_o_video1 === void 0 ? void 0 : _jodit_o_video1.defaultWidth,
41168
41320
  height: (_jodit_o_video2 = jodit.o.video) === null || _jodit_o_video2 === void 0 ? void 0 : _jodit_o_video2.defaultHeight
41169
41321
  });
41170
41322
  if (embed !== html) {
41171
- const media = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.prepareEmbedCode)(jodit, embed);
41172
- return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isString)(media) ? jodit.createInside.fromHTML(media) : media;
41323
+ const media = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.prepareEmbedCode)(jodit, embed);
41324
+ return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(media) ? jodit.createInside.fromHTML(media) : media;
41173
41325
  }
41174
41326
  }
41175
41327
  if (jodit.s.isCollapsed()) {
41176
41328
  const a = jodit.createInside.element('a');
41177
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'href', html);
41329
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', html);
41178
41330
  a.textContent = html;
41179
41331
  jodit.e.fire('applyLink', jodit, a, null);
41180
41332
  return a;
@@ -41192,16 +41344,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41192
41344
  const i18n = jodit.i18n.bind(jodit);
41193
41345
  const { openInNewTabCheckbox, openInNewTabCheckboxDefaultChecked, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
41194
41346
  const html = formTemplate(jodit);
41195
- const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isString)(html) ? jodit.c.fromHTML(html, {
41347
+ const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) ? jodit.c.fromHTML(html, {
41196
41348
  target_checkbox_box: openInNewTabCheckbox,
41197
41349
  nofollow_checkbox_box: noFollowCheckbox
41198
41350
  }) : html;
41199
- const htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isElement(form) ? form : form.container;
41200
- const elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.refs)(htmlForm);
41351
+ const htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form) ? form : form.container;
41352
+ const elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm);
41201
41353
  const { insert, unlink, content_input_box } = elements;
41202
41354
  const { target_checkbox, nofollow_checkbox, url_input } = elements;
41203
41355
  const currentElement = current;
41204
- const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isImage(currentElement);
41356
+ const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isImage(currentElement);
41205
41357
  let { content_input } = elements;
41206
41358
  const { className_input } = elements, { className_select } = elements, { aria_label_input } = elements;
41207
41359
  if (!content_input) {
@@ -41214,12 +41366,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41214
41366
  htmlForm.classList.add(formClassName);
41215
41367
  }
41216
41368
  if (isImageContent) {
41217
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.hide(content_input_box);
41369
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(content_input_box);
41218
41370
  }
41219
41371
  let link;
41220
- const getSelectionText = ()=>link ? link.innerText : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.stripTags)(jodit.s.range.cloneContents(), jodit.ed);
41221
- if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.closest(current, 'a', jodit.editor)) {
41222
- link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.closest(current, 'a', jodit.editor);
41372
+ const getSelectionText = ()=>link ? link.innerText : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.stripTags)(jodit.s.range.cloneContents(), jodit.ed);
41373
+ if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(current, 'a', jodit.editor)) {
41374
+ link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(current, 'a', jodit.editor);
41223
41375
  } else {
41224
41376
  link = false;
41225
41377
  }
@@ -41227,22 +41379,22 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41227
41379
  content_input.value = getSelectionText();
41228
41380
  }
41229
41381
  if (aria_label_input) {
41230
- aria_label_input.value = link ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(link, 'aria-label') || '' : '';
41382
+ aria_label_input.value = link ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'aria-label') || '' : '';
41231
41383
  }
41232
41384
  if (link) {
41233
- url_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(link, 'href') || '';
41385
+ url_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href') || '';
41234
41386
  if (modeClassName) {
41235
41387
  readClassnames(modeClassName, className_input, link, className_select);
41236
41388
  }
41237
41389
  if (openInNewTabCheckbox && target_checkbox) {
41238
- target_checkbox.checked = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(link, 'target') === '_blank';
41390
+ target_checkbox.checked = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'target') === '_blank';
41239
41391
  }
41240
41392
  if (noFollowCheckbox && nofollow_checkbox) {
41241
- nofollow_checkbox.checked = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(link, 'rel') || '').split(/\s+/).includes('nofollow');
41393
+ nofollow_checkbox.checked = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'rel') || '').split(/\s+/).includes('nofollow');
41242
41394
  }
41243
41395
  insert.textContent = i18n('Update');
41244
41396
  } else {
41245
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.hide(unlink);
41397
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(unlink);
41246
41398
  if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
41247
41399
  url_input.value = guessUrlFromText(content_input.value);
41248
41400
  }
@@ -41257,7 +41409,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41257
41409
  jodit.s.restore();
41258
41410
  jodit.history.snapshot.restore(snapshot);
41259
41411
  if (link) {
41260
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.unwrap(link);
41412
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
41261
41413
  }
41262
41414
  jodit.synchronizeValues();
41263
41415
  close();
@@ -41278,12 +41430,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41278
41430
  const textWasChanged = getSelectionText() !== content_input.value.trim();
41279
41431
  const ci = jodit.createInside;
41280
41432
  let caretAfter = null;
41281
- if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isOrContains(jodit.editor, link)) {
41433
+ if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(jodit.editor, link)) {
41282
41434
  if (!jodit.s.isCollapsed()) {
41283
41435
  const node = jodit.s.current();
41284
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(node, 'img')) {
41436
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(node, 'img')) {
41285
41437
  links = [
41286
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.wrap(node, 'a', ci)
41438
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(node, 'a', ci)
41287
41439
  ];
41288
41440
  } else {
41289
41441
  links = jodit.s.wrapInTag('a');
@@ -41303,27 +41455,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41303
41455
  ];
41304
41456
  }
41305
41457
  links.forEach((a)=>{
41306
- ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'href', url_input.value);
41458
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', url_input.value);
41307
41459
  writeClasses(modeClassName, className_input, className_select, a);
41308
41460
  if (!isImageContent) {
41309
41461
  writeImage(a, content_input, textWasChanged, url_input);
41310
41462
  }
41311
41463
  if (openInNewTabCheckbox && target_checkbox) {
41312
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'target', target_checkbox.checked ? '_blank' : null);
41464
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'target', target_checkbox.checked ? '_blank' : null);
41313
41465
  }
41314
41466
  if (noFollowCheckbox && nofollow_checkbox) {
41315
- const relParts = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'rel') || '').split(/\s+/).filter(Boolean);
41467
+ const relParts = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel') || '').split(/\s+/).filter(Boolean);
41316
41468
  const hasNofollow = relParts.includes('nofollow');
41317
41469
  if (nofollow_checkbox.checked && !hasNofollow) {
41318
41470
  relParts.push('nofollow');
41319
41471
  } else if (!nofollow_checkbox.checked && hasNofollow) {
41320
41472
  relParts.splice(relParts.indexOf('nofollow'), 1);
41321
41473
  }
41322
- ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'rel', relParts.length ? relParts.join(' ') : null);
41474
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel', relParts.length ? relParts.join(' ') : null);
41323
41475
  }
41324
41476
  if (aria_label_input) {
41325
41477
  const ariaLabel = aria_label_input.value.trim();
41326
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'aria-label', ariaLabel || null);
41478
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'aria-label', ariaLabel || null);
41327
41479
  }
41328
41480
  jodit.e.fire('applyLink', jodit, a, form);
41329
41481
  });
@@ -41338,7 +41490,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41338
41490
  close();
41339
41491
  return false;
41340
41492
  };
41341
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isElement(form)) {
41493
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form)) {
41342
41494
  jodit.e.on(form, 'submit', (event)=>{
41343
41495
  event.preventDefault();
41344
41496
  event.stopImmediatePropagation();
@@ -41351,11 +41503,96 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41351
41503
  return form;
41352
41504
  }
41353
41505
  /** @override */ beforeDestruct(jodit) {
41354
- jodit.e.off('generateLinkForm.link', this.__generateForm).off('dblclick.link', this.__onDblClickOnLink).off(jodit.editor, 'click.link', this.__onClickReadOnlyLink).off('processPaste.link', this.onProcessPasteLink);
41506
+ 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);
41507
+ }
41508
+ __onTypedSpace(event) {
41509
+ if (event.inputType !== 'insertText' || !event.data || /\S/.test(event.data)) {
41510
+ return;
41511
+ }
41512
+ const { range } = this.j.s;
41513
+ if (range.collapsed) {
41514
+ this.__linkTyped(range.startContainer, range.startOffset - event.data.length);
41515
+ }
41516
+ }
41517
+ __onBeforeEnter() {
41518
+ const { range } = this.j.s;
41519
+ this.__enteredAt = range.collapsed ? [
41520
+ range.startContainer,
41521
+ range.startOffset
41522
+ ] : null;
41523
+ }
41524
+ __onAfterEnter() {
41525
+ if (this.__enteredAt) {
41526
+ this.__linkAfterEnter(...this.__enteredAt);
41527
+ this.__enteredAt = null;
41528
+ }
41529
+ }
41530
+ __forgetLink() {
41531
+ this.__justLinked = null;
41532
+ }
41533
+ __onKeyDown(event) {
41534
+ const { jodit } = this;
41535
+ if (jodit.o.readonly) {
41536
+ return;
41537
+ }
41538
+ const link = this.__justLinked;
41539
+ const modified = event.ctrlKey || event.metaKey || event.altKey;
41540
+ if (!MODIFIER_KEYS.has(event.key)) {
41541
+ this.__justLinked = null;
41542
+ }
41543
+ if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_BACKSPACE && !modified && (link === null || link === void 0 ? void 0 : link.isConnected)) {
41544
+ this.__recordStep();
41545
+ jodit.s.save();
41546
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
41547
+ jodit.s.restore();
41548
+ this.__recordStep();
41549
+ // Or the backspace plugin takes a character too
41550
+ jodit.e.stopPropagation('keydown');
41551
+ return false;
41552
+ }
41553
+ const { range } = jodit.s;
41554
+ if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB && !modified && range.collapsed) {
41555
+ this.__linkTyped(range.startContainer, range.startOffset);
41556
+ }
41557
+ }
41558
+ /**
41559
+ * Links the address that ends at `end` in a text node, as a step of its
41560
+ * own in the history, so Undo straight after takes the link off and
41561
+ * leaves the text
41562
+ */ __linkTyped(node, end) {
41563
+ const { jodit } = this;
41564
+ 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)) {
41565
+ return;
41566
+ }
41567
+ const found = (0,_typed_link__WEBPACK_IMPORTED_MODULE_9__.findTypedLink)(node.data, end, jodit.o.link.typedLinkTlds, jodit.o.link.typedLinkFileEndings);
41568
+ if (!found) {
41569
+ return;
41570
+ }
41571
+ const [start, stop, href] = found;
41572
+ this.__recordStep();
41573
+ // The text round the caret splits, and WebKit doesn't keep the caret
41574
+ // where it was
41575
+ jodit.s.save();
41576
+ const range = jodit.ed.createRange();
41577
+ range.setStart(node, start);
41578
+ range.setEnd(node, stop);
41579
+ const a = jodit.createInside.element('a');
41580
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', href);
41581
+ range.surroundContents(a);
41582
+ jodit.s.restore();
41583
+ jodit.e.fire('applyLink', jodit, a, null);
41584
+ this.__recordStep();
41585
+ this.__justLinked = a;
41586
+ }
41587
+ /**
41588
+ * Reports what's changed and makes it a history step of its own
41589
+ */ __recordStep() {
41590
+ this.j.setEditorValue();
41591
+ this.j.e.fire('internalChange');
41355
41592
  }
41356
41593
  __onClickReadOnlyLink(e) {
41357
41594
  const { jodit } = this;
41358
- if (jodit.o.readonly && jodit.o.link.preventReadOnlyNavigation && jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(e.target, 'a')) {
41595
+ if (jodit.o.readonly && jodit.o.link.preventReadOnlyNavigation && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
41359
41596
  e.preventDefault();
41360
41597
  }
41361
41598
  }
@@ -41365,22 +41602,59 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
41365
41602
  name: 'link',
41366
41603
  group: 'insert'
41367
41604
  }
41368
- ]);
41605
+ ]), /**
41606
+ * Where the caret was when Enter was pressed. Enter splits the line in a
41607
+ * history transaction, so the link waits until it's over
41608
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__enteredAt", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__linkAfterEnter", ()=>{}), /**
41609
+ * The link just made, which Backspace straight after takes off again, as
41610
+ * in CKEditor 5. Any other key but a modifier, a click or a command
41611
+ * forgets it
41612
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__justLinked", null);
41369
41613
  }
41370
41614
  }
41371
41615
  ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
41372
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
41616
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
41373
41617
  ], link.prototype, "__onDblClickOnLink", null);
41374
41618
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
41375
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
41619
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
41376
41620
  ], link.prototype, "onProcessPasteLink", null);
41377
41621
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
41378
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
41622
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
41379
41623
  ], link.prototype, "__generateForm", null);
41380
41624
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
41381
- jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
41625
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
41626
+ ], link.prototype, "__onTypedSpace", null);
41627
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
41628
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
41629
+ ], link.prototype, "__onBeforeEnter", null);
41630
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
41631
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
41632
+ ], link.prototype, "__onAfterEnter", null);
41633
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
41634
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
41635
+ ], link.prototype, "__forgetLink", null);
41636
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
41637
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
41638
+ ], link.prototype, "__onKeyDown", null);
41639
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
41640
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
41641
+ ], link.prototype, "__linkTyped", null);
41642
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
41643
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
41382
41644
  ], link.prototype, "__onClickReadOnlyLink", null);
41383
- jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('link', link);
41645
+ const NO_TYPED_LINKS = new Set([
41646
+ 'a',
41647
+ 'pre',
41648
+ 'code'
41649
+ ]);
41650
+ const MODIFIER_KEYS = new Set([
41651
+ 'Shift',
41652
+ 'Control',
41653
+ 'Alt',
41654
+ 'Meta',
41655
+ 'CapsLock'
41656
+ ]);
41657
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('link', link);
41384
41658
  /**
41385
41659
  * Guess a usable `href` from the selected text for the link dialog.
41386
41660
  * Returns an empty string when the text is not a plausible URL/email,
@@ -41395,7 +41669,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('link', link);
41395
41669
  return value;
41396
41670
  }
41397
41671
  // email address -> mailto:
41398
- if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
41672
+ if (_typed_link__WEBPACK_IMPORTED_MODULE_9__.EMAIL.test(value)) {
41399
41673
  return `mailto:${value}`;
41400
41674
  }
41401
41675
  // bare domain like example.com or www.example.com/path -> https://
@@ -41408,14 +41682,14 @@ function writeClasses(modeClassName, className_input, className_select, a) {
41408
41682
  if (modeClassName && (className_input !== null && className_input !== void 0 ? className_input : className_select)) {
41409
41683
  if (modeClassName === 'input') {
41410
41684
  if (className_input.value === '' && a.hasAttribute('class')) {
41411
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'class', null);
41685
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
41412
41686
  }
41413
41687
  if (className_input.value !== '') {
41414
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'class', className_input.value);
41688
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', className_input.value);
41415
41689
  }
41416
41690
  } else if (modeClassName === 'select') {
41417
41691
  if (a.hasAttribute('class')) {
41418
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(a, 'class', null);
41692
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
41419
41693
  }
41420
41694
  for(let i = 0; i < className_select.selectedOptions.length; i++){
41421
41695
  var _className_select_selectedOptions_item;
@@ -41433,7 +41707,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
41433
41707
  switch(modeClassName){
41434
41708
  case 'input':
41435
41709
  if (className_input) {
41436
- className_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(link, 'class') || '';
41710
+ className_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
41437
41711
  }
41438
41712
  break;
41439
41713
  case 'select':
@@ -41444,7 +41718,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
41444
41718
  option.selected = false;
41445
41719
  }
41446
41720
  }
41447
- const classNames = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.attr)(link, 'class') || '';
41721
+ const classNames = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
41448
41722
  classNames.split(/\s+/).filter((cn)=>cn.trim().length > 0).forEach((className)=>{
41449
41723
  if (className) {
41450
41724
  for(let i = 0; i < className_select.options.length; i++){
@@ -41575,6 +41849,156 @@ const formTemplate = (editor)=>{
41575
41849
  /* harmony export */ ]);
41576
41850
 
41577
41851
 
41852
+ /***/ }),
41853
+
41854
+ /***/ 4441:
41855
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
41856
+
41857
+ "use strict";
41858
+ /*!
41859
+ * Jodit Editor (https://xdsoft.net/jodit/)
41860
+ * Released under MIT see LICENSE.txt in the project root for license information.
41861
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
41862
+ */ /**
41863
+ * @module plugins/link
41864
+ */ /**
41865
+ * The endings a bare domain links with, besides those `link.typedLinkTlds`
41866
+ * adds: the generic ones of at least 1 in 1,000 of the sites in Tranco's top
41867
+ * million (list GQ38K, https://tranco-list.eu/list/GQ38K), then every
41868
+ * two-letter one in IANA's list (version 2026102900,
41869
+ * https://data.iana.org/TLD/tlds-alpha-by-domain.txt). Together they're the
41870
+ * endings of 96% of those sites
41871
+ * @private
41872
+ */ const TLDS = new Set(`
41873
+ app biz casino click cloud club com dev edu gov info live net online org pro
41874
+ shop site space store tech top vip xyz
41875
+ 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
41876
+ 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
41877
+ 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
41878
+ 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
41879
+ 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
41880
+ 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
41881
+ 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
41882
+ 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
41883
+ 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
41884
+ tv tw tz ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw
41885
+ `.trim().split(/\s+/));
41886
+
41887
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, [
41888
+ /* harmony export */ "TLDS", 0, /* binding */ TLDS
41889
+ /* harmony export */ ]);
41890
+
41891
+
41892
+ /***/ }),
41893
+
41894
+ /***/ 99763:
41895
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
41896
+
41897
+ "use strict";
41898
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
41899
+ /* harmony export */ findTypedLink: function() { return /* binding */ findTypedLink; }
41900
+ /* harmony export */ });
41901
+ /* harmony import */ var jodit_core_helpers_checker_is_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91764);
41902
+ /* harmony import */ var _tlds__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4441);
41903
+ /*!
41904
+ * Jodit Editor (https://xdsoft.net/jodit/)
41905
+ * Released under MIT see LICENSE.txt in the project root for license information.
41906
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
41907
+ */ /**
41908
+ * @module plugins/link
41909
+ */
41910
+
41911
+ /**
41912
+ * An email address, for `mailto:`
41913
+ * @private
41914
+ */ const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
41915
+ const OPENING = new Set([
41916
+ '(',
41917
+ '[',
41918
+ '"',
41919
+ "'",
41920
+ '“',
41921
+ '‘',
41922
+ '<'
41923
+ ]);
41924
+ const CLOSING = new Set([
41925
+ '.',
41926
+ ',',
41927
+ ';',
41928
+ ':',
41929
+ '!',
41930
+ '?',
41931
+ '"',
41932
+ "'",
41933
+ '”',
41934
+ '’',
41935
+ '>'
41936
+ ]);
41937
+ const BRACKETS = {
41938
+ ')': '(',
41939
+ ']': '['
41940
+ };
41941
+ const LABEL = /^[a-z\d][a-z\d-]{0,62}$/i;
41942
+ /**
41943
+ * The address that ends at `end` in a line of text typed, back to the
41944
+ * whitespace before it, as `[start, end, href]`. Punctuation round it, such as
41945
+ * a sentence's full stop or a bracket the address doesn't open, stays out.
41946
+ * An address counts with a scheme, with `www.`, as an email address, or as a
41947
+ * bare domain that `isBareDomain` accepts, so `Node.js` or `e.g.` don't
41948
+ * @private
41949
+ */ function findTypedLink(text, end, tlds, fileEndings) {
41950
+ let start = end;
41951
+ while(start > 0 && !/\s/.test(text[start - 1])){
41952
+ start -= 1;
41953
+ }
41954
+ while(start < end && OPENING.has(text[start])){
41955
+ start += 1;
41956
+ }
41957
+ while(end > start){
41958
+ const char = text[end - 1];
41959
+ const opening = BRACKETS[char];
41960
+ if (CLOSING.has(char) || opening && !text.slice(start, end - 1).includes(opening)) {
41961
+ end -= 1;
41962
+ } else {
41963
+ break;
41964
+ }
41965
+ }
41966
+ const href = typedLinkHref(text.slice(start, end), tlds, fileEndings);
41967
+ return href ? [
41968
+ start,
41969
+ end,
41970
+ href
41971
+ ] : null;
41972
+ }
41973
+ function typedLinkHref(address, tlds, fileEndings) {
41974
+ const email = address.replace(/^mailto:/i, '');
41975
+ if (EMAIL.test(email)) {
41976
+ return `mailto:${email}`;
41977
+ }
41978
+ if (/^www\.[^\s.]+\.\S+$/i.test(address) || isBareDomain(address, tlds, fileEndings)) {
41979
+ return `https://${address}`;
41980
+ }
41981
+ return /^[a-z][a-z\d+.-]*:\/\//i.test(address) && (0,jodit_core_helpers_checker_is_url__WEBPACK_IMPORTED_MODULE_0__.isURL)(address) ? address : '';
41982
+ }
41983
+ /**
41984
+ * A domain typed without a scheme or `www.`, as `example.com`, `elections.nz`
41985
+ * or `bit.ly/enrol`. Its ending has to be in `TLDS` or `tlds`, typed in lower
41986
+ * case, so `Node.js` and a sentence run on, as in `home.It`, don't count, and
41987
+ * not in `fileEndings`, as in `photos.zip`. The first part has a letter,
41988
+ * which leaves out a time or a numbered step such as `11.am`
41989
+ */ function isBareDomain(address, tlds, fileEndings) {
41990
+ const cut = address.search(/[/?#]/);
41991
+ const host = cut < 0 ? address : address.slice(0, cut);
41992
+ const labels = host.split('.');
41993
+ const ending = labels[labels.length - 1];
41994
+ 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]);
41995
+ }
41996
+
41997
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, [
41998
+ /* harmony export */ "EMAIL", 0, /* binding */ EMAIL
41999
+ /* harmony export */ ]);
42000
+
42001
+
41578
42002
  /***/ }),
41579
42003
 
41580
42004
  /***/ 51730:
@@ -43630,7 +44054,7 @@ const key = 'table_processor_observer-resize';
43630
44054
  /**
43631
44055
  * Click on resize handle
43632
44056
  */ onHandleMouseDown(event) {
43633
- if (this.j.isLocked) {
44057
+ if (this.j.isLocked || this.j.o.readonly) {
43634
44058
  return;
43635
44059
  }
43636
44060
  this.drag = true;
@@ -43665,10 +44089,15 @@ const key = 'table_processor_observer-resize';
43665
44089
  let box;
43666
44090
  this.minX = 0;
43667
44091
  this.maxX = 1000000;
44092
+ this.startTableWidth = this.workTable.offsetWidth;
43668
44093
  if (this.wholeTable != null) {
43669
- const tableBox = this.workTable.parentNode.getBoundingClientRect();
44094
+ const parent = this.workTable.parentNode;
44095
+ const tableBox = parent.getBoundingClientRect();
43670
44096
  this.minX = tableBox.left;
43671
44097
  this.maxX = this.minX + tableBox.width;
44098
+ const side = this.isRTL ? 'marginRight' : 'marginLeft';
44099
+ this.startParentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getContentWidth)(parent, this.j.ew);
44100
+ this.startMargin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
43672
44101
  } else {
43673
44102
  // find maximum columns
43674
44103
  const coordinate = this.module.formalCoordinate(this.workTable, this.workCell, true);
@@ -43682,6 +44111,17 @@ const key = 'table_processor_observer-resize';
43682
44111
  this.maxX = Math.min(box.left + box.width - jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.NEARBY / 2, this.maxX);
43683
44112
  }
43684
44113
  });
44114
+ const matrix = this.module.formalMatrix(this.workTable);
44115
+ this.startWidths = this.resizedColumns().map((column)=>{
44116
+ const cells = matrix.map((row)=>row[column]);
44117
+ const index = cells.findIndex((td)=>td.colSpan === 1 || cells.length === 1);
44118
+ const cell = cells[index];
44119
+ return [
44120
+ cell,
44121
+ cell ? cell.offsetWidth : 0,
44122
+ cells.slice(Math.max(index, 0) + 1)
44123
+ ];
44124
+ });
43685
44125
  }
43686
44126
  return false;
43687
44127
  }
@@ -43710,8 +44150,11 @@ const key = 'table_processor_observer-resize';
43710
44150
  x = this.maxX;
43711
44151
  }
43712
44152
  this.resizeDelta = x - this.startX + (!this.j.o.iframe ? 0 : workplacePosition.left);
43713
- this.restoreStyles();
43714
- this.resizeColumnsOrTable();
44153
+ if (this.wholeTable == null) {
44154
+ this.setColumnWidths();
44155
+ } else {
44156
+ this.resizeTable();
44157
+ }
43715
44158
  const tableBox = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.offset)(this.workTable, this.j, this.j.ed);
43716
44159
  Object.assign(this.resizeHandler.style, {
43717
44160
  left: this.startLeft + this.columnEdge() - this.startEdge + 'px',
@@ -43824,21 +44267,49 @@ const key = 'table_processor_observer-resize';
43824
44267
  };
43825
44268
  this.scrollFrame = this.j.async.requestAnimationFrame(scroll);
43826
44269
  }
44270
+ /**
44271
+ * The two columns a column drag resizes: the work cell's last, and the
44272
+ * next cell's first
44273
+ */ resizedColumns() {
44274
+ const nextTD = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.call)(this.isRTL ? jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.prev : jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.next, this.workCell, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isCell, this.workCell.parentNode);
44275
+ return [
44276
+ this.module.formalCoordinate(this.workTable, this.workCell, true)[1],
44277
+ this.module.formalCoordinate(this.workTable, nextTD)[1]
44278
+ ];
44279
+ }
43827
44280
  /**
43828
44281
  * Resize only one column
43829
44282
  */ resizeColumns() {
43830
44283
  const delta = this.resizeDelta;
43831
44284
  const marked = [];
43832
44285
  const tableModule = this.module;
43833
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, this.workCell, true)[1], delta, true, marked);
43834
- 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);
43835
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, nextTD)[1], -delta, false, marked);
44286
+ const [column, nextColumn] = this.resizedColumns();
44287
+ tableModule.setColumnWidthByDelta(this.workTable, column, delta, true, marked);
44288
+ tableModule.setColumnWidthByDelta(this.workTable, nextColumn, -delta, false, marked);
44289
+ }
44290
+ /**
44291
+ * Sets the widths `resizeColumns` would while the handle is dragged, from
44292
+ * the widths the drag started with, so that a move doesn't put back every
44293
+ * cell's style and lay the table out again to measure them
44294
+ */ setColumnWidths() {
44295
+ this.startWidths.forEach(([cell, width, below], index)=>{
44296
+ const delta = index ? -this.resizeDelta : this.resizeDelta;
44297
+ if (cell) {
44298
+ (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(cell, 'width', ((width + delta) / this.startTableWidth * 100).toFixed(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.ACCURACY) + '%');
44299
+ }
44300
+ below.forEach((td)=>{
44301
+ td.style.removeProperty('width');
44302
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(td, 'style')) {
44303
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(td, 'style', null);
44304
+ }
44305
+ });
44306
+ });
43836
44307
  }
43837
44308
  /**
43838
44309
  * Resize whole table
43839
44310
  */ resizeTable() {
43840
44311
  const delta = this.resizeDelta * (this.isRTL ? -1 : 1);
43841
- const width = this.workTable.offsetWidth, parentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getContentWidth)(this.workTable.parentNode, this.j.ew);
44312
+ const width = this.startTableWidth, parentWidth = this.startParentWidth;
43842
44313
  // for RTL use mirror logic
43843
44314
  const rightSide = !this.wholeTable;
43844
44315
  const needChangeWidth = this.isRTL ? !rightSide : rightSide;
@@ -43847,10 +44318,9 @@ const key = 'table_processor_observer-resize';
43847
44318
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, 'width', (width + delta) / parentWidth * 100 + '%');
43848
44319
  } else {
43849
44320
  const side = this.isRTL ? 'marginRight' : 'marginLeft';
43850
- const margin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
43851
44321
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, {
43852
44322
  width: (width - delta) / parentWidth * 100 + '%',
43853
- [side]: (margin + delta) / parentWidth * 100 + '%'
44323
+ [side]: (this.startMargin + delta) / parentWidth * 100 + '%'
43854
44324
  });
43855
44325
  }
43856
44326
  }
@@ -43926,9 +44396,10 @@ const key = 'table_processor_observer-resize';
43926
44396
  if (!editor.o.tableAllowCellResize) {
43927
44397
  return;
43928
44398
  }
43929
- editor.e.off(this.j.ow, '.resize-cells').off('.resize-cells').on('change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells', ()=>{
44399
+ const observeTables = ()=>{
43930
44400
  ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', editor.editor).forEach(this.observe);
43931
- }).on(this.j.ow, 'scroll.resize-cells', ()=>{
44401
+ };
44402
+ editor.e.off(this.j.ow, '.resize-cells').off('.resize-cells').on('change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells', observeTables).on(this.j.ow, 'scroll.resize-cells', ()=>{
43932
44403
  if (!this.drag || this.workRow) {
43933
44404
  return;
43934
44405
  }
@@ -43944,6 +44415,8 @@ const key = 'table_processor_observer-resize';
43944
44415
  tableModule.normalizeTable(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(td, 'table', editor.editor));
43945
44416
  });
43946
44417
  });
44418
+ // None of those events comes with the editor's starting value
44419
+ observeTables();
43947
44420
  }
43948
44421
  /**
43949
44422
  * Add to every Table listeners
@@ -43957,7 +44430,9 @@ const key = 'table_processor_observer-resize';
43957
44430
  this.hideResizeHandle();
43958
44431
  }
43959
44432
  }).on(table, 'mousemove.resize-cells touchmove.resize-cells', this.j.async.throttle((event)=>{
43960
- if (this.j.isLocked) {
44433
+ // A drag from a cell isn't a resize, and the handle on
44434
+ // a border it passes would take its moves (#1778)
44435
+ if (this.j.isLocked || this.j.o.readonly || event.buttons) {
43961
44436
  return;
43962
44437
  }
43963
44438
  const cell = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.up(event.target, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isCell, table);
@@ -43990,8 +44465,15 @@ const key = 'table_processor_observer-resize';
43990
44465
  }
43991
44466
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "hideTimeout", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "drag", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "wholeTable", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "workCell", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "workTable", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "minX", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "maxX", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startX", 0), /**
43992
44467
  * The table's and its cells' styles as a column drag started, put back
43993
- * before each new width
44468
+ * as it ends, before the final widths
43994
44469
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startStyles", []), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startLeft", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startEdge", 0), /**
44470
+ * For each of the two columns a drag resizes, the cell whose width
44471
+ * `setColumnWidthByDelta` sets, with its width as the drag started, and
44472
+ * the cells below it, whose widths it clears
44473
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startWidths", []), /**
44474
+ * The table's width as the drag started, and for a drag of its edge, the
44475
+ * width inside what holds it and its margin on that side
44476
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startTableWidth", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startParentWidth", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startMargin", 0), /**
43995
44477
  * The row whose height the handle sets, or null while it sets a width
43996
44478
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "workRow", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startY", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startHeight", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "rowStyle", null), /**
43997
44479
  * The boxes that scroll the row, with their styles, as a row drag turns
@@ -45773,7 +46255,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.tableAllowCellSelecti
45773
46255
 
45774
46256
 
45775
46257
  const key = 'table_processor_observer';
45776
- const MOUSE_MOVE_LABEL = 'onMoveTableSelectCell';
45777
46258
  class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
45778
46259
  /**
45779
46260
  * Shortcut for Jodit.modules.Table
@@ -45788,6 +46269,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45788
46269
  // move the caret, as table-keyboard-navigation's do
45789
46270
  .on('keydown', this.__onKeyDown, {
45790
46271
  top: true
46272
+ }).on('clickEditor', this.__onClickAfterDrag, {
46273
+ top: true
45791
46274
  }).on('keydown.select-cells', (event)=>{
45792
46275
  if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB) {
45793
46276
  this.unselectCells();
@@ -45907,18 +46390,36 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45907
46390
  }
45908
46391
  this.__isSelectionMode = true;
45909
46392
  this.__selectedCell = cell;
46393
+ this.__movedTo = cell;
45910
46394
  this.__tableModule.addSelection(cell);
45911
- this.j.e.on(table, 'mousemove.select-cells touchmove.select-cells', // Don't use decorator because need clear label on mouseup
45912
- this.j.async.throttle(this.__onMove.bind(this, table), {
45913
- label: MOUSE_MOVE_LABEL,
45914
- timeout: this.j.defaultTimeout / 2
45915
- })).on(table, 'mouseup.select-cells touchend.select-cells', this.__onStopSelection.bind(this, table));
46395
+ this.j.e.on(table, 'mousemove.select-cells touchmove.select-cells', this.__onMove.bind(this, table)).on(table, 'mouseup.select-cells touchend.select-cells', this.__onStopSelection.bind(this, table));
46396
+ new Set([
46397
+ this.j.ew,
46398
+ this.j.ow
46399
+ ]).forEach((win)=>this.j.e.on(win, 'mouseup.select-cells touchend.select-cells', this.__onRelease.bind(this, table)));
45916
46400
  return false;
45917
46401
  }
45918
46402
  onOutsideClick() {
45919
46403
  this.__selectedCell = null;
45920
46404
  this.__onRemoveSelection();
45921
46405
  }
46406
+ onMouseDown() {
46407
+ this.__keepMarks = false;
46408
+ }
46409
+ /**
46410
+ * The click that ends a drag let go outside the table, and inside the
46411
+ * editor, lands on the editor. Taken on, it would unmark the cells and
46412
+ * close their popup. As for the click on a row after a drag over the
46413
+ * cells, the browser's own selection from the drag goes
46414
+ */ __onClickAfterDrag() {
46415
+ if (this.__keepMarks) {
46416
+ var _this_j_s_sel;
46417
+ this.__keepMarks = false;
46418
+ (_this_j_s_sel = this.j.s.sel) === null || _this_j_s_sel === void 0 ? void 0 : _this_j_s_sel.removeAllRanges();
46419
+ this.j.e.stopPropagation('clickEditor');
46420
+ return false;
46421
+ }
46422
+ }
45922
46423
  onChange() {
45923
46424
  if (!this.j.isLocked && !this.__isSelectionMode) {
45924
46425
  this.__onRemoveSelection();
@@ -45937,16 +46438,20 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45937
46438
  // Inside Shadow DOM `document.elementFromPoint` returns the shadow
45938
46439
  // host, so the lookup must start from the shadow root
45939
46440
  const node = ((_this_j_o_shadowRoot = this.j.o.shadowRoot) !== null && _this_j_o_shadowRoot !== void 0 ? _this_j_o_shadowRoot : this.j.ed).elementFromPoint(e.clientX, e.clientY);
45940
- if (!node) {
45941
- return;
45942
- }
45943
- const cell = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
46441
+ const cell = node && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
45944
46442
  'td',
45945
46443
  'th'
45946
46444
  ], table);
45947
46445
  if (!cell || !this.__selectedCell) {
45948
46446
  return;
45949
46447
  }
46448
+ // The marks change only when the mouse goes into another cell, and then
46449
+ // at once rather than throttled, as the browser's own selection from
46450
+ // the drag shows in the cells between until they do (#1778)
46451
+ if (cell === this.__movedTo) {
46452
+ return;
46453
+ }
46454
+ this.__movedTo = cell;
45950
46455
  if (cell !== this.__selectedCell) {
45951
46456
  this.j.lock(key);
45952
46457
  }
@@ -45985,7 +46490,6 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45985
46490
  * Stop a selection process
45986
46491
  */ __onStopSelection(table, e) {
45987
46492
  var _this_j_o_shadowRoot;
45988
- var _box_bound__, _box_bound__1;
45989
46493
  if (!this.__selectedCell) {
45990
46494
  return;
45991
46495
  }
@@ -46008,10 +46512,33 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46008
46512
  if (ownTable && ownTable !== table) {
46009
46513
  return; // Nested tables
46010
46514
  }
46011
- const bound = this.__tableModule.getSelectedBound(table, [
46515
+ this.__showCellsPopup(table, [
46012
46516
  cell,
46013
46517
  this.__selectedCell
46014
- ]), box = this.__tableModule.formalMatrix(table);
46518
+ ]);
46519
+ this.__stopListening();
46520
+ }
46521
+ /**
46522
+ * A drag let go outside the table doesn't reach the table's `mouseup`, so
46523
+ * the window's ends it, leaving the cells marked as they were (#1774)
46524
+ */ __onRelease(table, e) {
46525
+ if (this.__isSelectionMode) {
46526
+ this.__isSelectionMode = false;
46527
+ if (!this.j.isLockedNotBy(key)) {
46528
+ this.j.unlock();
46529
+ }
46530
+ const cells = this.__tableModule.getAllSelectedCells();
46531
+ // One let go outside the editor clicks outside it, which unmarks them
46532
+ if (cells.length > 1 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.j.editor, e.target)) {
46533
+ this.__keepMarks = true;
46534
+ this.__showCellsPopup(table, cells);
46535
+ }
46536
+ }
46537
+ this.__stopListening();
46538
+ }
46539
+ __showCellsPopup(table, cells) {
46540
+ var _box_bound__, _box_bound__1;
46541
+ const bound = this.__tableModule.getSelectedBound(table, cells), box = this.__tableModule.formalMatrix(table);
46015
46542
  const max = (_box_bound__ = box[bound[1][0]]) === null || _box_bound__ === void 0 ? void 0 : _box_bound__[bound[1][1]], min = (_box_bound__1 = box[bound[0][0]]) === null || _box_bound__1 === void 0 ? void 0 : _box_bound__1[bound[0][1]];
46016
46543
  // `getSelectedBound` keeps its `Infinity` sentinel when none of the
46017
46544
  // selected cells belong to this table's matrix — e.g. after a
@@ -46031,10 +46558,16 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46031
46558
  height: maxOffset.top - minOffset.top + maxOffset.height
46032
46559
  };
46033
46560
  }, 'cells');
46034
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', this.j.editor).forEach((table)=>{
46561
+ }
46562
+ __stopListening() {
46563
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', this.j.editor).forEach((table)=>{
46035
46564
  this.j.e.off(table, 'mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells');
46036
46565
  });
46037
- this.j.async.clearTimeout(MOUSE_MOVE_LABEL);
46566
+ new Set([
46567
+ this.j.ew,
46568
+ this.j.ow
46569
+ ]).forEach((win)=>this.j.e.off(win, 'mouseup.select-cells touchend.select-cells'));
46570
+ this.__movedTo = null;
46038
46571
  }
46039
46572
  /**
46040
46573
  * Remove selection for all cells
@@ -46205,7 +46738,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46205
46738
  }
46206
46739
  /** @override */ beforeDestruct(jodit) {
46207
46740
  this.__onRemoveSelection();
46208
- jodit.e.off('.select-cells').off('keydown', this.__onKeyDown);
46741
+ this.__stopListening();
46742
+ jodit.e.off('.select-cells').off('keydown', this.__onKeyDown).off('clickEditor', this.__onClickAfterDrag);
46209
46743
  }
46210
46744
  constructor(...args){
46211
46745
  super(...args), /**
@@ -46216,7 +46750,12 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46216
46750
  * First selected cell
46217
46751
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__selectedCell", null), /**
46218
46752
  * User is selecting cells now
46219
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isSelectionMode", false);
46753
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isSelectionMode", false), /**
46754
+ * The cell the marks were last drawn to
46755
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__movedTo", null), /**
46756
+ * A drag let go outside the table ends in a click on the editor, which
46757
+ * would unmark its cells
46758
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__keepMarks", false);
46220
46759
  }
46221
46760
  }
46222
46761
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(selectCells, "requires", [
@@ -46234,6 +46773,15 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46234
46773
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46235
46774
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':outsideClick')
46236
46775
  ], selectCells.prototype, "onOutsideClick", null);
46776
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46777
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
46778
+ ':mousedown',
46779
+ ':touchstart'
46780
+ ])
46781
+ ], selectCells.prototype, "onMouseDown", null);
46782
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46783
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
46784
+ ], selectCells.prototype, "__onClickAfterDrag", null);
46237
46785
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46238
46786
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':change')
46239
46787
  ], selectCells.prototype, "onChange", null);
@@ -46285,10 +46833,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46285
46833
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
46286
46834
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
46287
46835
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
46288
- /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(57821);
46289
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
46290
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4099);
46291
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(47670);
46836
+ /* harmony import */ var jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(88475);
46837
+ /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(57821);
46838
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(91206);
46839
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(4099);
46840
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(47670);
46292
46841
  /*!
46293
46842
  * Jodit Editor (https://xdsoft.net/jodit/)
46294
46843
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -46307,6 +46856,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46307
46856
 
46308
46857
 
46309
46858
 
46859
+
46310
46860
  /**
46311
46861
  * A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
46312
46862
  *
@@ -46317,22 +46867,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46317
46867
  * console.log(img.src);
46318
46868
  * })
46319
46869
  * ```
46320
- */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
46870
+ */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__.Plugin {
46321
46871
  afterInit(jodit) {
46322
46872
  this.proxyEventsList.forEach((eventName)=>{
46323
46873
  jodit.e.on(eventName + '.select', this.onStartSelection);
46324
46874
  });
46875
+ jodit.e.on('dblclick', this.__onDblClickBesideRow, {
46876
+ top: true
46877
+ });
46325
46878
  }
46326
46879
  beforeDestruct(jodit) {
46327
46880
  this.proxyEventsList.forEach((eventName)=>{
46328
- jodit.e.on(eventName + '.select', this.onStartSelection);
46881
+ jodit.e.off(eventName + '.select', this.onStartSelection);
46329
46882
  });
46883
+ this.__endPressBesideRow();
46884
+ jodit.e.off('dblclick', this.__onDblClickBesideRow);
46330
46885
  }
46331
46886
  onStartSelection(e) {
46332
46887
  const { j } = this;
46333
46888
  let result, target = e.target;
46334
46889
  while(result === undefined && target && target !== j.editor){
46335
- result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
46890
+ result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_7__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
46336
46891
  target = target.parentElement;
46337
46892
  }
46338
46893
  if (e.type === 'click' && result === undefined && target === j.editor) {
@@ -46352,10 +46907,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46352
46907
  }
46353
46908
  // Selecting the text of a popup input with the mouse and releasing
46354
46909
  // the button past the popup's edge is not a click outside of it.
46355
- if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup)) {
46910
+ if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup)) {
46356
46911
  return;
46357
46912
  }
46358
- const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup);
46913
+ const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup);
46359
46914
  if (!box) {
46360
46915
  this.j.e.fire('outsideClick', e);
46361
46916
  }
@@ -46401,6 +46956,128 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46401
46956
  s.setCursorAfter(text);
46402
46957
  }
46403
46958
  }
46959
+ /**
46960
+ * The table row the mouse is to the right of
46961
+ */ __rowBeside(e) {
46962
+ var _rows_find;
46963
+ const { j } = this;
46964
+ const target = e.target;
46965
+ if (j.o.readonly || e.button !== 0 || e.detail > 2 || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isHTMLElement(target) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(target, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isCell, j.editor)) {
46966
+ return null;
46967
+ }
46968
+ const table = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(target.children).find((elm)=>{
46969
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(elm, 'table')) {
46970
+ return false;
46971
+ }
46972
+ const box = elm.getBoundingClientRect();
46973
+ return e.clientX >= box.right && e.clientY >= box.top && e.clientY < box.bottom;
46974
+ });
46975
+ const rows = table ? (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(table.rows).filter((row)=>row.cells.length) : [];
46976
+ if (!table || !rows.length) {
46977
+ return null;
46978
+ }
46979
+ const row = (_rows_find = rows.find((row)=>e.clientY < row.getBoundingClientRect().bottom)) !== null && _rows_find !== void 0 ? _rows_find : rows[rows.length - 1];
46980
+ return {
46981
+ table,
46982
+ row
46983
+ };
46984
+ }
46985
+ /**
46986
+ * A press to the right of a table row puts the caret where Word's typing
46987
+ * goes from there: the start of the next row's first cell, or of the block
46988
+ * after the table for the last row (#1770). The browsers put it after the
46989
+ * table, whichever row it's beside, so typing starts a new line below it.
46990
+ * Their own press is stopped, as its drag would start after the table and
46991
+ * take in the rows below first
46992
+ */ onMouseDownBesideTableRow(e) {
46993
+ const { j } = this;
46994
+ const beside = this.__rowBeside(e);
46995
+ if (!beside) {
46996
+ return;
46997
+ }
46998
+ // A press before the last one was let go must not stack its listeners
46999
+ this.__endPressBesideRow();
47000
+ e.preventDefault();
47001
+ this.__putCaretBesideRow(beside.table, beside.row);
47002
+ this.__pressBesideRow = {
47003
+ row: beside.row,
47004
+ caret: j.s.range.cloneRange()
47005
+ };
47006
+ j.e.on(j.ew, 'mousemove', this.__onDragFromRow);
47007
+ new Set([
47008
+ j.ew,
47009
+ j.ow
47010
+ ]).forEach((win)=>j.e.on(win, 'mouseup', this.__onReleaseFromRow));
47011
+ }
47012
+ /**
47013
+ * A drag from beside a row selects from the end of the row to the mouse,
47014
+ * and back beside the row it's the caret again
47015
+ */ __onDragFromRow(e) {
47016
+ var _this___rowBeside;
47017
+ const { s } = this.j;
47018
+ const press = this.__pressBesideRow;
47019
+ if (!press || !(e.buttons & 1)) {
47020
+ this.__endPressBesideRow();
47021
+ return;
47022
+ }
47023
+ if (((_this___rowBeside = this.__rowBeside(e)) === null || _this___rowBeside === void 0 ? void 0 : _this___rowBeside.row) === press.row) {
47024
+ if (!s.isCollapsed()) {
47025
+ s.selectRange(press.caret.cloneRange());
47026
+ }
47027
+ return;
47028
+ }
47029
+ const { cells } = press.row;
47030
+ const last = cells[cells.length - 1];
47031
+ if (s.insertCursorAtPoint(e.clientX, e.clientY)) {
47032
+ var _s_sel;
47033
+ const { startContainer, startOffset } = s.range;
47034
+ (_s_sel = s.sel) === null || _s_sel === void 0 ? void 0 : _s_sel.setBaseAndExtent(last, last.childNodes.length, startContainer, startOffset);
47035
+ }
47036
+ }
47037
+ /**
47038
+ * In iframe mode, a press in an editor without the focus puts the caret at
47039
+ * its end, so a release that selected nothing puts it back
47040
+ */ __onReleaseFromRow() {
47041
+ const press = this.__pressBesideRow;
47042
+ this.__endPressBesideRow();
47043
+ if (press && this.j.s.isCollapsed()) {
47044
+ this.j.s.selectRange(press.caret);
47045
+ }
47046
+ }
47047
+ __endPressBesideRow() {
47048
+ const { j } = this;
47049
+ this.__pressBesideRow = null;
47050
+ j.e.off(j.ew, 'mousemove', this.__onDragFromRow);
47051
+ new Set([
47052
+ j.ew,
47053
+ j.ow
47054
+ ]).forEach((win)=>j.e.off(win, 'mouseup', this.__onReleaseFromRow));
47055
+ }
47056
+ /**
47057
+ * A double click beside a row is two clicks there, so add-new-line,
47058
+ * which adds a line on a double click with a caret, doesn't see it
47059
+ */ __onDblClickBesideRow(e) {
47060
+ if (this.__rowBeside(e)) {
47061
+ this.j.e.stopPropagation('dblclick');
47062
+ return false;
47063
+ }
47064
+ }
47065
+ __putCaretBesideRow(table, row) {
47066
+ const { j } = this;
47067
+ const rows = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(table.rows);
47068
+ const next = rows.slice(rows.indexOf(row) + 1).find((row)=>row.cells.length);
47069
+ let after = table.nextSibling;
47070
+ while(after && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(after)){
47071
+ after = after.nextSibling;
47072
+ }
47073
+ if (next) {
47074
+ j.s.setCursorIn(next.cells[0], true);
47075
+ } else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock(after) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(after, 'table') && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isContentEditable(after, j.editor)) {
47076
+ j.s.setCursorIn(after, true);
47077
+ } else {
47078
+ j.s.setCursorAfter(table);
47079
+ }
47080
+ }
46404
47081
  /**
46405
47082
  * Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
46406
47083
  * a collapsed cursor leaves empty marker elements with the caret inside; a
@@ -46464,7 +47141,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46464
47141
  * Where the last press started. Chrome reports a drag that begins in one
46465
47142
  * element and ends in another as a `click` on their common ancestor, so a
46466
47143
  * press inside a popup is remembered to tell such a drag from a real click.
46467
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null);
47144
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null), /**
47145
+ * The row a press to its right was beside, and the caret it put there,
47146
+ * while the button is down
47147
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressBesideRow", null);
46468
47148
  }
46469
47149
  }
46470
47150
  ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
@@ -46494,6 +47174,18 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46494
47174
  ':click'
46495
47175
  ])
46496
47176
  ], select.prototype, "onClickRightOfNestedListItem", null);
47177
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47178
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':mousedown')
47179
+ ], select.prototype, "onMouseDownBesideTableRow", null);
47180
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47181
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
47182
+ ], select.prototype, "__onDragFromRow", null);
47183
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47184
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
47185
+ ], select.prototype, "__onReleaseFromRow", null);
47186
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47187
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
47188
+ ], select.prototype, "__onDblClickBesideRow", null);
46497
47189
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46498
47190
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
46499
47191
  ':click'