jodit 4.19.6 → 4.19.8

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 (95) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +10 -10
  4. package/es2015/jodit.js +787 -200
  5. package/es2015/jodit.min.js +10 -10
  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 +10 -10
  13. package/es2018/jodit.min.js +10 -10
  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 +12 -12
  18. package/es2021/jodit.js +709 -143
  19. package/es2021/jodit.min.js +12 -12
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +18 -18
  28. package/es2021.en/jodit.js +709 -143
  29. package/es2021.en/jodit.min.js +18 -18
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +947 -208
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/core/constants.d.ts +1 -0
  51. package/esm/core/constants.js +3 -1
  52. package/esm/core/helpers/utils/error/error.d.ts +1 -0
  53. package/esm/core/helpers/utils/error/error.js +4 -1
  54. package/esm/core/helpers/utils/error/errors/answer-error.d.ts +13 -0
  55. package/esm/core/helpers/utils/error/errors/answer-error.js +17 -0
  56. package/esm/core/helpers/utils/error/errors/index.d.ts +1 -0
  57. package/esm/core/helpers/utils/error/errors/index.js +1 -0
  58. package/esm/core/request/ajax.d.ts +1 -0
  59. package/esm/core/request/ajax.js +20 -1
  60. package/esm/core/selection/style/apply-style.js +31 -2
  61. package/esm/jodit.js +14 -2
  62. package/esm/modules/file-browser/data-provider.js +5 -3
  63. package/esm/modules/uploader/config.js +4 -0
  64. package/esm/modules/uploader/helpers/send-files.d.ts +2 -2
  65. package/esm/modules/uploader/helpers/send-files.js +76 -9
  66. package/esm/modules/uploader/helpers/upload-error.d.ts +15 -0
  67. package/esm/modules/uploader/helpers/upload-error.js +16 -0
  68. package/esm/modules/uploader/uploader.js +15 -3
  69. package/esm/plugins/backspace/cases/check-join-neighbors.js +36 -7
  70. package/esm/plugins/backspace/cases/check-remove-empty-parent.js +3 -1
  71. package/esm/plugins/bold/bold.js +4 -1
  72. package/esm/plugins/delete/delete.d.ts +12 -0
  73. package/esm/plugins/delete/delete.js +50 -1
  74. package/esm/plugins/resize-cells/resize-cells.d.ts +25 -1
  75. package/esm/plugins/resize-cells/resize-cells.js +84 -15
  76. package/esm/plugins/select/select.d.ts +35 -0
  77. package/esm/plugins/select/select.js +153 -1
  78. package/esm/plugins/select-cells/select-cells.d.ts +24 -0
  79. package/esm/plugins/select-cells/select-cells.js +81 -18
  80. package/esm/types/style.d.ts +5 -0
  81. package/esm/types/uploader.d.ts +117 -11
  82. package/package.json +2 -2
  83. package/types/core/constants.d.ts +1 -0
  84. package/types/core/helpers/utils/error/error.d.ts +1 -0
  85. package/types/core/helpers/utils/error/errors/answer-error.d.ts +13 -0
  86. package/types/core/helpers/utils/error/errors/index.d.ts +1 -0
  87. package/types/core/request/ajax.d.ts +1 -0
  88. package/types/modules/uploader/helpers/send-files.d.ts +2 -2
  89. package/types/modules/uploader/helpers/upload-error.d.ts +15 -0
  90. package/types/plugins/delete/delete.d.ts +12 -0
  91. package/types/plugins/resize-cells/resize-cells.d.ts +25 -1
  92. package/types/plugins/select/select.d.ts +35 -0
  93. package/types/plugins/select-cells/select-cells.d.ts +24 -0
  94. package/types/types/style.d.ts +5 -0
  95. package/types/types/uploader.d.ts +117 -11
package/es2021/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.19.6
4
+ * Version: v4.19.8
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1824,7 +1824,7 @@ __webpack_require__.r(__webpack_exports__);
1824
1824
  * ```
1825
1825
  * @packageDocumentation
1826
1826
  * @module constants
1827
- */ const APP_VERSION = "4.19.6";
1827
+ */ const APP_VERSION = "4.19.8";
1828
1828
  // prettier-ignore
1829
1829
  const ES = "es2021";
1830
1830
  const IS_ES_MODERN = true;
@@ -1963,6 +1963,8 @@ const EMULATE_DBLCLICK_TIMEOUT = 300;
1963
1963
  * ```
1964
1964
  */ const INSERT_ONLY_TEXT = 'insert_only_text';
1965
1965
  const SAFE_COUNT_CHANGE_CALL = 10;
1966
+ // Connector answer code for a file name that is already taken (same as the HTTP status)
1967
+ const ERROR_CODE_CONFLICT = 409;
1966
1968
  const IS_MAC = typeof globalWindow !== 'undefined' && /Mac|iPod|iPhone|iPad/.test(globalWindow.navigator.platform);
1967
1969
  const KEY_ALIASES = {
1968
1970
  add: '+',
@@ -2046,6 +2048,7 @@ const PASSIVE_EVENTS = new Set([
2046
2048
  /* harmony export */ "CLIPBOARD_ID", 0, /* binding */ CLIPBOARD_ID,
2047
2049
  /* harmony export */ "COMMAND_KEYS", 0, /* binding */ COMMAND_KEYS,
2048
2050
  /* harmony export */ "EMULATE_DBLCLICK_TIMEOUT", 0, /* binding */ EMULATE_DBLCLICK_TIMEOUT,
2051
+ /* harmony export */ "ERROR_CODE_CONFLICT", 0, /* binding */ ERROR_CODE_CONFLICT,
2049
2052
  /* harmony export */ "ES", 0, /* binding */ ES,
2050
2053
  /* harmony export */ "FAT_MODE", 0, /* binding */ FAT_MODE,
2051
2054
  /* harmony export */ "HOMEPAGE", 0, /* binding */ HOMEPAGE,
@@ -8745,6 +8748,7 @@ const dataBind = (elm, key, value)=>{
8745
8748
 
8746
8749
  "use strict";
8747
8750
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8751
+ /* harmony export */ answer: function() { return /* binding */ answer; },
8748
8752
  /* harmony export */ connection: function() { return /* binding */ connection; },
8749
8753
  /* harmony export */ error: function() { return /* binding */ error; },
8750
8754
  /* harmony export */ options: function() { return /* binding */ options; }
@@ -8768,6 +8772,9 @@ function connection(message) {
8768
8772
  function options(message) {
8769
8773
  return new _errors__WEBPACK_IMPORTED_MODULE_0__.OptionsError(message);
8770
8774
  }
8775
+ function answer(message, resp, code) {
8776
+ return new _errors__WEBPACK_IMPORTED_MODULE_0__.AnswerError(message, resp, code);
8777
+ }
8771
8778
 
8772
8779
 
8773
8780
  /***/ }),
@@ -8793,6 +8800,32 @@ function options(message) {
8793
8800
  }
8794
8801
 
8795
8802
 
8803
+ /***/ }),
8804
+
8805
+ /***/ 45052:
8806
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8807
+
8808
+ "use strict";
8809
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8810
+ /* harmony export */ AnswerError: function() { return /* binding */ AnswerError; }
8811
+ /* harmony export */ });
8812
+ /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
8813
+
8814
+ /*!
8815
+ * Jodit Editor (https://xdsoft.net/jodit/)
8816
+ * Released under MIT see LICENSE.txt in the project root for license information.
8817
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
8818
+ */ /**
8819
+ * @module helpers/utils
8820
+ */ // A connector refused the request: the answer and its `data.code` stay reachable for the handler
8821
+ class AnswerError extends Error {
8822
+ constructor(message, answer, code){
8823
+ super(message), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "answer", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "code", void 0), this.answer = answer, this.code = code;
8824
+ Object.setPrototypeOf(this, AnswerError.prototype);
8825
+ }
8826
+ }
8827
+
8828
+
8796
8829
  /***/ }),
8797
8830
 
8798
8831
  /***/ 58250:
@@ -8823,13 +8856,15 @@ function options(message) {
8823
8856
 
8824
8857
  "use strict";
8825
8858
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8826
- /* harmony export */ ConnectionError: function() { return /* reexport safe */ _connection_error__WEBPACK_IMPORTED_MODULE_1__.ConnectionError; },
8827
- /* harmony export */ OptionsError: function() { return /* reexport safe */ _options_error__WEBPACK_IMPORTED_MODULE_2__.OptionsError; },
8859
+ /* harmony export */ AnswerError: function() { return /* reexport safe */ _answer_error__WEBPACK_IMPORTED_MODULE_1__.AnswerError; },
8860
+ /* harmony export */ ConnectionError: function() { return /* reexport safe */ _connection_error__WEBPACK_IMPORTED_MODULE_2__.ConnectionError; },
8861
+ /* harmony export */ OptionsError: function() { return /* reexport safe */ _options_error__WEBPACK_IMPORTED_MODULE_3__.OptionsError; },
8828
8862
  /* harmony export */ abort: function() { return /* reexport safe */ _abort_error__WEBPACK_IMPORTED_MODULE_0__.abort; }
8829
8863
  /* harmony export */ });
8830
8864
  /* harmony import */ var _abort_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14228);
8831
- /* harmony import */ var _connection_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58250);
8832
- /* harmony import */ var _options_error__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11080);
8865
+ /* harmony import */ var _answer_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(45052);
8866
+ /* harmony import */ var _connection_error__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(58250);
8867
+ /* harmony import */ var _options_error__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11080);
8833
8868
  /*!
8834
8869
  * Jodit Editor (https://xdsoft.net/jodit/)
8835
8870
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -8841,6 +8876,7 @@ function options(message) {
8841
8876
 
8842
8877
 
8843
8878
 
8879
+
8844
8880
  /***/ }),
8845
8881
 
8846
8882
  /***/ 11080:
@@ -8871,9 +8907,11 @@ function options(message) {
8871
8907
 
8872
8908
  "use strict";
8873
8909
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8910
+ /* harmony export */ AnswerError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.AnswerError; },
8874
8911
  /* harmony export */ ConnectionError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.ConnectionError; },
8875
8912
  /* harmony export */ OptionsError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.OptionsError; },
8876
8913
  /* harmony export */ abort: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.abort; },
8914
+ /* harmony export */ answer: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.answer; },
8877
8915
  /* harmony export */ connection: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.connection; },
8878
8916
  /* harmony export */ error: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.error; },
8879
8917
  /* harmony export */ options: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.options; }
@@ -9115,6 +9153,7 @@ const isPart = (node, part)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom
9115
9153
  __webpack_require__.r(__webpack_exports__);
9116
9154
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9117
9155
  /* harmony export */ $$: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_27__.$$; },
9156
+ /* harmony export */ AnswerError: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.AnswerError; },
9118
9157
  /* harmony export */ ConfigDeepFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigDeepFlatten; },
9119
9158
  /* harmony export */ ConfigFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigFlatten; },
9120
9159
  /* harmony export */ ConfigMerge: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigMerge; },
@@ -9126,6 +9165,7 @@ __webpack_require__.r(__webpack_exports__);
9126
9165
  /* harmony export */ abort: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.abort; },
9127
9166
  /* harmony export */ alignElement: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.alignElement; },
9128
9167
  /* harmony export */ alreadyLoadedList: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.alreadyLoadedList; },
9168
+ /* harmony export */ answer: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.answer; },
9129
9169
  /* harmony export */ appendScriptAsync: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.appendScriptAsync; },
9130
9170
  /* harmony export */ appendStyleAsync: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.appendStyleAsync; },
9131
9171
  /* harmony export */ attr: function() { return /* reexport safe */ _attr__WEBPACK_IMPORTED_MODULE_3__.attr; },
@@ -10705,6 +10745,23 @@ class Ajax {
10705
10745
  } catch {}
10706
10746
  return this;
10707
10747
  }
10748
+ // A connector answers an error with its JSON envelope and a real HTTP status (403, 409): the body says why, the reason phrase does not
10749
+ __hasAnswerEnvelope() {
10750
+ const { xhr } = this;
10751
+ if (xhr.responseType && xhr.responseType !== 'text') {
10752
+ return false;
10753
+ }
10754
+ const text = xhr.responseText;
10755
+ if (!text || text[0] !== '{') {
10756
+ return false;
10757
+ }
10758
+ try {
10759
+ const answer = JSON.parse(text);
10760
+ return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isPlainObject)(answer) && 'success' in answer;
10761
+ } catch {
10762
+ return false;
10763
+ }
10764
+ }
10708
10765
  send() {
10709
10766
  this.__activated = true;
10710
10767
  const { xhr, o } = this;
@@ -10738,7 +10795,7 @@ class Ajax {
10738
10795
  xhr.onreadystatechange = ()=>{
10739
10796
  this.options.onProgress?.(10);
10740
10797
  if (xhr.readyState === XMLHttpRequest.DONE) {
10741
- if (o.successStatuses.includes(xhr.status)) {
10798
+ if (o.successStatuses.includes(xhr.status) || this.__hasAnswerEnvelope()) {
10742
10799
  onResolve();
10743
10800
  } else if (xhr.statusText) {
10744
10801
  this.__isFulfilled = true;
@@ -13856,9 +13913,11 @@ const WRAP_NODES = new Set([
13856
13913
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13857
13914
  /* harmony export */ ApplyStyle: function() { return /* binding */ ApplyStyle; }
13858
13915
  /* harmony export */ });
13859
- /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51640);
13860
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(98394);
13861
- /* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(78462);
13916
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
13917
+ /* harmony import */ var jodit_core_helpers_utils_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28723);
13918
+ /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(51640);
13919
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(98394);
13920
+ /* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78462);
13862
13921
  /*!
13863
13922
  * Jodit Editor (https://xdsoft.net/jodit/)
13864
13923
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -13868,26 +13927,54 @@ const WRAP_NODES = new Set([
13868
13927
  */
13869
13928
 
13870
13929
 
13930
+
13931
+
13932
+ /**
13933
+ * Take a selected fragment out of the elements its style takes the place
13934
+ * of: one around it is split, so the fragment leaves it, and one in it is
13935
+ * unwrapped
13936
+ */ function takeOutOf(jodit, font, tags) {
13937
+ const range = jodit.s.createRange();
13938
+ let outer = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(font.parentNode, tags, jodit.editor);
13939
+ while(outer){
13940
+ range.selectNodeContents(outer);
13941
+ range.setEndBefore(font);
13942
+ const before = range.cloneContents();
13943
+ range.selectNodeContents(outer);
13944
+ range.setStartAfter(font);
13945
+ // Split only when there's more in it, as a split leaves empty copies
13946
+ // of the elements between
13947
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(before) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(range.cloneContents())) {
13948
+ (0,_api__WEBPACK_IMPORTED_MODULE_2__.extractSelectedPart)(outer, font, jodit);
13949
+ }
13950
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.unwrap(outer);
13951
+ outer = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(font.parentNode, tags, jodit.editor);
13952
+ }
13953
+ ;(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));
13954
+ }
13871
13955
  /** @internal */ function ApplyStyle(jodit, cs) {
13872
13956
  const { s: sel, editor } = jodit;
13873
13957
  editor.firstChild?.normalize(); // FF fix for test "commandsTest - Exec command "bold"
13874
13958
  const fakes = sel.fakes();
13875
13959
  const collapsed = sel.isCollapsed();
13876
- let mode = _constants__WEBPACK_IMPORTED_MODULE_1__.INITIAL;
13960
+ let mode = _constants__WEBPACK_IMPORTED_MODULE_3__.INITIAL;
13877
13961
  try {
13878
13962
  // for...of closes the generator on an exception, releasing every
13879
13963
  // temporary wrapper before the selection is restored in finally.
13880
13964
  for (const font of sel.wrapInTagGen(fakes)){
13965
+ if (cs.options.exclude?.length) {
13966
+ takeOutOf(jodit, font, cs.options.exclude);
13967
+ }
13881
13968
  let state = {
13882
13969
  collapsed,
13883
13970
  mode,
13884
13971
  element: font,
13885
- next: _transactions__WEBPACK_IMPORTED_MODULE_2__.states.START,
13972
+ next: _transactions__WEBPACK_IMPORTED_MODULE_4__.states.START,
13886
13973
  jodit,
13887
13974
  style: cs
13888
13975
  };
13889
- const machine = new _api__WEBPACK_IMPORTED_MODULE_0__.FiniteStateMachine(_transactions__WEBPACK_IMPORTED_MODULE_2__.states.START, _transactions__WEBPACK_IMPORTED_MODULE_2__.transactions);
13890
- while(!jodit.isInDestruct && machine.getState() !== _transactions__WEBPACK_IMPORTED_MODULE_2__.states.END){
13976
+ const machine = new _api__WEBPACK_IMPORTED_MODULE_2__.FiniteStateMachine(_transactions__WEBPACK_IMPORTED_MODULE_4__.states.START, _transactions__WEBPACK_IMPORTED_MODULE_4__.transactions);
13977
+ while(!jodit.isInDestruct && machine.getState() !== _transactions__WEBPACK_IMPORTED_MODULE_4__.states.END){
13891
13978
  state = machine.dispatch('exec', state);
13892
13979
  }
13893
13980
  // The first selected fragment determines how later fragments toggle.
@@ -18356,6 +18443,20 @@ const FOCUS_EVENTS = new Set([
18356
18443
  'focusin',
18357
18444
  'focusout'
18358
18445
  ]);
18446
+ const EDITING_KEYS = new Set([
18447
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_ENTER,
18448
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_BACKSPACE,
18449
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_DELETE
18450
+ ]);
18451
+ /**
18452
+ * Whether the input method (IME) is using the key. Safari fires the keydown
18453
+ * that ends a composition, as the Enter that confirms Japanese text, after
18454
+ * `compositionend`, and types Korean without one, so `isComposing` is false and
18455
+ * only keyCode 229 tells. Only the keys the editor turns into edits are held
18456
+ * back: the handlers that follow typing still see the rest.
18457
+ */ function isInputMethodKey(event) {
18458
+ return event.isComposing || event.keyCode === 229 && EDITING_KEYS.has(event.key);
18459
+ }
18359
18460
  const __defaultStyleDisplayKey = 'data-jodit-default-style-display';
18360
18461
  const __defaultClassesKey = 'data-jodit-default-classes';
18361
18462
  const NOEDIT = {
@@ -19412,7 +19513,7 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_10__.ViewWithToolbar
19412
19513
  }
19413
19514
  }
19414
19515
  const w = this.ew;
19415
- if (event instanceof w.KeyboardEvent && event.isComposing) {
19516
+ if (event instanceof w.KeyboardEvent && isInputMethodKey(event)) {
19416
19517
  return;
19417
19518
  }
19418
19519
  if (this.e && this.e.fire) {
@@ -21545,7 +21646,7 @@ class DataProvider {
21545
21646
  }).catch(()=>null);
21546
21647
  return promise.then((resp)=>resp.json()).then((resp)=>{
21547
21648
  if (resp && !this.isSuccess(resp)) {
21548
- throw new Error(this.getMessage(resp));
21649
+ throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.answer)(this.getMessage(resp), resp, resp.data?.code);
21549
21650
  }
21550
21651
  return resp;
21551
21652
  });
@@ -21680,7 +21781,7 @@ class DataProvider {
21680
21781
  if (this.isSuccess(resp)) {
21681
21782
  return resp.data;
21682
21783
  }
21683
- throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.error)(this.getMessage(resp));
21784
+ throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.answer)(this.getMessage(resp), resp, resp.data?.code);
21684
21785
  });
21685
21786
  }
21686
21787
  /**
@@ -26520,6 +26621,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.uploader = {
26520
26621
  defaultHandlerError (e) {
26521
26622
  this.j.message.error(e.message);
26522
26623
  },
26624
+ promptOnExists: true,
26625
+ promptOnExistsSuggestName (name) {
26626
+ return name;
26627
+ },
26523
26628
  contentType (requestData) {
26524
26629
  return this.ow.FormData !== undefined && typeof requestData !== 'string' ? false : 'application/x-www-form-urlencoded; charset=UTF-8';
26525
26630
  }
@@ -26696,8 +26801,12 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26696
26801
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
26697
26802
  /* harmony export */ sendFiles: function() { return /* binding */ sendFiles; }
26698
26803
  /* harmony export */ });
26699
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(65946);
26700
- /* harmony import */ var jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(77911);
26804
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
26805
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
26806
+ /* harmony import */ var jodit_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80512);
26807
+ /* harmony import */ var jodit_modules_dialog_prompt__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(74103);
26808
+ /* harmony import */ var jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(77911);
26809
+ /* harmony import */ var jodit_modules_uploader_helpers_upload_error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(55083);
26701
26810
  /*!
26702
26811
  * Jodit Editor (https://xdsoft.net/jodit/)
26703
26812
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -26706,24 +26815,46 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26706
26815
  * @module modules/uploader
26707
26816
  */
26708
26817
 
26818
+
26819
+
26820
+
26821
+
26709
26822
  /**
26710
26823
  * Send files to server
26711
- */ function sendFiles(uploader, files, handlerSuccess, handlerError, process) {
26824
+ */ async function sendFiles(uploader, files, handlerSuccess, handlerError, process, // Set when a refused upload is sent again: `beforeUpload` already had its say
26825
+ retryOf) {
26712
26826
  if (!files) {
26713
- return Promise.reject((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Need files'));
26827
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Need files');
26714
26828
  }
26715
26829
  const { o } = uploader;
26716
- let fileList = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.toArray)(files);
26830
+ let fileList = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.toArray)(files);
26717
26831
  if (!fileList.length) {
26718
- return Promise.reject((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Need files'));
26832
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Need files');
26719
26833
  }
26720
- // Client-side validation hook — returning `false` aborts the upload.
26834
+ let extraData = retryOf?.data;
26835
+ // Client-side validation hook — returning `false` aborts the upload, and it may hand back the files to send instead
26721
26836
  // See https://github.com/xdan/jodit/issues/1329
26722
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(o.beforeUpload)) {
26723
- if (o.beforeUpload.call(uploader, fileList) === false) {
26724
- const err = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Upload canceled');
26837
+ if (!retryOf && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(o.beforeUpload)) {
26838
+ let plan;
26839
+ try {
26840
+ plan = await o.beforeUpload.call(uploader, fileList);
26841
+ } catch (e) {
26842
+ (handlerError || o.defaultHandlerError).call(uploader, e);
26843
+ throw e;
26844
+ }
26845
+ if (plan === false) {
26846
+ const err = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Upload canceled');
26725
26847
  (handlerError || o.defaultHandlerError).call(uploader, err);
26726
- return Promise.reject(err);
26848
+ throw err;
26849
+ }
26850
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(plan)) {
26851
+ fileList = plan;
26852
+ } else if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(plan) && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(plan.files)) {
26853
+ fileList = plan.files;
26854
+ extraData = plan.data;
26855
+ }
26856
+ if (!fileList.length) {
26857
+ return [];
26727
26858
  }
26728
26859
  }
26729
26860
  const promises = [];
@@ -26763,20 +26894,35 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26763
26894
  if (process) {
26764
26895
  process(form);
26765
26896
  }
26766
- if (o.data && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isPlainObject)(o.data)) {
26897
+ if (o.data && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(o.data)) {
26767
26898
  Object.keys(o.data).forEach((key)=>{
26768
26899
  form.append(key, o.data[key]);
26769
26900
  });
26770
26901
  }
26902
+ if (extraData) {
26903
+ Object.keys(extraData).forEach((key)=>{
26904
+ form.append(key, extraData[key]);
26905
+ });
26906
+ }
26771
26907
  o.prepareData.call(uploader, form);
26772
- promises.push((0,jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_1__.send)(uploader, form).then((resp)=>{
26908
+ promises.push((0,jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_4__.send)(uploader, form).then((resp)=>{
26773
26909
  if (o.isSuccess.call(uploader, resp)) {
26774
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
26910
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
26775
26911
  handler.call(uploader, o.process.call(uploader, resp));
26776
26912
  return resp;
26777
26913
  }
26778
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
26779
- handler.call(uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)(o.getMessage.call(uploader, resp)));
26914
+ const err = new jodit_modules_uploader_helpers_upload_error__WEBPACK_IMPORTED_MODULE_5__.UploadError(o.getMessage.call(uploader, resp), resp, fileList, (plan)=>sendFiles(uploader, plan?.files ?? fileList, handlerSuccess, handlerError, process, {
26915
+ data: {
26916
+ ...extraData,
26917
+ ...plan?.data
26918
+ }
26919
+ }));
26920
+ // A taken name is part of the upload, not a failure: ask for another one first
26921
+ if (err.code === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.ERROR_CODE_CONFLICT && o.promptOnExists) {
26922
+ return askAnotherName(uploader, err);
26923
+ }
26924
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
26925
+ handler.call(uploader, err);
26780
26926
  return resp;
26781
26927
  }).then(()=>{
26782
26928
  uploader.j.events && uploader.j.e.fire('filesWereUploaded');
@@ -26784,6 +26930,45 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26784
26930
  }
26785
26931
  return Promise.all(promises);
26786
26932
  }
26933
+ function askAnotherName(uploader, err) {
26934
+ const { files } = err;
26935
+ // A batch is refused as a whole (the connector saved nothing) and the answer does not say which name is taken,
26936
+ // so the files go again one by one: the free ones are simply stored, the taken one answers 409 alone and gets its prompt
26937
+ if (files.length > 1) {
26938
+ return files.reduce((chain, file)=>chain.then(()=>err.retry({
26939
+ files: [
26940
+ file
26941
+ ]
26942
+ })), Promise.resolve());
26943
+ }
26944
+ const [file] = files;
26945
+ const { j, o } = uploader;
26946
+ return new Promise((resolve)=>{
26947
+ let answered = false;
26948
+ // `Dlgs.prototype.dlg`: the uploader's view does not always carry the Dlgs trait
26949
+ const dialog = jodit_modules_dialog_prompt__WEBPACK_IMPORTED_MODULE_3__.Prompt.call(jodit_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_2__.Dlgs.prototype.dlg.call(j, {
26950
+ closeOnClickOverlay: true
26951
+ }), j.i18n(err.message), j.i18n('Rename'), (newName)=>{
26952
+ newName = newName.trim();
26953
+ if (!newName) {
26954
+ return false;
26955
+ }
26956
+ answered = true;
26957
+ resolve(err.retry({
26958
+ files: [
26959
+ new File([
26960
+ file
26961
+ ], newName, {
26962
+ type: file.type
26963
+ })
26964
+ ]
26965
+ }));
26966
+ }, j.i18n('Enter new name'), o.promptOnExistsSuggestName.call(uploader, file.name));
26967
+ dialog.e.on(dialog, 'afterClose', ()=>{
26968
+ !answered && resolve(undefined);
26969
+ });
26970
+ });
26971
+ }
26787
26972
  function readImagesWithReader(fileList, imagesExtensions, promises, uploader, handlerSuccess, defaultHandlerSuccess) {
26788
26973
  const readerPromises = [];
26789
26974
  let file, i;
@@ -26812,7 +26997,7 @@ function readImagesWithReader(fileList, imagesExtensions, promises, uploader, ha
26812
26997
  name
26813
26998
  ]
26814
26999
  };
26815
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerSuccess) ? handlerSuccess : defaultHandlerSuccess;
27000
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerSuccess) ? handlerSuccess : defaultHandlerSuccess;
26816
27001
  handler.call(uploader, resp);
26817
27002
  resolve(resp);
26818
27003
  };
@@ -26928,6 +27113,34 @@ function send(uploader, data) {
26928
27113
  /* harmony export */ ]);
26929
27114
 
26930
27115
 
27116
+ /***/ }),
27117
+
27118
+ /***/ 55083:
27119
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
27120
+
27121
+ "use strict";
27122
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
27123
+ /* harmony export */ UploadError: function() { return /* binding */ UploadError; }
27124
+ /* harmony export */ });
27125
+ /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
27126
+ /* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33201);
27127
+ /*!
27128
+ * Jodit Editor (https://xdsoft.net/jodit/)
27129
+ * Released under MIT see LICENSE.txt in the project root for license information.
27130
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
27131
+ */ /**
27132
+ * @module modules/uploader
27133
+ */
27134
+
27135
+ // The connector refused these files: the handler can change the request and send it again
27136
+ class UploadError extends jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__.AnswerError {
27137
+ constructor(message, answer, files, retry){
27138
+ super(message, answer, answer.data?.code), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "files", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "retry", void 0), this.files = files, this.retry = retry;
27139
+ Object.setPrototypeOf(this, UploadError.prototype);
27140
+ }
27141
+ }
27142
+
27143
+
26931
27144
  /***/ }),
26932
27145
 
26933
27146
  /***/ 94925:
@@ -26942,9 +27155,10 @@ function send(uploader, data) {
26942
27155
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
26943
27156
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23211);
26944
27157
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
26945
- /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5266);
26946
- /* harmony import */ var jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(11981);
26947
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(40013);
27158
+ /* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(33201);
27159
+ /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5266);
27160
+ /* harmony import */ var jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11981);
27161
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(40013);
26948
27162
  /*!
26949
27163
  * Jodit Editor (https://xdsoft.net/jodit/)
26950
27164
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -26962,6 +27176,7 @@ function send(uploader, data) {
26962
27176
 
26963
27177
 
26964
27178
 
27179
+
26965
27180
  class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewComponent {
26966
27181
  get j() {
26967
27182
  return this.jodit;
@@ -27017,14 +27232,14 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27017
27232
  }
27018
27233
  };
27019
27234
  // send data on server
27020
- if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(cData)) {
27021
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, cData.files, handlerSuccess, handlerError).finally(onFinally);
27235
+ if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(cData)) {
27236
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, cData.files, handlerSuccess, handlerError).finally(onFinally);
27022
27237
  return false;
27023
27238
  }
27024
27239
  if (jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && !jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_ES_NEXT) {
27025
- return (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.processOldBrowserDrag)(self, cData, handlerSuccess, handlerError, onFinally);
27240
+ return (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.processOldBrowserDrag)(self, cData, handlerSuccess, handlerError, onFinally);
27026
27241
  }
27027
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasItems)(cData)) {
27242
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasItems)(cData)) {
27028
27243
  const { items } = cData;
27029
27244
  for(i = 0; i < items.length; i += 1){
27030
27245
  if (items[i].kind === 'file' && items[i].type === 'image/png') {
@@ -27032,7 +27247,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27032
27247
  if (file) {
27033
27248
  const mime = file.type.match(/\/([a-z0-9]+)/i);
27034
27249
  extension = mime[1] ? mime[1].toLowerCase() : '';
27035
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, [
27250
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, [
27036
27251
  file
27037
27252
  ], handlerSuccess, handlerError, processData).finally(onFinally);
27038
27253
  }
@@ -27054,27 +27269,27 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27054
27269
  self.j.e.on(form, 'dragend dragover dragenter dragleave drop', (e)=>{
27055
27270
  e.preventDefault();
27056
27271
  }).on(form, 'dragover', (event)=>{
27057
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(event.dataTransfer) || (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasItems)(event.dataTransfer)) {
27272
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer) || (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasItems)(event.dataTransfer)) {
27058
27273
  form.classList.add('jodit_drag_hover');
27059
27274
  event.preventDefault();
27060
27275
  }
27061
27276
  }).on(form, 'dragend dragleave', (event)=>{
27062
27277
  form.classList.remove('jodit_drag_hover');
27063
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(event.dataTransfer)) {
27278
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
27064
27279
  event.preventDefault();
27065
27280
  }
27066
27281
  }).on(form, 'drop', (event)=>{
27067
27282
  form.classList.remove('jodit_drag_hover');
27068
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(event.dataTransfer)) {
27283
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
27069
27284
  event.preventDefault();
27070
27285
  event.stopImmediatePropagation();
27071
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, event.dataTransfer.files, handlerSuccess, handlerError).finally(onFinally);
27286
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, event.dataTransfer.files, handlerSuccess, handlerError).finally(onFinally);
27072
27287
  }
27073
27288
  });
27074
27289
  const inputFile = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.first(form, (node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(node, 'input') && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.attr)(node, 'type')?.toLowerCase() === 'file');
27075
27290
  if (inputFile) {
27076
27291
  self.j.e.on(inputFile, 'change', ()=>{
27077
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, inputFile.files, handlerSuccess, handlerError).then(()=>{
27292
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, inputFile.files, handlerSuccess, handlerError).then(()=>{
27078
27293
  inputFile.value = '';
27079
27294
  if (!/safari/i.test(navigator.userAgent)) {
27080
27295
  inputFile.type = '';
@@ -27089,7 +27304,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27089
27304
  */ uploadRemoteImage(url, handlerSuccess, handlerError) {
27090
27305
  const uploader = this, { o } = uploader;
27091
27306
  const handlerE = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
27092
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.send)(uploader, {
27307
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.send)(uploader, {
27093
27308
  action: 'fileUploadRemote',
27094
27309
  url
27095
27310
  }).then((resp)=>{
@@ -27098,17 +27313,31 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27098
27313
  handler.call(uploader, o.process.call(uploader, resp));
27099
27314
  return;
27100
27315
  }
27101
- handlerE.call(uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.error)(o.getMessage.call(uploader, resp)));
27316
+ handlerE.call(uploader, (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__.answer)(o.getMessage.call(uploader, resp), resp, resp.data?.code));
27102
27317
  }).catch((e)=>handlerE.call(uploader, e));
27103
27318
  }
27104
27319
  upload(files) {
27105
27320
  return this.async.promise((resolve, reject)=>{
27106
- ;(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(this, files, resolve, reject);
27321
+ let settled = false;
27322
+ const settle = (end)=>(value)=>{
27323
+ settled = true;
27324
+ end(value);
27325
+ };
27326
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(this, files, settle(resolve), settle(reject)).then(()=>{
27327
+ // `beforeUpload` kept no file, so no handler ran
27328
+ if (!settled) {
27329
+ resolve({
27330
+ baseurl: '',
27331
+ files: [],
27332
+ isImages: []
27333
+ });
27334
+ }
27335
+ }, settle(reject));
27107
27336
  });
27108
27337
  }
27109
27338
  destruct() {
27110
27339
  this.setStatus(jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.STATUSES.beforeDestruct);
27111
- const instances = jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.ajaxInstances.get(this);
27340
+ const instances = jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.ajaxInstances.get(this);
27112
27341
  if (instances) {
27113
27342
  instances.forEach((ajax)=>{
27114
27343
  try {
@@ -27121,7 +27350,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27121
27350
  }
27122
27351
  constructor(editor, options){
27123
27352
  super(editor), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "path", ''), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "source", 'default'), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "options", void 0);
27124
- this.options = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.ConfigProto)(options || {}, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.ConfigProto)(jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.defaultOptions.uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isJoditObject)(editor) ? editor.o.uploader : {}));
27353
+ this.options = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.ConfigProto)(options || {}, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.ConfigProto)(jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.defaultOptions.uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isJoditObject)(editor) ? editor.o.uploader : {}));
27125
27354
  }
27126
27355
  }
27127
27356
 
@@ -28660,6 +28889,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28660
28889
  if (checkJoinBareText(jodit, fakeNode, backspace)) {
28661
28890
  return true;
28662
28891
  }
28892
+ // Old content can have an inline element round blocks beside the text:
28893
+ // moved inside them, the line joins the block as it would bare text
28894
+ // (#1781)
28895
+ const inline = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
28896
+ if (joinsBareText(jodit, edgeBlock(inline, backspace)) && moveInlineInside(inline, jodit.editor)) {
28897
+ return joinNeighbors(jodit, fakeNode, backspace, moved);
28898
+ }
28663
28899
  let nextBox = fakeNode, mainClosestBox = nextBox;
28664
28900
  // Find the main big closest element
28665
28901
  while(nextBox && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(nextBox, backspace) && nextBox.parentElement !== jodit.editor){
@@ -28940,7 +29176,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28940
29176
  * in `<div>a|<p>b</p>c</div>` gives `<div>a|b<br>c</div>`
28941
29177
  */ function checkJoinBareText(jodit, fakeNode, backspace) {
28942
29178
  const block = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
28943
- 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))) {
29179
+ if (!joinsBareText(jodit, block)) {
28944
29180
  return false;
28945
29181
  }
28946
29182
  const filter = (0,jodit_plugins_backspace_helpers__WEBPACK_IMPORTED_MODULE_2__.getMoveFilter)(jodit);
@@ -28967,6 +29203,23 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28967
29203
  jodit.s.setCursorBefore(fakeNode);
28968
29204
  return true;
28969
29205
  }
29206
+ /**
29207
+ * Whether a block joins the bare text beside it: not a list, a table or a
29208
+ * cell, and holding no block of its own
29209
+ */ function joinsBareText(jodit, block) {
29210
+ 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));
29211
+ }
29212
+ /**
29213
+ * The block an inline element holds on its side facing the caret, through
29214
+ * the inline elements in it: the `<p>` of `<span><strong><p>…</p></strong></span>`
29215
+ */ function edgeBlock(node, backspace) {
29216
+ let edge = node;
29217
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(edge) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(edge)){
29218
+ const children = Array.from(edge.childNodes).filter((child)=>!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child));
29219
+ edge = (backspace ? children[children.length - 1] : children[0]) ?? null;
29220
+ }
29221
+ return edge === node ? null : edge;
29222
+ }
28970
29223
  function checkMoveListContent(jodit, mainClosestBox, sibling, backspace) {
28971
29224
  // Process UL/LI/OL cases
28972
29225
  const siblingIsList = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.LIST_TAGS);
@@ -29416,7 +29669,6 @@ function isNotEditable(jodit, node) {
29416
29669
  if (!prn || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn)) {
29417
29670
  return false;
29418
29671
  }
29419
- const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
29420
29672
  do {
29421
29673
  if (prn && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(prn)) {
29422
29674
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(prn, fakeNode);
@@ -29431,6 +29683,9 @@ function isNotEditable(jodit, node) {
29431
29683
  if (found && (0,_check_join_two_lists__WEBPACK_IMPORTED_MODULE_2__.checkJoinTwoLists)(jodit, fakeNode, backspace)) {
29432
29684
  return true;
29433
29685
  }
29686
+ // Looked for once the empty elements have gone, as the one beside the
29687
+ // caret can be in them: the `<br>` that Delete in `<p>|<br></p>` leaves
29688
+ const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
29434
29689
  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)) {
29435
29690
  setCursorIn(neighbor, !backspace);
29436
29691
  } else {
@@ -29896,8 +30151,15 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.delete = {
29896
30151
  }
29897
30152
  cssRules[key] = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(cssOptions[key]) ? cssOptions[key][0] : cssOptions[key];
29898
30153
  });
30154
+ const element = control.tags ? control.tags[0] : undefined;
29899
30155
  editor.s.commitStyle({
29900
- element: control.tags ? control.tags[0] : undefined
30156
+ element,
30157
+ // As in the browsers and Word, each takes the other's place
30158
+ exclude: element === 'sub' ? [
30159
+ 'sup'
30160
+ ] : element === 'sup' ? [
30161
+ 'sub'
30162
+ ] : []
29901
30163
  });
29902
30164
  editor.synchronizeValues();
29903
30165
  return false;
@@ -32462,11 +32724,12 @@ __webpack_require__.r(__webpack_exports__);
32462
32724
  "use strict";
32463
32725
  /* unused harmony export deleteCommand */
32464
32726
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
32465
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27795);
32466
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28077);
32467
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65946);
32468
- /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4040);
32469
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(91206);
32727
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
32728
+ /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27795);
32729
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28077);
32730
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
32731
+ /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4040);
32732
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
32470
32733
  /*!
32471
32734
  * Jodit Editor (https://xdsoft.net/jodit/)
32472
32735
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -32482,6 +32745,7 @@ __webpack_require__.r(__webpack_exports__);
32482
32745
 
32483
32746
 
32484
32747
 
32748
+
32485
32749
  const NOT_EMPTY_CONTENT_TAGS = new Set([
32486
32750
  'img',
32487
32751
  'table',
@@ -32489,7 +32753,18 @@ const NOT_EMPTY_CONTENT_TAGS = new Set([
32489
32753
  'iframe',
32490
32754
  'hr'
32491
32755
  ]);
32492
- class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
32756
+ const KEEPS_SPACES = new Set([
32757
+ 'pre',
32758
+ 'pre-wrap',
32759
+ 'break-spaces'
32760
+ ]);
32761
+ /**
32762
+ * A plain space beside this neighbor isn't shown: there is none, or it's a
32763
+ * line break, a block or text starting (or ending) with a plain space
32764
+ */ function hidesSpace(neighbor, edge) {
32765
+ 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 ?? '');
32766
+ }
32767
+ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
32493
32768
  afterInit(jodit) {
32494
32769
  jodit.e.on('afterCommand.delete', (command)=>{
32495
32770
  if (command === 'delete') {
@@ -32510,11 +32785,11 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32510
32785
  */ __afterDeleteCommand() {
32511
32786
  const jodit = this.j;
32512
32787
  const current = jodit.s.current();
32513
- if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(current.firstChild, 'br')) {
32788
+ if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(current.firstChild, 'br')) {
32514
32789
  jodit.s.removeNode(current.firstChild);
32515
32790
  }
32516
- 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))) {
32517
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.detach(jodit.editor);
32791
+ 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))) {
32792
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.detach(jodit.editor);
32518
32793
  const node = jodit.s.setCursorIn(jodit.editor);
32519
32794
  jodit.s.removeNode(node);
32520
32795
  }
@@ -32534,14 +32809,15 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32534
32809
  range.deleteContents();
32535
32810
  const fake = jodit.createInside.fake();
32536
32811
  range.insertNode(fake);
32537
- const leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(fake, true);
32538
- const rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(fake, false);
32812
+ const leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.findSibling(fake, true);
32813
+ const rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.findSibling(fake, false);
32539
32814
  this.__moveContentInLeftSibling(fake, leftSibling, rightSibling);
32815
+ this.__keepSpacesVisible(fake);
32540
32816
  range.setStartBefore(fake);
32541
32817
  range.collapse(true);
32542
32818
  this.__moveCursorInEditableSibling(jodit, leftSibling, fake, range);
32543
32819
  this.__addBrInEmptyBlock(fake, range);
32544
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(fake);
32820
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
32545
32821
  jodit.s.selectRange(caret ?? range);
32546
32822
  return false;
32547
32823
  }
@@ -32555,23 +32831,23 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32555
32831
  * Returns where the caret goes, or null when no table is involved
32556
32832
  */ __clearSelectedCells(range) {
32557
32833
  const { editor, createInside } = this.j;
32558
- const startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell, editor);
32559
- const endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell, editor);
32834
+ const startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell, editor);
32835
+ const endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell, editor);
32560
32836
  if (startCell === endCell) {
32561
32837
  return null;
32562
32838
  }
32563
- const startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(startCell, 'table', editor);
32564
- const endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(endCell, 'table', editor);
32839
+ const startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(startCell, 'table', editor);
32840
+ const endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(endCell, 'table', editor);
32565
32841
  const caret = range.cloneRange();
32566
32842
  caret.collapse(true);
32567
32843
  const parts = [];
32568
32844
  const addParts = (table)=>{
32569
- (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)=>{
32845
+ (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)=>{
32570
32846
  const part = range.cloneRange();
32571
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(cell, range.startContainer)) {
32847
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.startContainer)) {
32572
32848
  part.setStart(cell, 0);
32573
32849
  }
32574
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(cell, range.endContainer)) {
32850
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.endContainer)) {
32575
32851
  part.setEnd(cell, cell.childNodes.length);
32576
32852
  }
32577
32853
  parts.push([
@@ -32594,9 +32870,9 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32594
32870
  }
32595
32871
  parts.forEach(([cell, part])=>{
32596
32872
  part.deleteContents();
32597
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(cell)) {
32598
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.detach(cell);
32599
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(cell, createInside.element('br'));
32873
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(cell)) {
32874
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.detach(cell);
32875
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(cell, createInside.element('br'));
32600
32876
  }
32601
32877
  });
32602
32878
  return startTable ? caret : null;
@@ -32604,46 +32880,72 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32604
32880
  __moveContentInLeftSibling(fake, leftSibling, rightSibling) {
32605
32881
  leftSibling = this.__defineRightLeftBox(leftSibling);
32606
32882
  // Nothing is moved into a table, and a block left empty after it goes
32607
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(leftSibling, 'table')) {
32608
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(rightSibling)) {
32609
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32883
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(leftSibling, 'table')) {
32884
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
32885
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32610
32886
  }
32611
32887
  return;
32612
32888
  }
32613
- 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)) {
32614
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, fake);
32615
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.moveContent(rightSibling, leftSibling);
32616
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32889
+ 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)) {
32890
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, fake);
32891
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.moveContent(rightSibling, leftSibling);
32892
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32617
32893
  }
32618
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(rightSibling.firstElementChild)) {
32894
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(rightSibling.firstElementChild)) {
32619
32895
  const item = rightSibling.firstElementChild;
32620
32896
  // What's left of the right list's first item joins the left block,
32621
32897
  // up to a list nested in the item
32622
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(leftSibling)) {
32623
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, fake);
32624
- while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(item.firstChild)){
32625
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, item.firstChild);
32898
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(leftSibling)) {
32899
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, fake);
32900
+ while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(item.firstChild)){
32901
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, item.firstChild);
32626
32902
  }
32627
32903
  }
32628
32904
  // Remove empty right LI
32629
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(item)) {
32630
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(item);
32905
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item)) {
32906
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(item);
32631
32907
  }
32632
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(rightSibling)) {
32633
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32908
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
32909
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32634
32910
  }
32635
32911
  }
32636
32912
  }
32913
+ /**
32914
+ * A plain space the deletion leaves at an edge of the block, before a line
32915
+ * break or next to another space isn't shown, and the browser drops it when
32916
+ * the next char is typed. It becomes non-breaking, as in the browsers' own
32917
+ * delete and in Backspace without a selection (#1522)
32918
+ */ __keepSpacesVisible(fake) {
32919
+ const { jodit } = this;
32920
+ const block = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor) ?? jodit.editor;
32921
+ if (KEEPS_SPACES.has(jodit.ew.getComputedStyle(block).whiteSpace)) {
32922
+ return;
32923
+ }
32924
+ const before = this.__findNeighbor(fake, true, block);
32925
+ const after = this.__findNeighbor(fake, false, block);
32926
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(before) && hidesSpace(after, /^ /)) {
32927
+ before.nodeValue = before.nodeValue.replace(/ +$/, (spaces)=>jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.NBSP_SPACE.repeat(spaces.length));
32928
+ }
32929
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(after) && hidesSpace(before, / $/)) {
32930
+ after.nodeValue = after.nodeValue.replace(/^ +/, (spaces)=>jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.NBSP_SPACE.repeat(spaces.length));
32931
+ }
32932
+ }
32933
+ /**
32934
+ * The text, line break or other element next to the caret in its block,
32935
+ * looking inside inline elements
32936
+ */ __findNeighbor(fake, left, block) {
32937
+ return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.call)(left ? jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.prev : jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.next, fake, (node)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(node) ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.trimInv)(node.nodeValue ?? '').length > 0 : !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isComment(node) && !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isInlineBlock(node) && node.firstChild), block);
32938
+ }
32637
32939
  /**
32638
32940
  * If left sibling is list - return last leaf
32639
32941
  */ __defineRightLeftBox(leftSibling) {
32640
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(leftSibling)) {
32942
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(leftSibling)) {
32641
32943
  return leftSibling;
32642
32944
  }
32643
32945
  let lastLeaf = leftSibling.lastElementChild;
32644
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(lastLeaf)) {
32946
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(lastLeaf)) {
32645
32947
  lastLeaf = this.j.createInside.element('li');
32646
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, lastLeaf);
32948
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, lastLeaf);
32647
32949
  }
32648
32950
  return lastLeaf;
32649
32951
  }
@@ -32651,21 +32953,21 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32651
32953
  * Add BR in the empty block left at the caret
32652
32954
  */ __addBrInEmptyBlock(fake, range) {
32653
32955
  const jodit = this.j;
32654
- if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
32956
+ if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
32655
32957
  const br = jodit.createInside.element('br');
32656
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(fake, br);
32958
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.after(fake, br);
32657
32959
  range.setStartBefore(br);
32658
32960
  range.collapse(true);
32659
32961
  }
32660
32962
  }
32661
32963
  __moveCursorInEditableSibling(jodit, leftSibling, fake, range) {
32662
- if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText(leftSibling)) {
32663
- const root = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock, jodit.editor) ?? jodit.editor;
32664
- const leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText, root);
32964
+ if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(leftSibling)) {
32965
+ const root = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor) ?? jodit.editor;
32966
+ const leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText, root);
32665
32967
  if (leftText) {
32666
32968
  range.setStartAfter(leftText);
32667
32969
  range.collapse(true);
32668
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(fake);
32970
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
32669
32971
  }
32670
32972
  }
32671
32973
  }
@@ -32673,7 +32975,7 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32673
32975
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(deleteCommand, "requires", [
32674
32976
  'backspace'
32675
32977
  ]);
32676
- jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('deleteCommand', deleteCommand);
32978
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('deleteCommand', deleteCommand);
32677
32979
 
32678
32980
 
32679
32981
  /***/ }),
@@ -43572,7 +43874,7 @@ const key = 'table_processor_observer-resize';
43572
43874
  /**
43573
43875
  * Click on resize handle
43574
43876
  */ onHandleMouseDown(event) {
43575
- if (this.j.isLocked) {
43877
+ if (this.j.isLocked || this.j.o.readonly) {
43576
43878
  return;
43577
43879
  }
43578
43880
  this.drag = true;
@@ -43607,10 +43909,15 @@ const key = 'table_processor_observer-resize';
43607
43909
  let box;
43608
43910
  this.minX = 0;
43609
43911
  this.maxX = 1000000;
43912
+ this.startTableWidth = this.workTable.offsetWidth;
43610
43913
  if (this.wholeTable != null) {
43611
- const tableBox = this.workTable.parentNode.getBoundingClientRect();
43914
+ const parent = this.workTable.parentNode;
43915
+ const tableBox = parent.getBoundingClientRect();
43612
43916
  this.minX = tableBox.left;
43613
43917
  this.maxX = this.minX + tableBox.width;
43918
+ const side = this.isRTL ? 'marginRight' : 'marginLeft';
43919
+ this.startParentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getContentWidth)(parent, this.j.ew);
43920
+ this.startMargin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
43614
43921
  } else {
43615
43922
  // find maximum columns
43616
43923
  const coordinate = this.module.formalCoordinate(this.workTable, this.workCell, true);
@@ -43624,6 +43931,17 @@ const key = 'table_processor_observer-resize';
43624
43931
  this.maxX = Math.min(box.left + box.width - jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.NEARBY / 2, this.maxX);
43625
43932
  }
43626
43933
  });
43934
+ const matrix = this.module.formalMatrix(this.workTable);
43935
+ this.startWidths = this.resizedColumns().map((column)=>{
43936
+ const cells = matrix.map((row)=>row[column]);
43937
+ const index = cells.findIndex((td)=>td.colSpan === 1 || cells.length === 1);
43938
+ const cell = cells[index];
43939
+ return [
43940
+ cell,
43941
+ cell ? cell.offsetWidth : 0,
43942
+ cells.slice(Math.max(index, 0) + 1)
43943
+ ];
43944
+ });
43627
43945
  }
43628
43946
  return false;
43629
43947
  }
@@ -43651,8 +43969,11 @@ const key = 'table_processor_observer-resize';
43651
43969
  x = this.maxX;
43652
43970
  }
43653
43971
  this.resizeDelta = x - this.startX + (!this.j.o.iframe ? 0 : workplacePosition.left);
43654
- this.restoreStyles();
43655
- this.resizeColumnsOrTable();
43972
+ if (this.wholeTable == null) {
43973
+ this.setColumnWidths();
43974
+ } else {
43975
+ this.resizeTable();
43976
+ }
43656
43977
  const tableBox = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.offset)(this.workTable, this.j, this.j.ed);
43657
43978
  Object.assign(this.resizeHandler.style, {
43658
43979
  left: this.startLeft + this.columnEdge() - this.startEdge + 'px',
@@ -43765,21 +44086,49 @@ const key = 'table_processor_observer-resize';
43765
44086
  };
43766
44087
  this.scrollFrame = this.j.async.requestAnimationFrame(scroll);
43767
44088
  }
44089
+ /**
44090
+ * The two columns a column drag resizes: the work cell's last, and the
44091
+ * next cell's first
44092
+ */ resizedColumns() {
44093
+ 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);
44094
+ return [
44095
+ this.module.formalCoordinate(this.workTable, this.workCell, true)[1],
44096
+ this.module.formalCoordinate(this.workTable, nextTD)[1]
44097
+ ];
44098
+ }
43768
44099
  /**
43769
44100
  * Resize only one column
43770
44101
  */ resizeColumns() {
43771
44102
  const delta = this.resizeDelta;
43772
44103
  const marked = [];
43773
44104
  const tableModule = this.module;
43774
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, this.workCell, true)[1], delta, true, marked);
43775
- 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);
43776
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, nextTD)[1], -delta, false, marked);
44105
+ const [column, nextColumn] = this.resizedColumns();
44106
+ tableModule.setColumnWidthByDelta(this.workTable, column, delta, true, marked);
44107
+ tableModule.setColumnWidthByDelta(this.workTable, nextColumn, -delta, false, marked);
44108
+ }
44109
+ /**
44110
+ * Sets the widths `resizeColumns` would while the handle is dragged, from
44111
+ * the widths the drag started with, so that a move doesn't put back every
44112
+ * cell's style and lay the table out again to measure them
44113
+ */ setColumnWidths() {
44114
+ this.startWidths.forEach(([cell, width, below], index)=>{
44115
+ const delta = index ? -this.resizeDelta : this.resizeDelta;
44116
+ if (cell) {
44117
+ (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) + '%');
44118
+ }
44119
+ below.forEach((td)=>{
44120
+ td.style.removeProperty('width');
44121
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(td, 'style')) {
44122
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(td, 'style', null);
44123
+ }
44124
+ });
44125
+ });
43777
44126
  }
43778
44127
  /**
43779
44128
  * Resize whole table
43780
44129
  */ resizeTable() {
43781
44130
  const delta = this.resizeDelta * (this.isRTL ? -1 : 1);
43782
- const width = this.workTable.offsetWidth, parentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getContentWidth)(this.workTable.parentNode, this.j.ew);
44131
+ const width = this.startTableWidth, parentWidth = this.startParentWidth;
43783
44132
  // for RTL use mirror logic
43784
44133
  const rightSide = !this.wholeTable;
43785
44134
  const needChangeWidth = this.isRTL ? !rightSide : rightSide;
@@ -43788,10 +44137,9 @@ const key = 'table_processor_observer-resize';
43788
44137
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, 'width', (width + delta) / parentWidth * 100 + '%');
43789
44138
  } else {
43790
44139
  const side = this.isRTL ? 'marginRight' : 'marginLeft';
43791
- const margin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
43792
44140
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, {
43793
44141
  width: (width - delta) / parentWidth * 100 + '%',
43794
- [side]: (margin + delta) / parentWidth * 100 + '%'
44142
+ [side]: (this.startMargin + delta) / parentWidth * 100 + '%'
43795
44143
  });
43796
44144
  }
43797
44145
  }
@@ -43867,9 +44215,10 @@ const key = 'table_processor_observer-resize';
43867
44215
  if (!editor.o.tableAllowCellResize) {
43868
44216
  return;
43869
44217
  }
43870
- editor.e.off(this.j.ow, '.resize-cells').off('.resize-cells').on('change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells', ()=>{
44218
+ const observeTables = ()=>{
43871
44219
  ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', editor.editor).forEach(this.observe);
43872
- }).on(this.j.ow, 'scroll.resize-cells', ()=>{
44220
+ };
44221
+ 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', ()=>{
43873
44222
  if (!this.drag || this.workRow) {
43874
44223
  return;
43875
44224
  }
@@ -43885,6 +44234,8 @@ const key = 'table_processor_observer-resize';
43885
44234
  tableModule.normalizeTable(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(td, 'table', editor.editor));
43886
44235
  });
43887
44236
  });
44237
+ // None of those events comes with the editor's starting value
44238
+ observeTables();
43888
44239
  }
43889
44240
  /**
43890
44241
  * Add to every Table listeners
@@ -43898,7 +44249,9 @@ const key = 'table_processor_observer-resize';
43898
44249
  this.hideResizeHandle();
43899
44250
  }
43900
44251
  }).on(table, 'mousemove.resize-cells touchmove.resize-cells', this.j.async.throttle((event)=>{
43901
- if (this.j.isLocked) {
44252
+ // A drag from a cell isn't a resize, and the handle on
44253
+ // a border it passes would take its moves (#1778)
44254
+ if (this.j.isLocked || this.j.o.readonly || event.buttons) {
43902
44255
  return;
43903
44256
  }
43904
44257
  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);
@@ -43931,8 +44284,15 @@ const key = 'table_processor_observer-resize';
43931
44284
  }
43932
44285
  }), (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), /**
43933
44286
  * The table's and its cells' styles as a column drag started, put back
43934
- * before each new width
44287
+ * as it ends, before the final widths
43935
44288
  */ (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), /**
44289
+ * For each of the two columns a drag resizes, the cell whose width
44290
+ * `setColumnWidthByDelta` sets, with its width as the drag started, and
44291
+ * the cells below it, whose widths it clears
44292
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startWidths", []), /**
44293
+ * The table's width as the drag started, and for a drag of its edge, the
44294
+ * width inside what holds it and its margin on that side
44295
+ */ (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), /**
43936
44296
  * The row whose height the handle sets, or null while it sets a width
43937
44297
  */ (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), /**
43938
44298
  * The boxes that scroll the row, with their styles, as a row drag turns
@@ -45682,7 +46042,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.tableAllowCellSelecti
45682
46042
 
45683
46043
 
45684
46044
  const key = 'table_processor_observer';
45685
- const MOUSE_MOVE_LABEL = 'onMoveTableSelectCell';
45686
46045
  class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
45687
46046
  /**
45688
46047
  * Shortcut for Jodit.modules.Table
@@ -45697,6 +46056,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45697
46056
  // move the caret, as table-keyboard-navigation's do
45698
46057
  .on('keydown', this.__onKeyDown, {
45699
46058
  top: true
46059
+ }).on('clickEditor', this.__onClickAfterDrag, {
46060
+ top: true
45700
46061
  }).on('keydown.select-cells', (event)=>{
45701
46062
  if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB) {
45702
46063
  this.unselectCells();
@@ -45814,18 +46175,35 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45814
46175
  }
45815
46176
  this.__isSelectionMode = true;
45816
46177
  this.__selectedCell = cell;
46178
+ this.__movedTo = cell;
45817
46179
  this.__tableModule.addSelection(cell);
45818
- this.j.e.on(table, 'mousemove.select-cells touchmove.select-cells', // Don't use decorator because need clear label on mouseup
45819
- this.j.async.throttle(this.__onMove.bind(this, table), {
45820
- label: MOUSE_MOVE_LABEL,
45821
- timeout: this.j.defaultTimeout / 2
45822
- })).on(table, 'mouseup.select-cells touchend.select-cells', this.__onStopSelection.bind(this, table));
46180
+ 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));
46181
+ new Set([
46182
+ this.j.ew,
46183
+ this.j.ow
46184
+ ]).forEach((win)=>this.j.e.on(win, 'mouseup.select-cells touchend.select-cells', this.__onRelease.bind(this, table)));
45823
46185
  return false;
45824
46186
  }
45825
46187
  onOutsideClick() {
45826
46188
  this.__selectedCell = null;
45827
46189
  this.__onRemoveSelection();
45828
46190
  }
46191
+ onMouseDown() {
46192
+ this.__keepMarks = false;
46193
+ }
46194
+ /**
46195
+ * The click that ends a drag let go outside the table, and inside the
46196
+ * editor, lands on the editor. Taken on, it would unmark the cells and
46197
+ * close their popup. As for the click on a row after a drag over the
46198
+ * cells, the browser's own selection from the drag goes
46199
+ */ __onClickAfterDrag() {
46200
+ if (this.__keepMarks) {
46201
+ this.__keepMarks = false;
46202
+ this.j.s.sel?.removeAllRanges();
46203
+ this.j.e.stopPropagation('clickEditor');
46204
+ return false;
46205
+ }
46206
+ }
45829
46207
  onChange() {
45830
46208
  if (!this.j.isLocked && !this.__isSelectionMode) {
45831
46209
  this.__onRemoveSelection();
@@ -45843,16 +46221,20 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45843
46221
  // Inside Shadow DOM `document.elementFromPoint` returns the shadow
45844
46222
  // host, so the lookup must start from the shadow root
45845
46223
  const node = (this.j.o.shadowRoot ?? this.j.ed).elementFromPoint(e.clientX, e.clientY);
45846
- if (!node) {
45847
- return;
45848
- }
45849
- const cell = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
46224
+ const cell = node && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
45850
46225
  'td',
45851
46226
  'th'
45852
46227
  ], table);
45853
46228
  if (!cell || !this.__selectedCell) {
45854
46229
  return;
45855
46230
  }
46231
+ // The marks change only when the mouse goes into another cell, and then
46232
+ // at once rather than throttled, as the browser's own selection from
46233
+ // the drag shows in the cells between until they do (#1778)
46234
+ if (cell === this.__movedTo) {
46235
+ return;
46236
+ }
46237
+ this.__movedTo = cell;
45856
46238
  if (cell !== this.__selectedCell) {
45857
46239
  this.j.lock(key);
45858
46240
  }
@@ -45910,10 +46292,32 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45910
46292
  if (ownTable && ownTable !== table) {
45911
46293
  return; // Nested tables
45912
46294
  }
45913
- const bound = this.__tableModule.getSelectedBound(table, [
46295
+ this.__showCellsPopup(table, [
45914
46296
  cell,
45915
46297
  this.__selectedCell
45916
- ]), box = this.__tableModule.formalMatrix(table);
46298
+ ]);
46299
+ this.__stopListening();
46300
+ }
46301
+ /**
46302
+ * A drag let go outside the table doesn't reach the table's `mouseup`, so
46303
+ * the window's ends it, leaving the cells marked as they were (#1774)
46304
+ */ __onRelease(table, e) {
46305
+ if (this.__isSelectionMode) {
46306
+ this.__isSelectionMode = false;
46307
+ if (!this.j.isLockedNotBy(key)) {
46308
+ this.j.unlock();
46309
+ }
46310
+ const cells = this.__tableModule.getAllSelectedCells();
46311
+ // One let go outside the editor clicks outside it, which unmarks them
46312
+ if (cells.length > 1 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.j.editor, e.target)) {
46313
+ this.__keepMarks = true;
46314
+ this.__showCellsPopup(table, cells);
46315
+ }
46316
+ }
46317
+ this.__stopListening();
46318
+ }
46319
+ __showCellsPopup(table, cells) {
46320
+ const bound = this.__tableModule.getSelectedBound(table, cells), box = this.__tableModule.formalMatrix(table);
45917
46321
  const max = box[bound[1][0]]?.[bound[1][1]], min = box[bound[0][0]]?.[bound[0][1]];
45918
46322
  // `getSelectedBound` keeps its `Infinity` sentinel when none of the
45919
46323
  // selected cells belong to this table's matrix — e.g. after a
@@ -45933,10 +46337,16 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45933
46337
  height: maxOffset.top - minOffset.top + maxOffset.height
45934
46338
  };
45935
46339
  }, 'cells');
45936
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', this.j.editor).forEach((table)=>{
46340
+ }
46341
+ __stopListening() {
46342
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', this.j.editor).forEach((table)=>{
45937
46343
  this.j.e.off(table, 'mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells');
45938
46344
  });
45939
- this.j.async.clearTimeout(MOUSE_MOVE_LABEL);
46345
+ new Set([
46346
+ this.j.ew,
46347
+ this.j.ow
46348
+ ]).forEach((win)=>this.j.e.off(win, 'mouseup.select-cells touchend.select-cells'));
46349
+ this.__movedTo = null;
45940
46350
  }
45941
46351
  /**
45942
46352
  * Remove selection for all cells
@@ -46106,7 +46516,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46106
46516
  }
46107
46517
  /** @override */ beforeDestruct(jodit) {
46108
46518
  this.__onRemoveSelection();
46109
- jodit.e.off('.select-cells').off('keydown', this.__onKeyDown);
46519
+ this.__stopListening();
46520
+ jodit.e.off('.select-cells').off('keydown', this.__onKeyDown).off('clickEditor', this.__onClickAfterDrag);
46110
46521
  }
46111
46522
  constructor(...args){
46112
46523
  super(...args), /**
@@ -46117,7 +46528,12 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46117
46528
  * First selected cell
46118
46529
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__selectedCell", null), /**
46119
46530
  * User is selecting cells now
46120
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isSelectionMode", false);
46531
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isSelectionMode", false), /**
46532
+ * The cell the marks were last drawn to
46533
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__movedTo", null), /**
46534
+ * A drag let go outside the table ends in a click on the editor, which
46535
+ * would unmark its cells
46536
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__keepMarks", false);
46121
46537
  }
46122
46538
  }
46123
46539
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(selectCells, "requires", [
@@ -46135,6 +46551,15 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46135
46551
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46136
46552
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':outsideClick')
46137
46553
  ], selectCells.prototype, "onOutsideClick", null);
46554
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46555
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
46556
+ ':mousedown',
46557
+ ':touchstart'
46558
+ ])
46559
+ ], selectCells.prototype, "onMouseDown", null);
46560
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46561
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
46562
+ ], selectCells.prototype, "__onClickAfterDrag", null);
46138
46563
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46139
46564
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':change')
46140
46565
  ], selectCells.prototype, "onChange", null);
@@ -46186,10 +46611,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46186
46611
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
46187
46612
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
46188
46613
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
46189
- /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(57821);
46190
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
46191
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4099);
46192
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(47670);
46614
+ /* harmony import */ var jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(88475);
46615
+ /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(57821);
46616
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(91206);
46617
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(4099);
46618
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(47670);
46193
46619
  /*!
46194
46620
  * Jodit Editor (https://xdsoft.net/jodit/)
46195
46621
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -46208,6 +46634,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46208
46634
 
46209
46635
 
46210
46636
 
46637
+
46211
46638
  /**
46212
46639
  * A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
46213
46640
  *
@@ -46218,22 +46645,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46218
46645
  * console.log(img.src);
46219
46646
  * })
46220
46647
  * ```
46221
- */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
46648
+ */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__.Plugin {
46222
46649
  afterInit(jodit) {
46223
46650
  this.proxyEventsList.forEach((eventName)=>{
46224
46651
  jodit.e.on(eventName + '.select', this.onStartSelection);
46225
46652
  });
46653
+ jodit.e.on('dblclick', this.__onDblClickBesideRow, {
46654
+ top: true
46655
+ });
46226
46656
  }
46227
46657
  beforeDestruct(jodit) {
46228
46658
  this.proxyEventsList.forEach((eventName)=>{
46229
- jodit.e.on(eventName + '.select', this.onStartSelection);
46659
+ jodit.e.off(eventName + '.select', this.onStartSelection);
46230
46660
  });
46661
+ this.__endPressBesideRow();
46662
+ jodit.e.off('dblclick', this.__onDblClickBesideRow);
46231
46663
  }
46232
46664
  onStartSelection(e) {
46233
46665
  const { j } = this;
46234
46666
  let result, target = e.target;
46235
46667
  while(result === undefined && target && target !== j.editor){
46236
- result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
46668
+ result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_7__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
46237
46669
  target = target.parentElement;
46238
46670
  }
46239
46671
  if (e.type === 'click' && result === undefined && target === j.editor) {
@@ -46253,10 +46685,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46253
46685
  }
46254
46686
  // Selecting the text of a popup input with the mouse and releasing
46255
46687
  // the button past the popup's edge is not a click outside of it.
46256
- if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup)) {
46688
+ if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup)) {
46257
46689
  return;
46258
46690
  }
46259
- const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup);
46691
+ const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup);
46260
46692
  if (!box) {
46261
46693
  this.j.e.fire('outsideClick', e);
46262
46694
  }
@@ -46302,6 +46734,125 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46302
46734
  s.setCursorAfter(text);
46303
46735
  }
46304
46736
  }
46737
+ /**
46738
+ * The table row the mouse is to the right of
46739
+ */ __rowBeside(e) {
46740
+ const { j } = this;
46741
+ const target = e.target;
46742
+ 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)) {
46743
+ return null;
46744
+ }
46745
+ const table = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(target.children).find((elm)=>{
46746
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(elm, 'table')) {
46747
+ return false;
46748
+ }
46749
+ const box = elm.getBoundingClientRect();
46750
+ return e.clientX >= box.right && e.clientY >= box.top && e.clientY < box.bottom;
46751
+ });
46752
+ const rows = table ? (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(table.rows).filter((row)=>row.cells.length) : [];
46753
+ if (!table || !rows.length) {
46754
+ return null;
46755
+ }
46756
+ const row = rows.find((row)=>e.clientY < row.getBoundingClientRect().bottom) ?? rows[rows.length - 1];
46757
+ return {
46758
+ table,
46759
+ row
46760
+ };
46761
+ }
46762
+ /**
46763
+ * A press to the right of a table row puts the caret where Word's typing
46764
+ * goes from there: the start of the next row's first cell, or of the block
46765
+ * after the table for the last row (#1770). The browsers put it after the
46766
+ * table, whichever row it's beside, so typing starts a new line below it.
46767
+ * Their own press is stopped, as its drag would start after the table and
46768
+ * take in the rows below first
46769
+ */ onMouseDownBesideTableRow(e) {
46770
+ const { j } = this;
46771
+ const beside = this.__rowBeside(e);
46772
+ if (!beside) {
46773
+ return;
46774
+ }
46775
+ // A press before the last one was let go must not stack its listeners
46776
+ this.__endPressBesideRow();
46777
+ e.preventDefault();
46778
+ this.__putCaretBesideRow(beside.table, beside.row);
46779
+ this.__pressBesideRow = {
46780
+ row: beside.row,
46781
+ caret: j.s.range.cloneRange()
46782
+ };
46783
+ j.e.on(j.ew, 'mousemove', this.__onDragFromRow);
46784
+ new Set([
46785
+ j.ew,
46786
+ j.ow
46787
+ ]).forEach((win)=>j.e.on(win, 'mouseup', this.__onReleaseFromRow));
46788
+ }
46789
+ /**
46790
+ * A drag from beside a row selects from the end of the row to the mouse,
46791
+ * and back beside the row it's the caret again
46792
+ */ __onDragFromRow(e) {
46793
+ const { s } = this.j;
46794
+ const press = this.__pressBesideRow;
46795
+ if (!press || !(e.buttons & 1)) {
46796
+ this.__endPressBesideRow();
46797
+ return;
46798
+ }
46799
+ if (this.__rowBeside(e)?.row === press.row) {
46800
+ if (!s.isCollapsed()) {
46801
+ s.selectRange(press.caret.cloneRange());
46802
+ }
46803
+ return;
46804
+ }
46805
+ const { cells } = press.row;
46806
+ const last = cells[cells.length - 1];
46807
+ if (s.insertCursorAtPoint(e.clientX, e.clientY)) {
46808
+ const { startContainer, startOffset } = s.range;
46809
+ s.sel?.setBaseAndExtent(last, last.childNodes.length, startContainer, startOffset);
46810
+ }
46811
+ }
46812
+ /**
46813
+ * In iframe mode, a press in an editor without the focus puts the caret at
46814
+ * its end, so a release that selected nothing puts it back
46815
+ */ __onReleaseFromRow() {
46816
+ const press = this.__pressBesideRow;
46817
+ this.__endPressBesideRow();
46818
+ if (press && this.j.s.isCollapsed()) {
46819
+ this.j.s.selectRange(press.caret);
46820
+ }
46821
+ }
46822
+ __endPressBesideRow() {
46823
+ const { j } = this;
46824
+ this.__pressBesideRow = null;
46825
+ j.e.off(j.ew, 'mousemove', this.__onDragFromRow);
46826
+ new Set([
46827
+ j.ew,
46828
+ j.ow
46829
+ ]).forEach((win)=>j.e.off(win, 'mouseup', this.__onReleaseFromRow));
46830
+ }
46831
+ /**
46832
+ * A double click beside a row is two clicks there, so add-new-line,
46833
+ * which adds a line on a double click with a caret, doesn't see it
46834
+ */ __onDblClickBesideRow(e) {
46835
+ if (this.__rowBeside(e)) {
46836
+ this.j.e.stopPropagation('dblclick');
46837
+ return false;
46838
+ }
46839
+ }
46840
+ __putCaretBesideRow(table, row) {
46841
+ const { j } = this;
46842
+ const rows = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(table.rows);
46843
+ const next = rows.slice(rows.indexOf(row) + 1).find((row)=>row.cells.length);
46844
+ let after = table.nextSibling;
46845
+ while(after && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(after)){
46846
+ after = after.nextSibling;
46847
+ }
46848
+ if (next) {
46849
+ j.s.setCursorIn(next.cells[0], true);
46850
+ } 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)) {
46851
+ j.s.setCursorIn(after, true);
46852
+ } else {
46853
+ j.s.setCursorAfter(table);
46854
+ }
46855
+ }
46305
46856
  /**
46306
46857
  * Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
46307
46858
  * a collapsed cursor leaves empty marker elements with the caret inside; a
@@ -46363,7 +46914,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46363
46914
  * Where the last press started. Chrome reports a drag that begins in one
46364
46915
  * element and ends in another as a `click` on their common ancestor, so a
46365
46916
  * press inside a popup is remembered to tell such a drag from a real click.
46366
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null);
46917
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null), /**
46918
+ * The row a press to its right was beside, and the caret it put there,
46919
+ * while the button is down
46920
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressBesideRow", null);
46367
46921
  }
46368
46922
  }
46369
46923
  ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
@@ -46393,6 +46947,18 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46393
46947
  ':click'
46394
46948
  ])
46395
46949
  ], select.prototype, "onClickRightOfNestedListItem", null);
46950
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46951
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':mousedown')
46952
+ ], select.prototype, "onMouseDownBesideTableRow", null);
46953
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46954
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
46955
+ ], select.prototype, "__onDragFromRow", null);
46956
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46957
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
46958
+ ], select.prototype, "__onReleaseFromRow", null);
46959
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46960
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
46961
+ ], select.prototype, "__onDblClickBesideRow", null);
46396
46962
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46397
46963
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
46398
46964
  ':click'