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
@@ -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) {
@@ -21521,7 +21622,7 @@ class DataProvider {
21521
21622
  }).catch(()=>null);
21522
21623
  return promise.then((resp)=>resp.json()).then((resp)=>{
21523
21624
  if (resp && !this.isSuccess(resp)) {
21524
- throw new Error(this.getMessage(resp));
21625
+ throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.answer)(this.getMessage(resp), resp, resp.data?.code);
21525
21626
  }
21526
21627
  return resp;
21527
21628
  });
@@ -21656,7 +21757,7 @@ class DataProvider {
21656
21757
  if (this.isSuccess(resp)) {
21657
21758
  return resp.data;
21658
21759
  }
21659
- throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.error)(this.getMessage(resp));
21760
+ throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.answer)(this.getMessage(resp), resp, resp.data?.code);
21660
21761
  });
21661
21762
  }
21662
21763
  /**
@@ -26496,6 +26597,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.uploader = {
26496
26597
  defaultHandlerError (e) {
26497
26598
  this.j.message.error(e.message);
26498
26599
  },
26600
+ promptOnExists: true,
26601
+ promptOnExistsSuggestName (name) {
26602
+ return name;
26603
+ },
26499
26604
  contentType (requestData) {
26500
26605
  return this.ow.FormData !== undefined && typeof requestData !== 'string' ? false : 'application/x-www-form-urlencoded; charset=UTF-8';
26501
26606
  }
@@ -26672,8 +26777,12 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26672
26777
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
26673
26778
  /* harmony export */ sendFiles: function() { return /* binding */ sendFiles; }
26674
26779
  /* harmony export */ });
26675
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(65946);
26676
- /* harmony import */ var jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(77911);
26780
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
26781
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
26782
+ /* harmony import */ var jodit_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80512);
26783
+ /* harmony import */ var jodit_modules_dialog_prompt__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(74103);
26784
+ /* harmony import */ var jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(77911);
26785
+ /* harmony import */ var jodit_modules_uploader_helpers_upload_error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(55083);
26677
26786
  /*!
26678
26787
  * Jodit Editor (https://xdsoft.net/jodit/)
26679
26788
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -26682,24 +26791,46 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26682
26791
  * @module modules/uploader
26683
26792
  */
26684
26793
 
26794
+
26795
+
26796
+
26797
+
26685
26798
  /**
26686
26799
  * Send files to server
26687
- */ function sendFiles(uploader, files, handlerSuccess, handlerError, process) {
26800
+ */ async function sendFiles(uploader, files, handlerSuccess, handlerError, process, // Set when a refused upload is sent again: `beforeUpload` already had its say
26801
+ retryOf) {
26688
26802
  if (!files) {
26689
- return Promise.reject((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Need files'));
26803
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Need files');
26690
26804
  }
26691
26805
  const { o } = uploader;
26692
- let fileList = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.toArray)(files);
26806
+ let fileList = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.toArray)(files);
26693
26807
  if (!fileList.length) {
26694
- return Promise.reject((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Need files'));
26808
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Need files');
26695
26809
  }
26696
- // Client-side validation hook — returning `false` aborts the upload.
26810
+ let extraData = retryOf?.data;
26811
+ // Client-side validation hook — returning `false` aborts the upload, and it may hand back the files to send instead
26697
26812
  // See https://github.com/xdan/jodit/issues/1329
26698
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(o.beforeUpload)) {
26699
- if (o.beforeUpload.call(uploader, fileList) === false) {
26700
- const err = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Upload canceled');
26813
+ if (!retryOf && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(o.beforeUpload)) {
26814
+ let plan;
26815
+ try {
26816
+ plan = await o.beforeUpload.call(uploader, fileList);
26817
+ } catch (e) {
26818
+ (handlerError || o.defaultHandlerError).call(uploader, e);
26819
+ throw e;
26820
+ }
26821
+ if (plan === false) {
26822
+ const err = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Upload canceled');
26701
26823
  (handlerError || o.defaultHandlerError).call(uploader, err);
26702
- return Promise.reject(err);
26824
+ throw err;
26825
+ }
26826
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(plan)) {
26827
+ fileList = plan;
26828
+ } else if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(plan) && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(plan.files)) {
26829
+ fileList = plan.files;
26830
+ extraData = plan.data;
26831
+ }
26832
+ if (!fileList.length) {
26833
+ return [];
26703
26834
  }
26704
26835
  }
26705
26836
  const promises = [];
@@ -26739,20 +26870,35 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26739
26870
  if (process) {
26740
26871
  process(form);
26741
26872
  }
26742
- if (o.data && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isPlainObject)(o.data)) {
26873
+ if (o.data && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(o.data)) {
26743
26874
  Object.keys(o.data).forEach((key)=>{
26744
26875
  form.append(key, o.data[key]);
26745
26876
  });
26746
26877
  }
26878
+ if (extraData) {
26879
+ Object.keys(extraData).forEach((key)=>{
26880
+ form.append(key, extraData[key]);
26881
+ });
26882
+ }
26747
26883
  o.prepareData.call(uploader, form);
26748
- promises.push((0,jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_1__.send)(uploader, form).then((resp)=>{
26884
+ promises.push((0,jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_4__.send)(uploader, form).then((resp)=>{
26749
26885
  if (o.isSuccess.call(uploader, resp)) {
26750
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
26886
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
26751
26887
  handler.call(uploader, o.process.call(uploader, resp));
26752
26888
  return resp;
26753
26889
  }
26754
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
26755
- handler.call(uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)(o.getMessage.call(uploader, resp)));
26890
+ 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, {
26891
+ data: {
26892
+ ...extraData,
26893
+ ...plan?.data
26894
+ }
26895
+ }));
26896
+ // A taken name is part of the upload, not a failure: ask for another one first
26897
+ if (err.code === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.ERROR_CODE_CONFLICT && o.promptOnExists) {
26898
+ return askAnotherName(uploader, err);
26899
+ }
26900
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
26901
+ handler.call(uploader, err);
26756
26902
  return resp;
26757
26903
  }).then(()=>{
26758
26904
  uploader.j.events && uploader.j.e.fire('filesWereUploaded');
@@ -26760,6 +26906,45 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26760
26906
  }
26761
26907
  return Promise.all(promises);
26762
26908
  }
26909
+ function askAnotherName(uploader, err) {
26910
+ const { files } = err;
26911
+ // A batch is refused as a whole (the connector saved nothing) and the answer does not say which name is taken,
26912
+ // so the files go again one by one: the free ones are simply stored, the taken one answers 409 alone and gets its prompt
26913
+ if (files.length > 1) {
26914
+ return files.reduce((chain, file)=>chain.then(()=>err.retry({
26915
+ files: [
26916
+ file
26917
+ ]
26918
+ })), Promise.resolve());
26919
+ }
26920
+ const [file] = files;
26921
+ const { j, o } = uploader;
26922
+ return new Promise((resolve)=>{
26923
+ let answered = false;
26924
+ // `Dlgs.prototype.dlg`: the uploader's view does not always carry the Dlgs trait
26925
+ 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, {
26926
+ closeOnClickOverlay: true
26927
+ }), j.i18n(err.message), j.i18n('Rename'), (newName)=>{
26928
+ newName = newName.trim();
26929
+ if (!newName) {
26930
+ return false;
26931
+ }
26932
+ answered = true;
26933
+ resolve(err.retry({
26934
+ files: [
26935
+ new File([
26936
+ file
26937
+ ], newName, {
26938
+ type: file.type
26939
+ })
26940
+ ]
26941
+ }));
26942
+ }, j.i18n('Enter new name'), o.promptOnExistsSuggestName.call(uploader, file.name));
26943
+ dialog.e.on(dialog, 'afterClose', ()=>{
26944
+ !answered && resolve(undefined);
26945
+ });
26946
+ });
26947
+ }
26763
26948
  function readImagesWithReader(fileList, imagesExtensions, promises, uploader, handlerSuccess, defaultHandlerSuccess) {
26764
26949
  const readerPromises = [];
26765
26950
  let file, i;
@@ -26788,7 +26973,7 @@ function readImagesWithReader(fileList, imagesExtensions, promises, uploader, ha
26788
26973
  name
26789
26974
  ]
26790
26975
  };
26791
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerSuccess) ? handlerSuccess : defaultHandlerSuccess;
26976
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerSuccess) ? handlerSuccess : defaultHandlerSuccess;
26792
26977
  handler.call(uploader, resp);
26793
26978
  resolve(resp);
26794
26979
  };
@@ -26904,6 +27089,34 @@ function send(uploader, data) {
26904
27089
  /* harmony export */ ]);
26905
27090
 
26906
27091
 
27092
+ /***/ }),
27093
+
27094
+ /***/ 55083:
27095
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
27096
+
27097
+ "use strict";
27098
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
27099
+ /* harmony export */ UploadError: function() { return /* binding */ UploadError; }
27100
+ /* harmony export */ });
27101
+ /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
27102
+ /* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33201);
27103
+ /*!
27104
+ * Jodit Editor (https://xdsoft.net/jodit/)
27105
+ * Released under MIT see LICENSE.txt in the project root for license information.
27106
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
27107
+ */ /**
27108
+ * @module modules/uploader
27109
+ */
27110
+
27111
+ // The connector refused these files: the handler can change the request and send it again
27112
+ class UploadError extends jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__.AnswerError {
27113
+ constructor(message, answer, files, retry){
27114
+ 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;
27115
+ Object.setPrototypeOf(this, UploadError.prototype);
27116
+ }
27117
+ }
27118
+
27119
+
26907
27120
  /***/ }),
26908
27121
 
26909
27122
  /***/ 94925:
@@ -26918,9 +27131,10 @@ function send(uploader, data) {
26918
27131
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
26919
27132
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23211);
26920
27133
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
26921
- /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5266);
26922
- /* harmony import */ var jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(11981);
26923
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(40013);
27134
+ /* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(33201);
27135
+ /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5266);
27136
+ /* harmony import */ var jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11981);
27137
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(40013);
26924
27138
  /*!
26925
27139
  * Jodit Editor (https://xdsoft.net/jodit/)
26926
27140
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -26938,6 +27152,7 @@ function send(uploader, data) {
26938
27152
 
26939
27153
 
26940
27154
 
27155
+
26941
27156
  class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewComponent {
26942
27157
  get j() {
26943
27158
  return this.jodit;
@@ -26993,14 +27208,14 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
26993
27208
  }
26994
27209
  };
26995
27210
  // send data on server
26996
- if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(cData)) {
26997
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, cData.files, handlerSuccess, handlerError).finally(onFinally);
27211
+ if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(cData)) {
27212
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, cData.files, handlerSuccess, handlerError).finally(onFinally);
26998
27213
  return false;
26999
27214
  }
27000
27215
  if (jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && !jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_ES_NEXT) {
27001
- return (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.processOldBrowserDrag)(self, cData, handlerSuccess, handlerError, onFinally);
27216
+ return (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.processOldBrowserDrag)(self, cData, handlerSuccess, handlerError, onFinally);
27002
27217
  }
27003
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasItems)(cData)) {
27218
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasItems)(cData)) {
27004
27219
  const { items } = cData;
27005
27220
  for(i = 0; i < items.length; i += 1){
27006
27221
  if (items[i].kind === 'file' && items[i].type === 'image/png') {
@@ -27008,7 +27223,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27008
27223
  if (file) {
27009
27224
  const mime = file.type.match(/\/([a-z0-9]+)/i);
27010
27225
  extension = mime[1] ? mime[1].toLowerCase() : '';
27011
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, [
27226
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, [
27012
27227
  file
27013
27228
  ], handlerSuccess, handlerError, processData).finally(onFinally);
27014
27229
  }
@@ -27030,27 +27245,27 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27030
27245
  self.j.e.on(form, 'dragend dragover dragenter dragleave drop', (e)=>{
27031
27246
  e.preventDefault();
27032
27247
  }).on(form, 'dragover', (event)=>{
27033
- 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)) {
27248
+ 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)) {
27034
27249
  form.classList.add('jodit_drag_hover');
27035
27250
  event.preventDefault();
27036
27251
  }
27037
27252
  }).on(form, 'dragend dragleave', (event)=>{
27038
27253
  form.classList.remove('jodit_drag_hover');
27039
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(event.dataTransfer)) {
27254
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
27040
27255
  event.preventDefault();
27041
27256
  }
27042
27257
  }).on(form, 'drop', (event)=>{
27043
27258
  form.classList.remove('jodit_drag_hover');
27044
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(event.dataTransfer)) {
27259
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
27045
27260
  event.preventDefault();
27046
27261
  event.stopImmediatePropagation();
27047
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, event.dataTransfer.files, handlerSuccess, handlerError).finally(onFinally);
27262
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, event.dataTransfer.files, handlerSuccess, handlerError).finally(onFinally);
27048
27263
  }
27049
27264
  });
27050
27265
  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');
27051
27266
  if (inputFile) {
27052
27267
  self.j.e.on(inputFile, 'change', ()=>{
27053
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, inputFile.files, handlerSuccess, handlerError).then(()=>{
27268
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, inputFile.files, handlerSuccess, handlerError).then(()=>{
27054
27269
  inputFile.value = '';
27055
27270
  if (!/safari/i.test(navigator.userAgent)) {
27056
27271
  inputFile.type = '';
@@ -27065,7 +27280,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27065
27280
  */ uploadRemoteImage(url, handlerSuccess, handlerError) {
27066
27281
  const uploader = this, { o } = uploader;
27067
27282
  const handlerE = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
27068
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.send)(uploader, {
27283
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.send)(uploader, {
27069
27284
  action: 'fileUploadRemote',
27070
27285
  url
27071
27286
  }).then((resp)=>{
@@ -27074,17 +27289,31 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27074
27289
  handler.call(uploader, o.process.call(uploader, resp));
27075
27290
  return;
27076
27291
  }
27077
- handlerE.call(uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.error)(o.getMessage.call(uploader, resp)));
27292
+ handlerE.call(uploader, (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__.answer)(o.getMessage.call(uploader, resp), resp, resp.data?.code));
27078
27293
  }).catch((e)=>handlerE.call(uploader, e));
27079
27294
  }
27080
27295
  upload(files) {
27081
27296
  return this.async.promise((resolve, reject)=>{
27082
- ;(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(this, files, resolve, reject);
27297
+ let settled = false;
27298
+ const settle = (end)=>(value)=>{
27299
+ settled = true;
27300
+ end(value);
27301
+ };
27302
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(this, files, settle(resolve), settle(reject)).then(()=>{
27303
+ // `beforeUpload` kept no file, so no handler ran
27304
+ if (!settled) {
27305
+ resolve({
27306
+ baseurl: '',
27307
+ files: [],
27308
+ isImages: []
27309
+ });
27310
+ }
27311
+ }, settle(reject));
27083
27312
  });
27084
27313
  }
27085
27314
  destruct() {
27086
27315
  this.setStatus(jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.STATUSES.beforeDestruct);
27087
- const instances = jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.ajaxInstances.get(this);
27316
+ const instances = jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.ajaxInstances.get(this);
27088
27317
  if (instances) {
27089
27318
  instances.forEach((ajax)=>{
27090
27319
  try {
@@ -27097,7 +27326,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27097
27326
  }
27098
27327
  constructor(editor, options){
27099
27328
  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);
27100
- 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 : {}));
27329
+ 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 : {}));
27101
27330
  }
27102
27331
  }
27103
27332
 
@@ -28586,6 +28815,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28586
28815
  if (checkJoinBareText(jodit, fakeNode, backspace)) {
28587
28816
  return true;
28588
28817
  }
28818
+ // Old content can have an inline element round blocks beside the text:
28819
+ // moved inside them, the line joins the block as it would bare text
28820
+ // (#1781)
28821
+ const inline = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
28822
+ if (joinsBareText(jodit, edgeBlock(inline, backspace)) && moveInlineInside(inline, jodit.editor)) {
28823
+ return joinNeighbors(jodit, fakeNode, backspace, moved);
28824
+ }
28589
28825
  let nextBox = fakeNode, mainClosestBox = nextBox;
28590
28826
  // Find the main big closest element
28591
28827
  while(nextBox && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(nextBox, backspace) && nextBox.parentElement !== jodit.editor){
@@ -28866,7 +29102,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28866
29102
  * in `<div>a|<p>b</p>c</div>` gives `<div>a|b<br>c</div>`
28867
29103
  */ function checkJoinBareText(jodit, fakeNode, backspace) {
28868
29104
  const block = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
28869
- if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(block) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(block) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(block) || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(block, 'table') || jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(block) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(block, jodit.editor) || Array.from(block.childNodes).some((node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(node))) {
29105
+ if (!joinsBareText(jodit, block)) {
28870
29106
  return false;
28871
29107
  }
28872
29108
  const filter = (0,jodit_plugins_backspace_helpers__WEBPACK_IMPORTED_MODULE_2__.getMoveFilter)(jodit);
@@ -28893,6 +29129,23 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28893
29129
  jodit.s.setCursorBefore(fakeNode);
28894
29130
  return true;
28895
29131
  }
29132
+ /**
29133
+ * Whether a block joins the bare text beside it: not a list, a table or a
29134
+ * cell, and holding no block of its own
29135
+ */ function joinsBareText(jodit, block) {
29136
+ 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));
29137
+ }
29138
+ /**
29139
+ * The block an inline element holds on its side facing the caret, through
29140
+ * the inline elements in it: the `<p>` of `<span><strong><p>…</p></strong></span>`
29141
+ */ function edgeBlock(node, backspace) {
29142
+ let edge = node;
29143
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(edge) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(edge)){
29144
+ const children = Array.from(edge.childNodes).filter((child)=>!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child));
29145
+ edge = (backspace ? children[children.length - 1] : children[0]) ?? null;
29146
+ }
29147
+ return edge === node ? null : edge;
29148
+ }
28896
29149
  function checkMoveListContent(jodit, mainClosestBox, sibling, backspace) {
28897
29150
  // Process UL/LI/OL cases
28898
29151
  const siblingIsList = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.LIST_TAGS);
@@ -29342,7 +29595,6 @@ function isNotEditable(jodit, node) {
29342
29595
  if (!prn || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn)) {
29343
29596
  return false;
29344
29597
  }
29345
- const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
29346
29598
  do {
29347
29599
  if (prn && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(prn)) {
29348
29600
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(prn, fakeNode);
@@ -29357,6 +29609,9 @@ function isNotEditable(jodit, node) {
29357
29609
  if (found && (0,_check_join_two_lists__WEBPACK_IMPORTED_MODULE_2__.checkJoinTwoLists)(jodit, fakeNode, backspace)) {
29358
29610
  return true;
29359
29611
  }
29612
+ // Looked for once the empty elements have gone, as the one beside the
29613
+ // caret can be in them: the `<br>` that Delete in `<p>|<br></p>` leaves
29614
+ const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
29360
29615
  if (neighbor && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText(neighbor) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(neighbor, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INSEPARABLE_TAGS)) {
29361
29616
  setCursorIn(neighbor, !backspace);
29362
29617
  } else {
@@ -29822,8 +30077,15 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.delete = {
29822
30077
  }
29823
30078
  cssRules[key] = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(cssOptions[key]) ? cssOptions[key][0] : cssOptions[key];
29824
30079
  });
30080
+ const element = control.tags ? control.tags[0] : undefined;
29825
30081
  editor.s.commitStyle({
29826
- element: control.tags ? control.tags[0] : undefined
30082
+ element,
30083
+ // As in the browsers and Word, each takes the other's place
30084
+ exclude: element === 'sub' ? [
30085
+ 'sup'
30086
+ ] : element === 'sup' ? [
30087
+ 'sub'
30088
+ ] : []
29827
30089
  });
29828
30090
  editor.synchronizeValues();
29829
30091
  return false;
@@ -32075,11 +32337,12 @@ __webpack_require__.r(__webpack_exports__);
32075
32337
  "use strict";
32076
32338
  /* unused harmony export deleteCommand */
32077
32339
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
32078
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27795);
32079
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28077);
32080
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65946);
32081
- /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4040);
32082
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(91206);
32340
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
32341
+ /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27795);
32342
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28077);
32343
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
32344
+ /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4040);
32345
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
32083
32346
  /*!
32084
32347
  * Jodit Editor (https://xdsoft.net/jodit/)
32085
32348
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -32095,6 +32358,7 @@ __webpack_require__.r(__webpack_exports__);
32095
32358
 
32096
32359
 
32097
32360
 
32361
+
32098
32362
  const NOT_EMPTY_CONTENT_TAGS = new Set([
32099
32363
  'img',
32100
32364
  'table',
@@ -32102,7 +32366,18 @@ const NOT_EMPTY_CONTENT_TAGS = new Set([
32102
32366
  'iframe',
32103
32367
  'hr'
32104
32368
  ]);
32105
- class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
32369
+ const KEEPS_SPACES = new Set([
32370
+ 'pre',
32371
+ 'pre-wrap',
32372
+ 'break-spaces'
32373
+ ]);
32374
+ /**
32375
+ * A plain space beside this neighbor isn't shown: there is none, or it's a
32376
+ * line break, a block or text starting (or ending) with a plain space
32377
+ */ function hidesSpace(neighbor, edge) {
32378
+ 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 ?? '');
32379
+ }
32380
+ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
32106
32381
  afterInit(jodit) {
32107
32382
  jodit.e.on('afterCommand.delete', (command)=>{
32108
32383
  if (command === 'delete') {
@@ -32123,11 +32398,11 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32123
32398
  */ __afterDeleteCommand() {
32124
32399
  const jodit = this.j;
32125
32400
  const current = jodit.s.current();
32126
- if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(current.firstChild, 'br')) {
32401
+ if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(current.firstChild, 'br')) {
32127
32402
  jodit.s.removeNode(current.firstChild);
32128
32403
  }
32129
- if (!(0,jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_4__.trim)(jodit.editor.textContent || '') && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.first(jodit.editor, (node)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(node, NOT_EMPTY_CONTENT_TAGS)) && (!current || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(current, 'table', jodit.editor))) {
32130
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.detach(jodit.editor);
32404
+ 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))) {
32405
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.detach(jodit.editor);
32131
32406
  const node = jodit.s.setCursorIn(jodit.editor);
32132
32407
  jodit.s.removeNode(node);
32133
32408
  }
@@ -32147,14 +32422,15 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32147
32422
  range.deleteContents();
32148
32423
  const fake = jodit.createInside.fake();
32149
32424
  range.insertNode(fake);
32150
- const leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(fake, true);
32151
- const rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(fake, false);
32425
+ const leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.findSibling(fake, true);
32426
+ const rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.findSibling(fake, false);
32152
32427
  this.__moveContentInLeftSibling(fake, leftSibling, rightSibling);
32428
+ this.__keepSpacesVisible(fake);
32153
32429
  range.setStartBefore(fake);
32154
32430
  range.collapse(true);
32155
32431
  this.__moveCursorInEditableSibling(jodit, leftSibling, fake, range);
32156
32432
  this.__addBrInEmptyBlock(fake, range);
32157
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(fake);
32433
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
32158
32434
  jodit.s.selectRange(caret ?? range);
32159
32435
  return false;
32160
32436
  }
@@ -32168,23 +32444,23 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32168
32444
  * Returns where the caret goes, or null when no table is involved
32169
32445
  */ __clearSelectedCells(range) {
32170
32446
  const { editor, createInside } = this.j;
32171
- const startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell, editor);
32172
- const endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell, editor);
32447
+ const startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell, editor);
32448
+ const endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell, editor);
32173
32449
  if (startCell === endCell) {
32174
32450
  return null;
32175
32451
  }
32176
- const startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(startCell, 'table', editor);
32177
- const endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(endCell, 'table', editor);
32452
+ const startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(startCell, 'table', editor);
32453
+ const endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(endCell, 'table', editor);
32178
32454
  const caret = range.cloneRange();
32179
32455
  caret.collapse(true);
32180
32456
  const parts = [];
32181
32457
  const addParts = (table)=>{
32182
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.toArray)(table.rows).flatMap((row)=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.toArray)(row.cells)).filter((cell)=>range.intersectsNode(cell)).forEach((cell)=>{
32458
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.toArray)(table.rows).flatMap((row)=>(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.toArray)(row.cells)).filter((cell)=>range.intersectsNode(cell)).forEach((cell)=>{
32183
32459
  const part = range.cloneRange();
32184
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(cell, range.startContainer)) {
32460
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.startContainer)) {
32185
32461
  part.setStart(cell, 0);
32186
32462
  }
32187
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(cell, range.endContainer)) {
32463
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.endContainer)) {
32188
32464
  part.setEnd(cell, cell.childNodes.length);
32189
32465
  }
32190
32466
  parts.push([
@@ -32207,9 +32483,9 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32207
32483
  }
32208
32484
  parts.forEach(([cell, part])=>{
32209
32485
  part.deleteContents();
32210
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(cell)) {
32211
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.detach(cell);
32212
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(cell, createInside.element('br'));
32486
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(cell)) {
32487
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.detach(cell);
32488
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(cell, createInside.element('br'));
32213
32489
  }
32214
32490
  });
32215
32491
  return startTable ? caret : null;
@@ -32217,46 +32493,72 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32217
32493
  __moveContentInLeftSibling(fake, leftSibling, rightSibling) {
32218
32494
  leftSibling = this.__defineRightLeftBox(leftSibling);
32219
32495
  // Nothing is moved into a table, and a block left empty after it goes
32220
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(leftSibling, 'table')) {
32221
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(rightSibling)) {
32222
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32496
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(leftSibling, 'table')) {
32497
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
32498
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32223
32499
  }
32224
32500
  return;
32225
32501
  }
32226
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(rightSibling) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(rightSibling, 'table') && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(leftSibling)) {
32227
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, fake);
32228
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.moveContent(rightSibling, leftSibling);
32229
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32502
+ 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)) {
32503
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, fake);
32504
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.moveContent(rightSibling, leftSibling);
32505
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32230
32506
  }
32231
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(rightSibling.firstElementChild)) {
32507
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(rightSibling.firstElementChild)) {
32232
32508
  const item = rightSibling.firstElementChild;
32233
32509
  // What's left of the right list's first item joins the left block,
32234
32510
  // up to a list nested in the item
32235
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(leftSibling)) {
32236
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, fake);
32237
- while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(item.firstChild)){
32238
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, item.firstChild);
32511
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(leftSibling)) {
32512
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, fake);
32513
+ while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(item.firstChild)){
32514
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, item.firstChild);
32239
32515
  }
32240
32516
  }
32241
32517
  // Remove empty right LI
32242
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(item)) {
32243
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(item);
32518
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item)) {
32519
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(item);
32244
32520
  }
32245
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(rightSibling)) {
32246
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
32521
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
32522
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32247
32523
  }
32248
32524
  }
32249
32525
  }
32526
+ /**
32527
+ * A plain space the deletion leaves at an edge of the block, before a line
32528
+ * break or next to another space isn't shown, and the browser drops it when
32529
+ * the next char is typed. It becomes non-breaking, as in the browsers' own
32530
+ * delete and in Backspace without a selection (#1522)
32531
+ */ __keepSpacesVisible(fake) {
32532
+ const { jodit } = this;
32533
+ 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;
32534
+ if (KEEPS_SPACES.has(jodit.ew.getComputedStyle(block).whiteSpace)) {
32535
+ return;
32536
+ }
32537
+ const before = this.__findNeighbor(fake, true, block);
32538
+ const after = this.__findNeighbor(fake, false, block);
32539
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(before) && hidesSpace(after, /^ /)) {
32540
+ before.nodeValue = before.nodeValue.replace(/ +$/, (spaces)=>jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.NBSP_SPACE.repeat(spaces.length));
32541
+ }
32542
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(after) && hidesSpace(before, / $/)) {
32543
+ after.nodeValue = after.nodeValue.replace(/^ +/, (spaces)=>jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.NBSP_SPACE.repeat(spaces.length));
32544
+ }
32545
+ }
32546
+ /**
32547
+ * The text, line break or other element next to the caret in its block,
32548
+ * looking inside inline elements
32549
+ */ __findNeighbor(fake, left, block) {
32550
+ 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);
32551
+ }
32250
32552
  /**
32251
32553
  * If left sibling is list - return last leaf
32252
32554
  */ __defineRightLeftBox(leftSibling) {
32253
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(leftSibling)) {
32555
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(leftSibling)) {
32254
32556
  return leftSibling;
32255
32557
  }
32256
32558
  let lastLeaf = leftSibling.lastElementChild;
32257
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(lastLeaf)) {
32559
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(lastLeaf)) {
32258
32560
  lastLeaf = this.j.createInside.element('li');
32259
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, lastLeaf);
32561
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, lastLeaf);
32260
32562
  }
32261
32563
  return lastLeaf;
32262
32564
  }
@@ -32264,21 +32566,21 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32264
32566
  * Add BR in the empty block left at the caret
32265
32567
  */ __addBrInEmptyBlock(fake, range) {
32266
32568
  const jodit = this.j;
32267
- if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
32569
+ if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
32268
32570
  const br = jodit.createInside.element('br');
32269
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(fake, br);
32571
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.after(fake, br);
32270
32572
  range.setStartBefore(br);
32271
32573
  range.collapse(true);
32272
32574
  }
32273
32575
  }
32274
32576
  __moveCursorInEditableSibling(jodit, leftSibling, fake, range) {
32275
- if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText(leftSibling)) {
32276
- const root = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock, jodit.editor) ?? jodit.editor;
32277
- const leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText, root);
32577
+ if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(leftSibling)) {
32578
+ 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;
32579
+ const leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText, root);
32278
32580
  if (leftText) {
32279
32581
  range.setStartAfter(leftText);
32280
32582
  range.collapse(true);
32281
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(fake);
32583
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
32282
32584
  }
32283
32585
  }
32284
32586
  }
@@ -32286,7 +32588,7 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32286
32588
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(deleteCommand, "requires", [
32287
32589
  'backspace'
32288
32590
  ]);
32289
- jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('deleteCommand', deleteCommand);
32591
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('deleteCommand', deleteCommand);
32290
32592
 
32291
32593
 
32292
32594
  /***/ }),
@@ -42819,7 +43121,7 @@ const key = 'table_processor_observer-resize';
42819
43121
  /**
42820
43122
  * Click on resize handle
42821
43123
  */ onHandleMouseDown(event) {
42822
- if (this.j.isLocked) {
43124
+ if (this.j.isLocked || this.j.o.readonly) {
42823
43125
  return;
42824
43126
  }
42825
43127
  this.drag = true;
@@ -42854,10 +43156,15 @@ const key = 'table_processor_observer-resize';
42854
43156
  let box;
42855
43157
  this.minX = 0;
42856
43158
  this.maxX = 1000000;
43159
+ this.startTableWidth = this.workTable.offsetWidth;
42857
43160
  if (this.wholeTable != null) {
42858
- const tableBox = this.workTable.parentNode.getBoundingClientRect();
43161
+ const parent = this.workTable.parentNode;
43162
+ const tableBox = parent.getBoundingClientRect();
42859
43163
  this.minX = tableBox.left;
42860
43164
  this.maxX = this.minX + tableBox.width;
43165
+ const side = this.isRTL ? 'marginRight' : 'marginLeft';
43166
+ this.startParentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getContentWidth)(parent, this.j.ew);
43167
+ this.startMargin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
42861
43168
  } else {
42862
43169
  // find maximum columns
42863
43170
  const coordinate = this.module.formalCoordinate(this.workTable, this.workCell, true);
@@ -42871,6 +43178,17 @@ const key = 'table_processor_observer-resize';
42871
43178
  this.maxX = Math.min(box.left + box.width - jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.NEARBY / 2, this.maxX);
42872
43179
  }
42873
43180
  });
43181
+ const matrix = this.module.formalMatrix(this.workTable);
43182
+ this.startWidths = this.resizedColumns().map((column)=>{
43183
+ const cells = matrix.map((row)=>row[column]);
43184
+ const index = cells.findIndex((td)=>td.colSpan === 1 || cells.length === 1);
43185
+ const cell = cells[index];
43186
+ return [
43187
+ cell,
43188
+ cell ? cell.offsetWidth : 0,
43189
+ cells.slice(Math.max(index, 0) + 1)
43190
+ ];
43191
+ });
42874
43192
  }
42875
43193
  return false;
42876
43194
  }
@@ -42898,8 +43216,11 @@ const key = 'table_processor_observer-resize';
42898
43216
  x = this.maxX;
42899
43217
  }
42900
43218
  this.resizeDelta = x - this.startX + (!this.j.o.iframe ? 0 : workplacePosition.left);
42901
- this.restoreStyles();
42902
- this.resizeColumnsOrTable();
43219
+ if (this.wholeTable == null) {
43220
+ this.setColumnWidths();
43221
+ } else {
43222
+ this.resizeTable();
43223
+ }
42903
43224
  const tableBox = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.offset)(this.workTable, this.j, this.j.ed);
42904
43225
  Object.assign(this.resizeHandler.style, {
42905
43226
  left: this.startLeft + this.columnEdge() - this.startEdge + 'px',
@@ -43012,21 +43333,49 @@ const key = 'table_processor_observer-resize';
43012
43333
  };
43013
43334
  this.scrollFrame = this.j.async.requestAnimationFrame(scroll);
43014
43335
  }
43336
+ /**
43337
+ * The two columns a column drag resizes: the work cell's last, and the
43338
+ * next cell's first
43339
+ */ resizedColumns() {
43340
+ 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);
43341
+ return [
43342
+ this.module.formalCoordinate(this.workTable, this.workCell, true)[1],
43343
+ this.module.formalCoordinate(this.workTable, nextTD)[1]
43344
+ ];
43345
+ }
43015
43346
  /**
43016
43347
  * Resize only one column
43017
43348
  */ resizeColumns() {
43018
43349
  const delta = this.resizeDelta;
43019
43350
  const marked = [];
43020
43351
  const tableModule = this.module;
43021
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, this.workCell, true)[1], delta, true, marked);
43022
- const nextTD = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.call)(this.isRTL ? jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.prev : jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.next, this.workCell, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isCell, this.workCell.parentNode);
43023
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, nextTD)[1], -delta, false, marked);
43352
+ const [column, nextColumn] = this.resizedColumns();
43353
+ tableModule.setColumnWidthByDelta(this.workTable, column, delta, true, marked);
43354
+ tableModule.setColumnWidthByDelta(this.workTable, nextColumn, -delta, false, marked);
43355
+ }
43356
+ /**
43357
+ * Sets the widths `resizeColumns` would while the handle is dragged, from
43358
+ * the widths the drag started with, so that a move doesn't put back every
43359
+ * cell's style and lay the table out again to measure them
43360
+ */ setColumnWidths() {
43361
+ this.startWidths.forEach(([cell, width, below], index)=>{
43362
+ const delta = index ? -this.resizeDelta : this.resizeDelta;
43363
+ if (cell) {
43364
+ (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) + '%');
43365
+ }
43366
+ below.forEach((td)=>{
43367
+ td.style.removeProperty('width');
43368
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(td, 'style')) {
43369
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(td, 'style', null);
43370
+ }
43371
+ });
43372
+ });
43024
43373
  }
43025
43374
  /**
43026
43375
  * Resize whole table
43027
43376
  */ resizeTable() {
43028
43377
  const delta = this.resizeDelta * (this.isRTL ? -1 : 1);
43029
- const width = this.workTable.offsetWidth, parentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getContentWidth)(this.workTable.parentNode, this.j.ew);
43378
+ const width = this.startTableWidth, parentWidth = this.startParentWidth;
43030
43379
  // for RTL use mirror logic
43031
43380
  const rightSide = !this.wholeTable;
43032
43381
  const needChangeWidth = this.isRTL ? !rightSide : rightSide;
@@ -43035,10 +43384,9 @@ const key = 'table_processor_observer-resize';
43035
43384
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, 'width', (width + delta) / parentWidth * 100 + '%');
43036
43385
  } else {
43037
43386
  const side = this.isRTL ? 'marginRight' : 'marginLeft';
43038
- const margin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
43039
43387
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, {
43040
43388
  width: (width - delta) / parentWidth * 100 + '%',
43041
- [side]: (margin + delta) / parentWidth * 100 + '%'
43389
+ [side]: (this.startMargin + delta) / parentWidth * 100 + '%'
43042
43390
  });
43043
43391
  }
43044
43392
  }
@@ -43114,9 +43462,10 @@ const key = 'table_processor_observer-resize';
43114
43462
  if (!editor.o.tableAllowCellResize) {
43115
43463
  return;
43116
43464
  }
43117
- editor.e.off(this.j.ow, '.resize-cells').off('.resize-cells').on('change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells', ()=>{
43465
+ const observeTables = ()=>{
43118
43466
  ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', editor.editor).forEach(this.observe);
43119
- }).on(this.j.ow, 'scroll.resize-cells', ()=>{
43467
+ };
43468
+ editor.e.off(this.j.ow, '.resize-cells').off('.resize-cells').on('change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells', observeTables).on(this.j.ow, 'scroll.resize-cells', ()=>{
43120
43469
  if (!this.drag || this.workRow) {
43121
43470
  return;
43122
43471
  }
@@ -43132,6 +43481,8 @@ const key = 'table_processor_observer-resize';
43132
43481
  tableModule.normalizeTable(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(td, 'table', editor.editor));
43133
43482
  });
43134
43483
  });
43484
+ // None of those events comes with the editor's starting value
43485
+ observeTables();
43135
43486
  }
43136
43487
  /**
43137
43488
  * Add to every Table listeners
@@ -43145,7 +43496,9 @@ const key = 'table_processor_observer-resize';
43145
43496
  this.hideResizeHandle();
43146
43497
  }
43147
43498
  }).on(table, 'mousemove.resize-cells touchmove.resize-cells', this.j.async.throttle((event)=>{
43148
- if (this.j.isLocked) {
43499
+ // A drag from a cell isn't a resize, and the handle on
43500
+ // a border it passes would take its moves (#1778)
43501
+ if (this.j.isLocked || this.j.o.readonly || event.buttons) {
43149
43502
  return;
43150
43503
  }
43151
43504
  const cell = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.up(event.target, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isCell, table);
@@ -43178,8 +43531,15 @@ const key = 'table_processor_observer-resize';
43178
43531
  }
43179
43532
  }), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "hideTimeout", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "drag", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "wholeTable", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "workCell", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "workTable", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "minX", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "maxX", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startX", 0), /**
43180
43533
  * The table's and its cells' styles as a column drag started, put back
43181
- * before each new width
43534
+ * as it ends, before the final widths
43182
43535
  */ (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), /**
43536
+ * For each of the two columns a drag resizes, the cell whose width
43537
+ * `setColumnWidthByDelta` sets, with its width as the drag started, and
43538
+ * the cells below it, whose widths it clears
43539
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startWidths", []), /**
43540
+ * The table's width as the drag started, and for a drag of its edge, the
43541
+ * width inside what holds it and its margin on that side
43542
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startTableWidth", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startParentWidth", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startMargin", 0), /**
43183
43543
  * The row whose height the handle sets, or null while it sets a width
43184
43544
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "workRow", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startY", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startHeight", 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "rowStyle", null), /**
43185
43545
  * The boxes that scroll the row, with their styles, as a row drag turns
@@ -44929,7 +45289,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.tableAllowCellSelecti
44929
45289
 
44930
45290
 
44931
45291
  const key = 'table_processor_observer';
44932
- const MOUSE_MOVE_LABEL = 'onMoveTableSelectCell';
44933
45292
  class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
44934
45293
  /**
44935
45294
  * Shortcut for Jodit.modules.Table
@@ -44944,6 +45303,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
44944
45303
  // move the caret, as table-keyboard-navigation's do
44945
45304
  .on('keydown', this.__onKeyDown, {
44946
45305
  top: true
45306
+ }).on('clickEditor', this.__onClickAfterDrag, {
45307
+ top: true
44947
45308
  }).on('keydown.select-cells', (event)=>{
44948
45309
  if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB) {
44949
45310
  this.unselectCells();
@@ -45061,18 +45422,35 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45061
45422
  }
45062
45423
  this.__isSelectionMode = true;
45063
45424
  this.__selectedCell = cell;
45425
+ this.__movedTo = cell;
45064
45426
  this.__tableModule.addSelection(cell);
45065
- this.j.e.on(table, 'mousemove.select-cells touchmove.select-cells', // Don't use decorator because need clear label on mouseup
45066
- this.j.async.throttle(this.__onMove.bind(this, table), {
45067
- label: MOUSE_MOVE_LABEL,
45068
- timeout: this.j.defaultTimeout / 2
45069
- })).on(table, 'mouseup.select-cells touchend.select-cells', this.__onStopSelection.bind(this, table));
45427
+ 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));
45428
+ new Set([
45429
+ this.j.ew,
45430
+ this.j.ow
45431
+ ]).forEach((win)=>this.j.e.on(win, 'mouseup.select-cells touchend.select-cells', this.__onRelease.bind(this, table)));
45070
45432
  return false;
45071
45433
  }
45072
45434
  onOutsideClick() {
45073
45435
  this.__selectedCell = null;
45074
45436
  this.__onRemoveSelection();
45075
45437
  }
45438
+ onMouseDown() {
45439
+ this.__keepMarks = false;
45440
+ }
45441
+ /**
45442
+ * The click that ends a drag let go outside the table, and inside the
45443
+ * editor, lands on the editor. Taken on, it would unmark the cells and
45444
+ * close their popup. As for the click on a row after a drag over the
45445
+ * cells, the browser's own selection from the drag goes
45446
+ */ __onClickAfterDrag() {
45447
+ if (this.__keepMarks) {
45448
+ this.__keepMarks = false;
45449
+ this.j.s.sel?.removeAllRanges();
45450
+ this.j.e.stopPropagation('clickEditor');
45451
+ return false;
45452
+ }
45453
+ }
45076
45454
  onChange() {
45077
45455
  if (!this.j.isLocked && !this.__isSelectionMode) {
45078
45456
  this.__onRemoveSelection();
@@ -45090,16 +45468,20 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45090
45468
  // Inside Shadow DOM `document.elementFromPoint` returns the shadow
45091
45469
  // host, so the lookup must start from the shadow root
45092
45470
  const node = (this.j.o.shadowRoot ?? this.j.ed).elementFromPoint(e.clientX, e.clientY);
45093
- if (!node) {
45094
- return;
45095
- }
45096
- const cell = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
45471
+ const cell = node && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
45097
45472
  'td',
45098
45473
  'th'
45099
45474
  ], table);
45100
45475
  if (!cell || !this.__selectedCell) {
45101
45476
  return;
45102
45477
  }
45478
+ // The marks change only when the mouse goes into another cell, and then
45479
+ // at once rather than throttled, as the browser's own selection from
45480
+ // the drag shows in the cells between until they do (#1778)
45481
+ if (cell === this.__movedTo) {
45482
+ return;
45483
+ }
45484
+ this.__movedTo = cell;
45103
45485
  if (cell !== this.__selectedCell) {
45104
45486
  this.j.lock(key);
45105
45487
  }
@@ -45157,10 +45539,32 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45157
45539
  if (ownTable && ownTable !== table) {
45158
45540
  return; // Nested tables
45159
45541
  }
45160
- const bound = this.__tableModule.getSelectedBound(table, [
45542
+ this.__showCellsPopup(table, [
45161
45543
  cell,
45162
45544
  this.__selectedCell
45163
- ]), box = this.__tableModule.formalMatrix(table);
45545
+ ]);
45546
+ this.__stopListening();
45547
+ }
45548
+ /**
45549
+ * A drag let go outside the table doesn't reach the table's `mouseup`, so
45550
+ * the window's ends it, leaving the cells marked as they were (#1774)
45551
+ */ __onRelease(table, e) {
45552
+ if (this.__isSelectionMode) {
45553
+ this.__isSelectionMode = false;
45554
+ if (!this.j.isLockedNotBy(key)) {
45555
+ this.j.unlock();
45556
+ }
45557
+ const cells = this.__tableModule.getAllSelectedCells();
45558
+ // One let go outside the editor clicks outside it, which unmarks them
45559
+ if (cells.length > 1 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.j.editor, e.target)) {
45560
+ this.__keepMarks = true;
45561
+ this.__showCellsPopup(table, cells);
45562
+ }
45563
+ }
45564
+ this.__stopListening();
45565
+ }
45566
+ __showCellsPopup(table, cells) {
45567
+ const bound = this.__tableModule.getSelectedBound(table, cells), box = this.__tableModule.formalMatrix(table);
45164
45568
  const max = box[bound[1][0]]?.[bound[1][1]], min = box[bound[0][0]]?.[bound[0][1]];
45165
45569
  // `getSelectedBound` keeps its `Infinity` sentinel when none of the
45166
45570
  // selected cells belong to this table's matrix — e.g. after a
@@ -45180,10 +45584,16 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45180
45584
  height: maxOffset.top - minOffset.top + maxOffset.height
45181
45585
  };
45182
45586
  }, 'cells');
45183
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', this.j.editor).forEach((table)=>{
45587
+ }
45588
+ __stopListening() {
45589
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', this.j.editor).forEach((table)=>{
45184
45590
  this.j.e.off(table, 'mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells');
45185
45591
  });
45186
- this.j.async.clearTimeout(MOUSE_MOVE_LABEL);
45592
+ new Set([
45593
+ this.j.ew,
45594
+ this.j.ow
45595
+ ]).forEach((win)=>this.j.e.off(win, 'mouseup.select-cells touchend.select-cells'));
45596
+ this.__movedTo = null;
45187
45597
  }
45188
45598
  /**
45189
45599
  * Remove selection for all cells
@@ -45353,7 +45763,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45353
45763
  }
45354
45764
  /** @override */ beforeDestruct(jodit) {
45355
45765
  this.__onRemoveSelection();
45356
- jodit.e.off('.select-cells').off('keydown', this.__onKeyDown);
45766
+ this.__stopListening();
45767
+ jodit.e.off('.select-cells').off('keydown', this.__onKeyDown).off('clickEditor', this.__onClickAfterDrag);
45357
45768
  }
45358
45769
  constructor(...args){
45359
45770
  super(...args), /**
@@ -45364,7 +45775,12 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45364
45775
  * First selected cell
45365
45776
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__selectedCell", null), /**
45366
45777
  * User is selecting cells now
45367
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isSelectionMode", false);
45778
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isSelectionMode", false), /**
45779
+ * The cell the marks were last drawn to
45780
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__movedTo", null), /**
45781
+ * A drag let go outside the table ends in a click on the editor, which
45782
+ * would unmark its cells
45783
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__keepMarks", false);
45368
45784
  }
45369
45785
  }
45370
45786
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(selectCells, "requires", [
@@ -45382,6 +45798,15 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
45382
45798
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
45383
45799
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':outsideClick')
45384
45800
  ], selectCells.prototype, "onOutsideClick", null);
45801
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
45802
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
45803
+ ':mousedown',
45804
+ ':touchstart'
45805
+ ])
45806
+ ], selectCells.prototype, "onMouseDown", null);
45807
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
45808
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
45809
+ ], selectCells.prototype, "__onClickAfterDrag", null);
45385
45810
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
45386
45811
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':change')
45387
45812
  ], selectCells.prototype, "onChange", null);
@@ -45433,10 +45858,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45433
45858
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
45434
45859
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
45435
45860
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
45436
- /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(57821);
45437
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
45438
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4099);
45439
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(47670);
45861
+ /* harmony import */ var jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(88475);
45862
+ /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(57821);
45863
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(91206);
45864
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(4099);
45865
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(47670);
45440
45866
  /*!
45441
45867
  * Jodit Editor (https://xdsoft.net/jodit/)
45442
45868
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -45455,6 +45881,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45455
45881
 
45456
45882
 
45457
45883
 
45884
+
45458
45885
  /**
45459
45886
  * A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
45460
45887
  *
@@ -45465,22 +45892,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45465
45892
  * console.log(img.src);
45466
45893
  * })
45467
45894
  * ```
45468
- */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
45895
+ */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__.Plugin {
45469
45896
  afterInit(jodit) {
45470
45897
  this.proxyEventsList.forEach((eventName)=>{
45471
45898
  jodit.e.on(eventName + '.select', this.onStartSelection);
45472
45899
  });
45900
+ jodit.e.on('dblclick', this.__onDblClickBesideRow, {
45901
+ top: true
45902
+ });
45473
45903
  }
45474
45904
  beforeDestruct(jodit) {
45475
45905
  this.proxyEventsList.forEach((eventName)=>{
45476
- jodit.e.on(eventName + '.select', this.onStartSelection);
45906
+ jodit.e.off(eventName + '.select', this.onStartSelection);
45477
45907
  });
45908
+ this.__endPressBesideRow();
45909
+ jodit.e.off('dblclick', this.__onDblClickBesideRow);
45478
45910
  }
45479
45911
  onStartSelection(e) {
45480
45912
  const { j } = this;
45481
45913
  let result, target = e.target;
45482
45914
  while(result === undefined && target && target !== j.editor){
45483
- result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
45915
+ result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_7__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
45484
45916
  target = target.parentElement;
45485
45917
  }
45486
45918
  if (e.type === 'click' && result === undefined && target === j.editor) {
@@ -45500,10 +45932,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45500
45932
  }
45501
45933
  // Selecting the text of a popup input with the mouse and releasing
45502
45934
  // the button past the popup's edge is not a click outside of it.
45503
- if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup)) {
45935
+ if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup)) {
45504
45936
  return;
45505
45937
  }
45506
- const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup);
45938
+ const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup);
45507
45939
  if (!box) {
45508
45940
  this.j.e.fire('outsideClick', e);
45509
45941
  }
@@ -45549,6 +45981,125 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45549
45981
  s.setCursorAfter(text);
45550
45982
  }
45551
45983
  }
45984
+ /**
45985
+ * The table row the mouse is to the right of
45986
+ */ __rowBeside(e) {
45987
+ const { j } = this;
45988
+ const target = e.target;
45989
+ 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)) {
45990
+ return null;
45991
+ }
45992
+ const table = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(target.children).find((elm)=>{
45993
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(elm, 'table')) {
45994
+ return false;
45995
+ }
45996
+ const box = elm.getBoundingClientRect();
45997
+ return e.clientX >= box.right && e.clientY >= box.top && e.clientY < box.bottom;
45998
+ });
45999
+ const rows = table ? (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(table.rows).filter((row)=>row.cells.length) : [];
46000
+ if (!table || !rows.length) {
46001
+ return null;
46002
+ }
46003
+ const row = rows.find((row)=>e.clientY < row.getBoundingClientRect().bottom) ?? rows[rows.length - 1];
46004
+ return {
46005
+ table,
46006
+ row
46007
+ };
46008
+ }
46009
+ /**
46010
+ * A press to the right of a table row puts the caret where Word's typing
46011
+ * goes from there: the start of the next row's first cell, or of the block
46012
+ * after the table for the last row (#1770). The browsers put it after the
46013
+ * table, whichever row it's beside, so typing starts a new line below it.
46014
+ * Their own press is stopped, as its drag would start after the table and
46015
+ * take in the rows below first
46016
+ */ onMouseDownBesideTableRow(e) {
46017
+ const { j } = this;
46018
+ const beside = this.__rowBeside(e);
46019
+ if (!beside) {
46020
+ return;
46021
+ }
46022
+ // A press before the last one was let go must not stack its listeners
46023
+ this.__endPressBesideRow();
46024
+ e.preventDefault();
46025
+ this.__putCaretBesideRow(beside.table, beside.row);
46026
+ this.__pressBesideRow = {
46027
+ row: beside.row,
46028
+ caret: j.s.range.cloneRange()
46029
+ };
46030
+ j.e.on(j.ew, 'mousemove', this.__onDragFromRow);
46031
+ new Set([
46032
+ j.ew,
46033
+ j.ow
46034
+ ]).forEach((win)=>j.e.on(win, 'mouseup', this.__onReleaseFromRow));
46035
+ }
46036
+ /**
46037
+ * A drag from beside a row selects from the end of the row to the mouse,
46038
+ * and back beside the row it's the caret again
46039
+ */ __onDragFromRow(e) {
46040
+ const { s } = this.j;
46041
+ const press = this.__pressBesideRow;
46042
+ if (!press || !(e.buttons & 1)) {
46043
+ this.__endPressBesideRow();
46044
+ return;
46045
+ }
46046
+ if (this.__rowBeside(e)?.row === press.row) {
46047
+ if (!s.isCollapsed()) {
46048
+ s.selectRange(press.caret.cloneRange());
46049
+ }
46050
+ return;
46051
+ }
46052
+ const { cells } = press.row;
46053
+ const last = cells[cells.length - 1];
46054
+ if (s.insertCursorAtPoint(e.clientX, e.clientY)) {
46055
+ const { startContainer, startOffset } = s.range;
46056
+ s.sel?.setBaseAndExtent(last, last.childNodes.length, startContainer, startOffset);
46057
+ }
46058
+ }
46059
+ /**
46060
+ * In iframe mode, a press in an editor without the focus puts the caret at
46061
+ * its end, so a release that selected nothing puts it back
46062
+ */ __onReleaseFromRow() {
46063
+ const press = this.__pressBesideRow;
46064
+ this.__endPressBesideRow();
46065
+ if (press && this.j.s.isCollapsed()) {
46066
+ this.j.s.selectRange(press.caret);
46067
+ }
46068
+ }
46069
+ __endPressBesideRow() {
46070
+ const { j } = this;
46071
+ this.__pressBesideRow = null;
46072
+ j.e.off(j.ew, 'mousemove', this.__onDragFromRow);
46073
+ new Set([
46074
+ j.ew,
46075
+ j.ow
46076
+ ]).forEach((win)=>j.e.off(win, 'mouseup', this.__onReleaseFromRow));
46077
+ }
46078
+ /**
46079
+ * A double click beside a row is two clicks there, so add-new-line,
46080
+ * which adds a line on a double click with a caret, doesn't see it
46081
+ */ __onDblClickBesideRow(e) {
46082
+ if (this.__rowBeside(e)) {
46083
+ this.j.e.stopPropagation('dblclick');
46084
+ return false;
46085
+ }
46086
+ }
46087
+ __putCaretBesideRow(table, row) {
46088
+ const { j } = this;
46089
+ const rows = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(table.rows);
46090
+ const next = rows.slice(rows.indexOf(row) + 1).find((row)=>row.cells.length);
46091
+ let after = table.nextSibling;
46092
+ while(after && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(after)){
46093
+ after = after.nextSibling;
46094
+ }
46095
+ if (next) {
46096
+ j.s.setCursorIn(next.cells[0], true);
46097
+ } 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)) {
46098
+ j.s.setCursorIn(after, true);
46099
+ } else {
46100
+ j.s.setCursorAfter(table);
46101
+ }
46102
+ }
45552
46103
  /**
45553
46104
  * Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
45554
46105
  * a collapsed cursor leaves empty marker elements with the caret inside; a
@@ -45610,7 +46161,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45610
46161
  * Where the last press started. Chrome reports a drag that begins in one
45611
46162
  * element and ends in another as a `click` on their common ancestor, so a
45612
46163
  * press inside a popup is remembered to tell such a drag from a real click.
45613
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null);
46164
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null), /**
46165
+ * The row a press to its right was beside, and the caret it put there,
46166
+ * while the button is down
46167
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressBesideRow", null);
45614
46168
  }
45615
46169
  }
45616
46170
  ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
@@ -45640,6 +46194,18 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
45640
46194
  ':click'
45641
46195
  ])
45642
46196
  ], select.prototype, "onClickRightOfNestedListItem", null);
46197
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46198
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':mousedown')
46199
+ ], select.prototype, "onMouseDownBesideTableRow", null);
46200
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46201
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
46202
+ ], select.prototype, "__onDragFromRow", null);
46203
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46204
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
46205
+ ], select.prototype, "__onReleaseFromRow", null);
46206
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46207
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
46208
+ ], select.prototype, "__onDblClickBesideRow", null);
45643
46209
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
45644
46210
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
45645
46211
  ':click'