jodit 4.19.6 → 4.19.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +10 -10
  4. package/es2015/jodit.js +787 -200
  5. package/es2015/jodit.min.js +10 -10
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +10 -10
  13. package/es2018/jodit.min.js +10 -10
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +12 -12
  18. package/es2021/jodit.js +709 -143
  19. package/es2021/jodit.min.js +12 -12
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +18 -18
  28. package/es2021.en/jodit.js +709 -143
  29. package/es2021.en/jodit.min.js +18 -18
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +947 -208
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/core/constants.d.ts +1 -0
  51. package/esm/core/constants.js +3 -1
  52. package/esm/core/helpers/utils/error/error.d.ts +1 -0
  53. package/esm/core/helpers/utils/error/error.js +4 -1
  54. package/esm/core/helpers/utils/error/errors/answer-error.d.ts +13 -0
  55. package/esm/core/helpers/utils/error/errors/answer-error.js +17 -0
  56. package/esm/core/helpers/utils/error/errors/index.d.ts +1 -0
  57. package/esm/core/helpers/utils/error/errors/index.js +1 -0
  58. package/esm/core/request/ajax.d.ts +1 -0
  59. package/esm/core/request/ajax.js +20 -1
  60. package/esm/core/selection/style/apply-style.js +31 -2
  61. package/esm/jodit.js +14 -2
  62. package/esm/modules/file-browser/data-provider.js +5 -3
  63. package/esm/modules/uploader/config.js +4 -0
  64. package/esm/modules/uploader/helpers/send-files.d.ts +2 -2
  65. package/esm/modules/uploader/helpers/send-files.js +76 -9
  66. package/esm/modules/uploader/helpers/upload-error.d.ts +15 -0
  67. package/esm/modules/uploader/helpers/upload-error.js +16 -0
  68. package/esm/modules/uploader/uploader.js +15 -3
  69. package/esm/plugins/backspace/cases/check-join-neighbors.js +36 -7
  70. package/esm/plugins/backspace/cases/check-remove-empty-parent.js +3 -1
  71. package/esm/plugins/bold/bold.js +4 -1
  72. package/esm/plugins/delete/delete.d.ts +12 -0
  73. package/esm/plugins/delete/delete.js +50 -1
  74. package/esm/plugins/resize-cells/resize-cells.d.ts +25 -1
  75. package/esm/plugins/resize-cells/resize-cells.js +84 -15
  76. package/esm/plugins/select/select.d.ts +35 -0
  77. package/esm/plugins/select/select.js +153 -1
  78. package/esm/plugins/select-cells/select-cells.d.ts +24 -0
  79. package/esm/plugins/select-cells/select-cells.js +81 -18
  80. package/esm/types/style.d.ts +5 -0
  81. package/esm/types/uploader.d.ts +117 -11
  82. package/package.json +2 -2
  83. package/types/core/constants.d.ts +1 -0
  84. package/types/core/helpers/utils/error/error.d.ts +1 -0
  85. package/types/core/helpers/utils/error/errors/answer-error.d.ts +13 -0
  86. package/types/core/helpers/utils/error/errors/index.d.ts +1 -0
  87. package/types/core/request/ajax.d.ts +1 -0
  88. package/types/modules/uploader/helpers/send-files.d.ts +2 -2
  89. package/types/modules/uploader/helpers/upload-error.d.ts +15 -0
  90. package/types/plugins/delete/delete.d.ts +12 -0
  91. package/types/plugins/resize-cells/resize-cells.d.ts +25 -1
  92. package/types/plugins/select/select.d.ts +35 -0
  93. package/types/plugins/select-cells/select-cells.d.ts +24 -0
  94. package/types/types/style.d.ts +5 -0
  95. package/types/types/uploader.d.ts +117 -11
package/es2015/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.19.6
4
+ * Version: v4.19.8
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -1830,7 +1830,7 @@ __webpack_require__.r(__webpack_exports__);
1830
1830
  * ```
1831
1831
  * @packageDocumentation
1832
1832
  * @module constants
1833
- */ const APP_VERSION = "4.19.6";
1833
+ */ const APP_VERSION = "4.19.8";
1834
1834
  // prettier-ignore
1835
1835
  const ES = "es2015";
1836
1836
  const IS_ES_MODERN = true;
@@ -1969,6 +1969,8 @@ const EMULATE_DBLCLICK_TIMEOUT = 300;
1969
1969
  * ```
1970
1970
  */ const INSERT_ONLY_TEXT = 'insert_only_text';
1971
1971
  const SAFE_COUNT_CHANGE_CALL = 10;
1972
+ // Connector answer code for a file name that is already taken (same as the HTTP status)
1973
+ const ERROR_CODE_CONFLICT = 409;
1972
1974
  const IS_MAC = typeof globalWindow !== 'undefined' && /Mac|iPod|iPhone|iPad/.test(globalWindow.navigator.platform);
1973
1975
  const KEY_ALIASES = {
1974
1976
  add: '+',
@@ -2052,6 +2054,7 @@ const PASSIVE_EVENTS = new Set([
2052
2054
  /* harmony export */ "CLIPBOARD_ID", 0, /* binding */ CLIPBOARD_ID,
2053
2055
  /* harmony export */ "COMMAND_KEYS", 0, /* binding */ COMMAND_KEYS,
2054
2056
  /* harmony export */ "EMULATE_DBLCLICK_TIMEOUT", 0, /* binding */ EMULATE_DBLCLICK_TIMEOUT,
2057
+ /* harmony export */ "ERROR_CODE_CONFLICT", 0, /* binding */ ERROR_CODE_CONFLICT,
2055
2058
  /* harmony export */ "ES", 0, /* binding */ ES,
2056
2059
  /* harmony export */ "FAT_MODE", 0, /* binding */ FAT_MODE,
2057
2060
  /* harmony export */ "HOMEPAGE", 0, /* binding */ HOMEPAGE,
@@ -8777,6 +8780,7 @@ const dataBind = (elm, key, value)=>{
8777
8780
 
8778
8781
  "use strict";
8779
8782
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8783
+ /* harmony export */ answer: function() { return /* binding */ answer; },
8780
8784
  /* harmony export */ connection: function() { return /* binding */ connection; },
8781
8785
  /* harmony export */ error: function() { return /* binding */ error; },
8782
8786
  /* harmony export */ options: function() { return /* binding */ options; }
@@ -8800,6 +8804,9 @@ function connection(message) {
8800
8804
  function options(message) {
8801
8805
  return new _errors__WEBPACK_IMPORTED_MODULE_0__.OptionsError(message);
8802
8806
  }
8807
+ function answer(message, resp, code) {
8808
+ return new _errors__WEBPACK_IMPORTED_MODULE_0__.AnswerError(message, resp, code);
8809
+ }
8803
8810
 
8804
8811
 
8805
8812
  /***/ }),
@@ -8825,6 +8832,32 @@ function options(message) {
8825
8832
  }
8826
8833
 
8827
8834
 
8835
+ /***/ }),
8836
+
8837
+ /***/ 45052:
8838
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8839
+
8840
+ "use strict";
8841
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8842
+ /* harmony export */ AnswerError: function() { return /* binding */ AnswerError; }
8843
+ /* harmony export */ });
8844
+ /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
8845
+
8846
+ /*!
8847
+ * Jodit Editor (https://xdsoft.net/jodit/)
8848
+ * Released under MIT see LICENSE.txt in the project root for license information.
8849
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
8850
+ */ /**
8851
+ * @module helpers/utils
8852
+ */ // A connector refused the request: the answer and its `data.code` stay reachable for the handler
8853
+ class AnswerError extends Error {
8854
+ constructor(message, answer, code){
8855
+ 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;
8856
+ Object.setPrototypeOf(this, AnswerError.prototype);
8857
+ }
8858
+ }
8859
+
8860
+
8828
8861
  /***/ }),
8829
8862
 
8830
8863
  /***/ 58250:
@@ -8855,13 +8888,15 @@ function options(message) {
8855
8888
 
8856
8889
  "use strict";
8857
8890
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8858
- /* harmony export */ ConnectionError: function() { return /* reexport safe */ _connection_error__WEBPACK_IMPORTED_MODULE_1__.ConnectionError; },
8859
- /* harmony export */ OptionsError: function() { return /* reexport safe */ _options_error__WEBPACK_IMPORTED_MODULE_2__.OptionsError; },
8891
+ /* harmony export */ AnswerError: function() { return /* reexport safe */ _answer_error__WEBPACK_IMPORTED_MODULE_1__.AnswerError; },
8892
+ /* harmony export */ ConnectionError: function() { return /* reexport safe */ _connection_error__WEBPACK_IMPORTED_MODULE_2__.ConnectionError; },
8893
+ /* harmony export */ OptionsError: function() { return /* reexport safe */ _options_error__WEBPACK_IMPORTED_MODULE_3__.OptionsError; },
8860
8894
  /* harmony export */ abort: function() { return /* reexport safe */ _abort_error__WEBPACK_IMPORTED_MODULE_0__.abort; }
8861
8895
  /* harmony export */ });
8862
8896
  /* harmony import */ var _abort_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14228);
8863
- /* harmony import */ var _connection_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58250);
8864
- /* harmony import */ var _options_error__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11080);
8897
+ /* harmony import */ var _answer_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(45052);
8898
+ /* harmony import */ var _connection_error__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(58250);
8899
+ /* harmony import */ var _options_error__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11080);
8865
8900
  /*!
8866
8901
  * Jodit Editor (https://xdsoft.net/jodit/)
8867
8902
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -8873,6 +8908,7 @@ function options(message) {
8873
8908
 
8874
8909
 
8875
8910
 
8911
+
8876
8912
  /***/ }),
8877
8913
 
8878
8914
  /***/ 11080:
@@ -8903,9 +8939,11 @@ function options(message) {
8903
8939
 
8904
8940
  "use strict";
8905
8941
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8942
+ /* harmony export */ AnswerError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.AnswerError; },
8906
8943
  /* harmony export */ ConnectionError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.ConnectionError; },
8907
8944
  /* harmony export */ OptionsError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.OptionsError; },
8908
8945
  /* harmony export */ abort: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.abort; },
8946
+ /* harmony export */ answer: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.answer; },
8909
8947
  /* harmony export */ connection: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.connection; },
8910
8948
  /* harmony export */ error: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.error; },
8911
8949
  /* harmony export */ options: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.options; }
@@ -9149,6 +9187,7 @@ const isPart = (node, part)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom
9149
9187
  __webpack_require__.r(__webpack_exports__);
9150
9188
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9151
9189
  /* harmony export */ $$: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_27__.$$; },
9190
+ /* harmony export */ AnswerError: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.AnswerError; },
9152
9191
  /* harmony export */ ConfigDeepFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigDeepFlatten; },
9153
9192
  /* harmony export */ ConfigFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigFlatten; },
9154
9193
  /* harmony export */ ConfigMerge: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigMerge; },
@@ -9160,6 +9199,7 @@ __webpack_require__.r(__webpack_exports__);
9160
9199
  /* harmony export */ abort: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.abort; },
9161
9200
  /* harmony export */ alignElement: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.alignElement; },
9162
9201
  /* harmony export */ alreadyLoadedList: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.alreadyLoadedList; },
9202
+ /* harmony export */ answer: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.answer; },
9163
9203
  /* harmony export */ appendScriptAsync: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.appendScriptAsync; },
9164
9204
  /* harmony export */ appendStyleAsync: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.appendStyleAsync; },
9165
9205
  /* harmony export */ attr: function() { return /* reexport safe */ _attr__WEBPACK_IMPORTED_MODULE_3__.attr; },
@@ -10757,6 +10797,23 @@ class Ajax {
10757
10797
  } catch (unused) {}
10758
10798
  return this;
10759
10799
  }
10800
+ // 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
10801
+ __hasAnswerEnvelope() {
10802
+ const { xhr } = this;
10803
+ if (xhr.responseType && xhr.responseType !== 'text') {
10804
+ return false;
10805
+ }
10806
+ const text = xhr.responseText;
10807
+ if (!text || text[0] !== '{') {
10808
+ return false;
10809
+ }
10810
+ try {
10811
+ const answer = JSON.parse(text);
10812
+ return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_9__.isPlainObject)(answer) && 'success' in answer;
10813
+ } catch (unused) {
10814
+ return false;
10815
+ }
10816
+ }
10760
10817
  send() {
10761
10818
  this.__activated = true;
10762
10819
  const { xhr, o } = this;
@@ -10793,7 +10850,7 @@ class Ajax {
10793
10850
  var _this_options_onProgress, _this_options;
10794
10851
  (_this_options_onProgress = (_this_options = this.options).onProgress) === null || _this_options_onProgress === void 0 ? void 0 : _this_options_onProgress.call(_this_options, 10);
10795
10852
  if (xhr.readyState === XMLHttpRequest.DONE) {
10796
- if (o.successStatuses.includes(xhr.status)) {
10853
+ if (o.successStatuses.includes(xhr.status) || this.__hasAnswerEnvelope()) {
10797
10854
  onResolve();
10798
10855
  } else if (xhr.statusText) {
10799
10856
  this.__isFulfilled = true;
@@ -13954,9 +14011,11 @@ const WRAP_NODES = new Set([
13954
14011
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13955
14012
  /* harmony export */ ApplyStyle: function() { return /* binding */ ApplyStyle; }
13956
14013
  /* harmony export */ });
13957
- /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51640);
13958
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(98394);
13959
- /* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(78462);
14014
+ /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23211);
14015
+ /* harmony import */ var jodit_core_helpers_utils_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28723);
14016
+ /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(51640);
14017
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(98394);
14018
+ /* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(78462);
13960
14019
  /*!
13961
14020
  * Jodit Editor (https://xdsoft.net/jodit/)
13962
14021
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -13966,27 +14025,56 @@ const WRAP_NODES = new Set([
13966
14025
  */
13967
14026
 
13968
14027
 
14028
+
14029
+
14030
+ /**
14031
+ * Take a selected fragment out of the elements its style takes the place
14032
+ * of: one around it is split, so the fragment leaves it, and one in it is
14033
+ * unwrapped
14034
+ */ function takeOutOf(jodit, font, tags) {
14035
+ const range = jodit.s.createRange();
14036
+ let outer = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(font.parentNode, tags, jodit.editor);
14037
+ while(outer){
14038
+ range.selectNodeContents(outer);
14039
+ range.setEndBefore(font);
14040
+ const before = range.cloneContents();
14041
+ range.selectNodeContents(outer);
14042
+ range.setStartAfter(font);
14043
+ // Split only when there's more in it, as a split leaves empty copies
14044
+ // of the elements between
14045
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(before) || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isEmpty(range.cloneContents())) {
14046
+ (0,_api__WEBPACK_IMPORTED_MODULE_2__.extractSelectedPart)(outer, font, jodit);
14047
+ }
14048
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.unwrap(outer);
14049
+ outer = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(font.parentNode, tags, jodit.editor);
14050
+ }
14051
+ ;(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));
14052
+ }
13969
14053
  /** @internal */ function ApplyStyle(jodit, cs) {
13970
14054
  var _editor_firstChild;
13971
14055
  const { s: sel, editor } = jodit;
13972
14056
  (_editor_firstChild = editor.firstChild) === null || _editor_firstChild === void 0 ? void 0 : _editor_firstChild.normalize(); // FF fix for test "commandsTest - Exec command "bold"
13973
14057
  const fakes = sel.fakes();
13974
14058
  const collapsed = sel.isCollapsed();
13975
- let mode = _constants__WEBPACK_IMPORTED_MODULE_1__.INITIAL;
14059
+ let mode = _constants__WEBPACK_IMPORTED_MODULE_3__.INITIAL;
13976
14060
  try {
13977
14061
  // for...of closes the generator on an exception, releasing every
13978
14062
  // temporary wrapper before the selection is restored in finally.
13979
14063
  for (const font of sel.wrapInTagGen(fakes)){
14064
+ var _cs_options_exclude;
14065
+ if ((_cs_options_exclude = cs.options.exclude) === null || _cs_options_exclude === void 0 ? void 0 : _cs_options_exclude.length) {
14066
+ takeOutOf(jodit, font, cs.options.exclude);
14067
+ }
13980
14068
  let state = {
13981
14069
  collapsed,
13982
14070
  mode,
13983
14071
  element: font,
13984
- next: _transactions__WEBPACK_IMPORTED_MODULE_2__.states.START,
14072
+ next: _transactions__WEBPACK_IMPORTED_MODULE_4__.states.START,
13985
14073
  jodit,
13986
14074
  style: cs
13987
14075
  };
13988
- const machine = new _api__WEBPACK_IMPORTED_MODULE_0__.FiniteStateMachine(_transactions__WEBPACK_IMPORTED_MODULE_2__.states.START, _transactions__WEBPACK_IMPORTED_MODULE_2__.transactions);
13989
- while(!jodit.isInDestruct && machine.getState() !== _transactions__WEBPACK_IMPORTED_MODULE_2__.states.END){
14076
+ const machine = new _api__WEBPACK_IMPORTED_MODULE_2__.FiniteStateMachine(_transactions__WEBPACK_IMPORTED_MODULE_4__.states.START, _transactions__WEBPACK_IMPORTED_MODULE_4__.transactions);
14077
+ while(!jodit.isInDestruct && machine.getState() !== _transactions__WEBPACK_IMPORTED_MODULE_4__.states.END){
13990
14078
  state = machine.dispatch('exec', state);
13991
14079
  }
13992
14080
  // The first selected fragment determines how later fragments toggle.
@@ -18514,6 +18602,20 @@ const FOCUS_EVENTS = new Set([
18514
18602
  'focusin',
18515
18603
  'focusout'
18516
18604
  ]);
18605
+ const EDITING_KEYS = new Set([
18606
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_ENTER,
18607
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_BACKSPACE,
18608
+ jodit_core_constants__WEBPACK_IMPORTED_MODULE_3__.KEY_DELETE
18609
+ ]);
18610
+ /**
18611
+ * Whether the input method (IME) is using the key. Safari fires the keydown
18612
+ * that ends a composition, as the Enter that confirms Japanese text, after
18613
+ * `compositionend`, and types Korean without one, so `isComposing` is false and
18614
+ * only keyCode 229 tells. Only the keys the editor turns into edits are held
18615
+ * back: the handlers that follow typing still see the rest.
18616
+ */ function isInputMethodKey(event) {
18617
+ return event.isComposing || event.keyCode === 229 && EDITING_KEYS.has(event.key);
18618
+ }
18517
18619
  const __defaultStyleDisplayKey = 'data-jodit-default-style-display';
18518
18620
  const __defaultClassesKey = 'data-jodit-default-classes';
18519
18621
  const NOEDIT = {
@@ -19572,7 +19674,7 @@ class Jodit extends jodit_modules__WEBPACK_IMPORTED_MODULE_11__.ViewWithToolbar
19572
19674
  }
19573
19675
  }
19574
19676
  const w = this.ew;
19575
- if (event instanceof w.KeyboardEvent && event.isComposing) {
19677
+ if (event instanceof w.KeyboardEvent && isInputMethodKey(event)) {
19576
19678
  return;
19577
19679
  }
19578
19680
  if (this.e && this.e.fire) {
@@ -21722,7 +21824,8 @@ class DataProvider {
21722
21824
  }).catch(()=>null);
21723
21825
  return promise.then((resp)=>resp.json()).then((resp)=>{
21724
21826
  if (resp && !this.isSuccess(resp)) {
21725
- throw new Error(this.getMessage(resp));
21827
+ var _resp_data;
21828
+ throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_12__.answer)(this.getMessage(resp), resp, (_resp_data = resp.data) === null || _resp_data === void 0 ? void 0 : _resp_data.code);
21726
21829
  }
21727
21830
  return resp;
21728
21831
  });
@@ -21861,10 +21964,11 @@ class DataProvider {
21861
21964
  */ getPathByUrl(url) {
21862
21965
  ;(0,jodit_core_helpers_utils_set__WEBPACK_IMPORTED_MODULE_13__.set)('options.getLocalFileByUrl.data.url', url, this);
21863
21966
  return this.get('getLocalFileByUrl').then((resp)=>{
21967
+ var _resp_data;
21864
21968
  if (this.isSuccess(resp)) {
21865
21969
  return resp.data;
21866
21970
  }
21867
- throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_12__.error)(this.getMessage(resp));
21971
+ throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_12__.answer)(this.getMessage(resp), resp, (_resp_data = resp.data) === null || _resp_data === void 0 ? void 0 : _resp_data.code);
21868
21972
  });
21869
21973
  }
21870
21974
  /**
@@ -26741,6 +26845,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.uploader = {
26741
26845
  defaultHandlerError (e) {
26742
26846
  this.j.message.error(e.message);
26743
26847
  },
26848
+ promptOnExists: true,
26849
+ promptOnExistsSuggestName (name) {
26850
+ return name;
26851
+ },
26744
26852
  contentType (requestData) {
26745
26853
  return this.ow.FormData !== undefined && typeof requestData !== 'string' ? false : 'application/x-www-form-urlencoded; charset=UTF-8';
26746
26854
  }
@@ -26919,8 +27027,14 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26919
27027
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
26920
27028
  /* harmony export */ sendFiles: function() { return /* binding */ sendFiles; }
26921
27029
  /* harmony export */ });
26922
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(65946);
26923
- /* harmony import */ var jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(77911);
27030
+ /* harmony import */ var _swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(49376);
27031
+ /* harmony import */ var _swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41411);
27032
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
27033
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65946);
27034
+ /* harmony import */ var jodit_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(80512);
27035
+ /* harmony import */ var jodit_modules_dialog_prompt__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(74103);
27036
+ /* harmony import */ var jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(77911);
27037
+ /* harmony import */ var jodit_modules_uploader_helpers_upload_error__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(55083);
26924
27038
  /*!
26925
27039
  * Jodit Editor (https://xdsoft.net/jodit/)
26926
27040
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -26929,83 +27043,163 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26929
27043
  * @module modules/uploader
26930
27044
  */
26931
27045
 
27046
+
27047
+
27048
+
27049
+
27050
+
27051
+
26932
27052
  /**
26933
27053
  * Send files to server
26934
- */ function sendFiles(uploader, files, handlerSuccess, handlerError, process) {
26935
- if (!files) {
26936
- return Promise.reject((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Need files'));
26937
- }
26938
- const { o } = uploader;
26939
- let fileList = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.toArray)(files);
26940
- if (!fileList.length) {
26941
- return Promise.reject((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Need files'));
26942
- }
26943
- // Client-side validation hook — returning `false` aborts the upload.
26944
- // See https://github.com/xdan/jodit/issues/1329
26945
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(o.beforeUpload)) {
26946
- if (o.beforeUpload.call(uploader, fileList) === false) {
26947
- const err = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Upload canceled');
26948
- (handlerError || o.defaultHandlerError).call(uploader, err);
26949
- return Promise.reject(err);
26950
- }
26951
- }
26952
- const promises = [];
26953
- if (o.insertImageAsBase64URI) {
26954
- readImagesWithReader(fileList, o.imagesExtensions, promises, uploader, handlerSuccess, o.defaultHandlerSuccess);
26955
- }
26956
- fileList = fileList.filter((a)=>a);
26957
- if (fileList.length) {
26958
- const form = new FormData();
26959
- form.append(o.pathVariableName, uploader.path);
26960
- form.append('source', uploader.source);
26961
- let file;
26962
- for(let i = 0; i < fileList.length; i += 1){
26963
- file = fileList[i];
26964
- if (file) {
26965
- const hasRealExtension = /\.\w+$/.test(file.name);
26966
- const mime = file.type.match(/\/([a-z0-9]+)/i);
26967
- const extension = mime && mime[1] ? mime[1].toLowerCase() : '';
26968
- let newName = fileList[i].name || Math.random().toString().replace('.', '');
26969
- if (!hasRealExtension && extension) {
26970
- let extForReg = extension;
26971
- if ([
26972
- 'jpeg',
26973
- 'jpg'
26974
- ].includes(extForReg)) {
26975
- extForReg = 'jpeg|jpg';
26976
- }
26977
- const reEnd = new RegExp('.(' + extForReg + ')$', 'i');
26978
- if (!reEnd.test(newName)) {
26979
- newName += '.' + extension;
27054
+ */ function sendFiles(uploader, files, handlerSuccess, handlerError, process, // Set when a refused upload is sent again: `beforeUpload` already had its say
27055
+ retryOf) {
27056
+ return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function*() {
27057
+ if (!files) {
27058
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.error)('Need files');
27059
+ }
27060
+ const { o } = uploader;
27061
+ let fileList = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.toArray)(files);
27062
+ if (!fileList.length) {
27063
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.error)('Need files');
27064
+ }
27065
+ let extraData = retryOf === null || retryOf === void 0 ? void 0 : retryOf.data;
27066
+ // Client-side validation hook — returning `false` aborts the upload, and it may hand back the files to send instead
27067
+ // See https://github.com/xdan/jodit/issues/1329
27068
+ if (!retryOf && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isFunction)(o.beforeUpload)) {
27069
+ let plan;
27070
+ try {
27071
+ plan = yield o.beforeUpload.call(uploader, fileList);
27072
+ } catch (e) {
27073
+ (handlerError || o.defaultHandlerError).call(uploader, e);
27074
+ throw e;
27075
+ }
27076
+ if (plan === false) {
27077
+ const err = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.error)('Upload canceled');
27078
+ (handlerError || o.defaultHandlerError).call(uploader, err);
27079
+ throw err;
27080
+ }
27081
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isArray)(plan)) {
27082
+ fileList = plan;
27083
+ } else if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isPlainObject)(plan) && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isArray)(plan.files)) {
27084
+ fileList = plan.files;
27085
+ extraData = plan.data;
27086
+ }
27087
+ if (!fileList.length) {
27088
+ return [];
27089
+ }
27090
+ }
27091
+ const promises = [];
27092
+ if (o.insertImageAsBase64URI) {
27093
+ readImagesWithReader(fileList, o.imagesExtensions, promises, uploader, handlerSuccess, o.defaultHandlerSuccess);
27094
+ }
27095
+ fileList = fileList.filter((a)=>a);
27096
+ if (fileList.length) {
27097
+ const form = new FormData();
27098
+ form.append(o.pathVariableName, uploader.path);
27099
+ form.append('source', uploader.source);
27100
+ let file;
27101
+ for(let i = 0; i < fileList.length; i += 1){
27102
+ file = fileList[i];
27103
+ if (file) {
27104
+ const hasRealExtension = /\.\w+$/.test(file.name);
27105
+ const mime = file.type.match(/\/([a-z0-9]+)/i);
27106
+ const extension = mime && mime[1] ? mime[1].toLowerCase() : '';
27107
+ let newName = fileList[i].name || Math.random().toString().replace('.', '');
27108
+ if (!hasRealExtension && extension) {
27109
+ let extForReg = extension;
27110
+ if ([
27111
+ 'jpeg',
27112
+ 'jpg'
27113
+ ].includes(extForReg)) {
27114
+ extForReg = 'jpeg|jpg';
27115
+ }
27116
+ const reEnd = new RegExp('.(' + extForReg + ')$', 'i');
27117
+ if (!reEnd.test(newName)) {
27118
+ newName += '.' + extension;
27119
+ }
26980
27120
  }
27121
+ const [key, iFile, name] = o.processFileName.call(uploader, o.filesVariableName(i), fileList[i], newName);
27122
+ form.append(key, iFile, name);
26981
27123
  }
26982
- const [key, iFile, name] = o.processFileName.call(uploader, o.filesVariableName(i), fileList[i], newName);
26983
- form.append(key, iFile, name);
26984
27124
  }
26985
- }
26986
- if (process) {
26987
- process(form);
26988
- }
26989
- if (o.data && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isPlainObject)(o.data)) {
26990
- Object.keys(o.data).forEach((key)=>{
26991
- form.append(key, o.data[key]);
26992
- });
26993
- }
26994
- o.prepareData.call(uploader, form);
26995
- promises.push((0,jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_1__.send)(uploader, form).then((resp)=>{
26996
- if (o.isSuccess.call(uploader, resp)) {
26997
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
26998
- handler.call(uploader, o.process.call(uploader, resp));
27125
+ if (process) {
27126
+ process(form);
27127
+ }
27128
+ if (o.data && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isPlainObject)(o.data)) {
27129
+ Object.keys(o.data).forEach((key)=>{
27130
+ form.append(key, o.data[key]);
27131
+ });
27132
+ }
27133
+ if (extraData) {
27134
+ Object.keys(extraData).forEach((key)=>{
27135
+ form.append(key, extraData[key]);
27136
+ });
27137
+ }
27138
+ o.prepareData.call(uploader, form);
27139
+ promises.push((0,jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_6__.send)(uploader, form).then((resp)=>{
27140
+ if (o.isSuccess.call(uploader, resp)) {
27141
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
27142
+ handler.call(uploader, o.process.call(uploader, resp));
27143
+ return resp;
27144
+ }
27145
+ const err = new jodit_modules_uploader_helpers_upload_error__WEBPACK_IMPORTED_MODULE_7__.UploadError(o.getMessage.call(uploader, resp), resp, fileList, (plan)=>{
27146
+ var _ref;
27147
+ return sendFiles(uploader, (_ref = plan === null || plan === void 0 ? void 0 : plan.files) !== null && _ref !== void 0 ? _ref : fileList, handlerSuccess, handlerError, process, {
27148
+ data: (0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_1__._)({}, extraData, plan === null || plan === void 0 ? void 0 : plan.data)
27149
+ });
27150
+ });
27151
+ // A taken name is part of the upload, not a failure: ask for another one first
27152
+ if (err.code === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.ERROR_CODE_CONFLICT && o.promptOnExists) {
27153
+ return askAnotherName(uploader, err);
27154
+ }
27155
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
27156
+ handler.call(uploader, err);
26999
27157
  return resp;
27158
+ }).then(()=>{
27159
+ uploader.j.events && uploader.j.e.fire('filesWereUploaded');
27160
+ }));
27161
+ }
27162
+ return Promise.all(promises);
27163
+ })();
27164
+ }
27165
+ function askAnotherName(uploader, err) {
27166
+ const { files } = err;
27167
+ // A batch is refused as a whole (the connector saved nothing) and the answer does not say which name is taken,
27168
+ // so the files go again one by one: the free ones are simply stored, the taken one answers 409 alone and gets its prompt
27169
+ if (files.length > 1) {
27170
+ return files.reduce((chain, file)=>chain.then(()=>err.retry({
27171
+ files: [
27172
+ file
27173
+ ]
27174
+ })), Promise.resolve());
27175
+ }
27176
+ const [file] = files;
27177
+ const { j, o } = uploader;
27178
+ return new Promise((resolve)=>{
27179
+ let answered = false;
27180
+ // `Dlgs.prototype.dlg`: the uploader's view does not always carry the Dlgs trait
27181
+ const dialog = jodit_modules_dialog_prompt__WEBPACK_IMPORTED_MODULE_5__.Prompt.call(jodit_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_4__.Dlgs.prototype.dlg.call(j, {
27182
+ closeOnClickOverlay: true
27183
+ }), j.i18n(err.message), j.i18n('Rename'), (newName)=>{
27184
+ newName = newName.trim();
27185
+ if (!newName) {
27186
+ return false;
27000
27187
  }
27001
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
27002
- handler.call(uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)(o.getMessage.call(uploader, resp)));
27003
- return resp;
27004
- }).then(()=>{
27005
- uploader.j.events && uploader.j.e.fire('filesWereUploaded');
27006
- }));
27007
- }
27008
- return Promise.all(promises);
27188
+ answered = true;
27189
+ resolve(err.retry({
27190
+ files: [
27191
+ new File([
27192
+ file
27193
+ ], newName, {
27194
+ type: file.type
27195
+ })
27196
+ ]
27197
+ }));
27198
+ }, j.i18n('Enter new name'), o.promptOnExistsSuggestName.call(uploader, file.name));
27199
+ dialog.e.on(dialog, 'afterClose', ()=>{
27200
+ !answered && resolve(undefined);
27201
+ });
27202
+ });
27009
27203
  }
27010
27204
  function readImagesWithReader(fileList, imagesExtensions, promises, uploader, handlerSuccess, defaultHandlerSuccess) {
27011
27205
  const readerPromises = [];
@@ -27035,7 +27229,7 @@ function readImagesWithReader(fileList, imagesExtensions, promises, uploader, ha
27035
27229
  name
27036
27230
  ]
27037
27231
  };
27038
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerSuccess) ? handlerSuccess : defaultHandlerSuccess;
27232
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isFunction)(handlerSuccess) ? handlerSuccess : defaultHandlerSuccess;
27039
27233
  handler.call(uploader, resp);
27040
27234
  resolve(resp);
27041
27235
  };
@@ -27151,6 +27345,35 @@ function send(uploader, data) {
27151
27345
  /* harmony export */ ]);
27152
27346
 
27153
27347
 
27348
+ /***/ }),
27349
+
27350
+ /***/ 55083:
27351
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
27352
+
27353
+ "use strict";
27354
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
27355
+ /* harmony export */ UploadError: function() { return /* binding */ UploadError; }
27356
+ /* harmony export */ });
27357
+ /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
27358
+ /* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33201);
27359
+ /*!
27360
+ * Jodit Editor (https://xdsoft.net/jodit/)
27361
+ * Released under MIT see LICENSE.txt in the project root for license information.
27362
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
27363
+ */ /**
27364
+ * @module modules/uploader
27365
+ */
27366
+
27367
+ // The connector refused these files: the handler can change the request and send it again
27368
+ class UploadError extends jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__.AnswerError {
27369
+ constructor(message, answer, files, retry){
27370
+ var _answer_data;
27371
+ super(message, answer, (_answer_data = answer.data) === null || _answer_data === void 0 ? void 0 : _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;
27372
+ Object.setPrototypeOf(this, UploadError.prototype);
27373
+ }
27374
+ }
27375
+
27376
+
27154
27377
  /***/ }),
27155
27378
 
27156
27379
  /***/ 94925:
@@ -27165,9 +27388,10 @@ function send(uploader, data) {
27165
27388
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
27166
27389
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23211);
27167
27390
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
27168
- /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5266);
27169
- /* harmony import */ var jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(11981);
27170
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(40013);
27391
+ /* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(33201);
27392
+ /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5266);
27393
+ /* harmony import */ var jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11981);
27394
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(40013);
27171
27395
  /*!
27172
27396
  * Jodit Editor (https://xdsoft.net/jodit/)
27173
27397
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -27185,6 +27409,7 @@ function send(uploader, data) {
27185
27409
 
27186
27410
 
27187
27411
 
27412
+
27188
27413
  class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewComponent {
27189
27414
  get j() {
27190
27415
  return this.jodit;
@@ -27240,14 +27465,14 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27240
27465
  }
27241
27466
  };
27242
27467
  // send data on server
27243
- if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(cData)) {
27244
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, cData.files, handlerSuccess, handlerError).finally(onFinally);
27468
+ if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(cData)) {
27469
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, cData.files, handlerSuccess, handlerError).finally(onFinally);
27245
27470
  return false;
27246
27471
  }
27247
27472
  if (jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && !jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_ES_NEXT) {
27248
- return (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.processOldBrowserDrag)(self, cData, handlerSuccess, handlerError, onFinally);
27473
+ return (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.processOldBrowserDrag)(self, cData, handlerSuccess, handlerError, onFinally);
27249
27474
  }
27250
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasItems)(cData)) {
27475
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasItems)(cData)) {
27251
27476
  const { items } = cData;
27252
27477
  for(i = 0; i < items.length; i += 1){
27253
27478
  if (items[i].kind === 'file' && items[i].type === 'image/png') {
@@ -27255,7 +27480,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27255
27480
  if (file) {
27256
27481
  const mime = file.type.match(/\/([a-z0-9]+)/i);
27257
27482
  extension = mime[1] ? mime[1].toLowerCase() : '';
27258
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, [
27483
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, [
27259
27484
  file
27260
27485
  ], handlerSuccess, handlerError, processData).finally(onFinally);
27261
27486
  }
@@ -27277,21 +27502,21 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27277
27502
  self.j.e.on(form, 'dragend dragover dragenter dragleave drop', (e)=>{
27278
27503
  e.preventDefault();
27279
27504
  }).on(form, 'dragover', (event)=>{
27280
- 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)) {
27505
+ 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)) {
27281
27506
  form.classList.add('jodit_drag_hover');
27282
27507
  event.preventDefault();
27283
27508
  }
27284
27509
  }).on(form, 'dragend dragleave', (event)=>{
27285
27510
  form.classList.remove('jodit_drag_hover');
27286
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(event.dataTransfer)) {
27511
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
27287
27512
  event.preventDefault();
27288
27513
  }
27289
27514
  }).on(form, 'drop', (event)=>{
27290
27515
  form.classList.remove('jodit_drag_hover');
27291
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(event.dataTransfer)) {
27516
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
27292
27517
  event.preventDefault();
27293
27518
  event.stopImmediatePropagation();
27294
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, event.dataTransfer.files, handlerSuccess, handlerError).finally(onFinally);
27519
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, event.dataTransfer.files, handlerSuccess, handlerError).finally(onFinally);
27295
27520
  }
27296
27521
  });
27297
27522
  const inputFile = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.first(form, (node)=>{
@@ -27300,7 +27525,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27300
27525
  });
27301
27526
  if (inputFile) {
27302
27527
  self.j.e.on(inputFile, 'change', ()=>{
27303
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, inputFile.files, handlerSuccess, handlerError).then(()=>{
27528
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, inputFile.files, handlerSuccess, handlerError).then(()=>{
27304
27529
  inputFile.value = '';
27305
27530
  if (!/safari/i.test(navigator.userAgent)) {
27306
27531
  inputFile.type = '';
@@ -27315,26 +27540,41 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27315
27540
  */ uploadRemoteImage(url, handlerSuccess, handlerError) {
27316
27541
  const uploader = this, { o } = uploader;
27317
27542
  const handlerE = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
27318
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.send)(uploader, {
27543
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.send)(uploader, {
27319
27544
  action: 'fileUploadRemote',
27320
27545
  url
27321
27546
  }).then((resp)=>{
27547
+ var _resp_data;
27322
27548
  if (o.isSuccess.call(uploader, resp)) {
27323
27549
  const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
27324
27550
  handler.call(uploader, o.process.call(uploader, resp));
27325
27551
  return;
27326
27552
  }
27327
- handlerE.call(uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.error)(o.getMessage.call(uploader, resp)));
27553
+ handlerE.call(uploader, (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__.answer)(o.getMessage.call(uploader, resp), resp, (_resp_data = resp.data) === null || _resp_data === void 0 ? void 0 : _resp_data.code));
27328
27554
  }).catch((e)=>handlerE.call(uploader, e));
27329
27555
  }
27330
27556
  upload(files) {
27331
27557
  return this.async.promise((resolve, reject)=>{
27332
- ;(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(this, files, resolve, reject);
27558
+ let settled = false;
27559
+ const settle = (end)=>(value)=>{
27560
+ settled = true;
27561
+ end(value);
27562
+ };
27563
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(this, files, settle(resolve), settle(reject)).then(()=>{
27564
+ // `beforeUpload` kept no file, so no handler ran
27565
+ if (!settled) {
27566
+ resolve({
27567
+ baseurl: '',
27568
+ files: [],
27569
+ isImages: []
27570
+ });
27571
+ }
27572
+ }, settle(reject));
27333
27573
  });
27334
27574
  }
27335
27575
  destruct() {
27336
27576
  this.setStatus(jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.STATUSES.beforeDestruct);
27337
- const instances = jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.ajaxInstances.get(this);
27577
+ const instances = jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.ajaxInstances.get(this);
27338
27578
  if (instances) {
27339
27579
  instances.forEach((ajax)=>{
27340
27580
  try {
@@ -27347,7 +27587,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27347
27587
  }
27348
27588
  constructor(editor, options){
27349
27589
  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);
27350
- 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 : {}));
27590
+ 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 : {}));
27351
27591
  }
27352
27592
  }
27353
27593
 
@@ -28895,6 +29135,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
28895
29135
  if (checkJoinBareText(jodit, fakeNode, backspace)) {
28896
29136
  return true;
28897
29137
  }
29138
+ // Old content can have an inline element round blocks beside the text:
29139
+ // moved inside them, the line joins the block as it would bare text
29140
+ // (#1781)
29141
+ const inline = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
29142
+ if (joinsBareText(jodit, edgeBlock(inline, backspace)) && moveInlineInside(inline, jodit.editor)) {
29143
+ return joinNeighbors(jodit, fakeNode, backspace, moved);
29144
+ }
28898
29145
  let nextBox = fakeNode, mainClosestBox = nextBox;
28899
29146
  // Find the main big closest element
28900
29147
  while(nextBox && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(nextBox, backspace) && nextBox.parentElement !== jodit.editor){
@@ -29175,7 +29422,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
29175
29422
  * in `<div>a|<p>b</p>c</div>` gives `<div>a|b<br>c</div>`
29176
29423
  */ function checkJoinBareText(jodit, fakeNode, backspace) {
29177
29424
  const block = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptySibling(fakeNode, backspace);
29178
- 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))) {
29425
+ if (!joinsBareText(jodit, block)) {
29179
29426
  return false;
29180
29427
  }
29181
29428
  const filter = (0,jodit_plugins_backspace_helpers__WEBPACK_IMPORTED_MODULE_2__.getMoveFilter)(jodit);
@@ -29202,6 +29449,24 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('backspace', bac
29202
29449
  jodit.s.setCursorBefore(fakeNode);
29203
29450
  return true;
29204
29451
  }
29452
+ /**
29453
+ * Whether a block joins the bare text beside it: not a list, a table or a
29454
+ * cell, and holding no block of its own
29455
+ */ function joinsBareText(jodit, block) {
29456
+ 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));
29457
+ }
29458
+ /**
29459
+ * The block an inline element holds on its side facing the caret, through
29460
+ * the inline elements in it: the `<p>` of `<span><strong><p>…</p></strong></span>`
29461
+ */ function edgeBlock(node, backspace) {
29462
+ let edge = node;
29463
+ while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(edge) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(edge)){
29464
+ var _ref;
29465
+ const children = Array.from(edge.childNodes).filter((child)=>!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(child));
29466
+ edge = (_ref = backspace ? children[children.length - 1] : children[0]) !== null && _ref !== void 0 ? _ref : null;
29467
+ }
29468
+ return edge === node ? null : edge;
29469
+ }
29205
29470
  function checkMoveListContent(jodit, mainClosestBox, sibling, backspace) {
29206
29471
  // Process UL/LI/OL cases
29207
29472
  const siblingIsList = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.LIST_TAGS);
@@ -29653,7 +29918,6 @@ function isNotEditable(jodit, node) {
29653
29918
  if (!prn || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn)) {
29654
29919
  return false;
29655
29920
  }
29656
- const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
29657
29921
  do {
29658
29922
  if (prn && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(prn) && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell(prn)) {
29659
29923
  jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(prn, fakeNode);
@@ -29668,6 +29932,9 @@ function isNotEditable(jodit, node) {
29668
29932
  if (found && (0,_check_join_two_lists__WEBPACK_IMPORTED_MODULE_2__.checkJoinTwoLists)(jodit, fakeNode, backspace)) {
29669
29933
  return true;
29670
29934
  }
29935
+ // Looked for once the empty elements have gone, as the one beside the
29936
+ // caret can be in them: the `<br>` that Delete in `<p>|<br></p>` leaves
29937
+ const neighbor = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findNotEmptyNeighbor(fakeNode, backspace, jodit.editor);
29671
29938
  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)) {
29672
29939
  setCursorIn(neighbor, !backspace);
29673
29940
  } else {
@@ -30134,8 +30401,15 @@ jodit_config__WEBPACK_IMPORTED_MODULE_1__.Config.prototype.delete = {
30134
30401
  }
30135
30402
  cssRules[key] = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_2__.isArray)(cssOptions[key]) ? cssOptions[key][0] : cssOptions[key];
30136
30403
  });
30404
+ const element = control.tags ? control.tags[0] : undefined;
30137
30405
  editor.s.commitStyle({
30138
- element: control.tags ? control.tags[0] : undefined
30406
+ element,
30407
+ // As in the browsers and Word, each takes the other's place
30408
+ exclude: element === 'sub' ? [
30409
+ 'sup'
30410
+ ] : element === 'sup' ? [
30411
+ 'sub'
30412
+ ] : []
30139
30413
  });
30140
30414
  editor.synchronizeValues();
30141
30415
  return false;
@@ -32711,11 +32985,12 @@ __webpack_require__.r(__webpack_exports__);
32711
32985
  "use strict";
32712
32986
  /* unused harmony export deleteCommand */
32713
32987
  /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
32714
- /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(27795);
32715
- /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28077);
32716
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65946);
32717
- /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4040);
32718
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(91206);
32988
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(81937);
32989
+ /* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(27795);
32990
+ /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(28077);
32991
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
32992
+ /* harmony import */ var jodit_core_helpers_string_trim__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4040);
32993
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91206);
32719
32994
  /*!
32720
32995
  * Jodit Editor (https://xdsoft.net/jodit/)
32721
32996
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -32731,6 +33006,7 @@ __webpack_require__.r(__webpack_exports__);
32731
33006
 
32732
33007
 
32733
33008
 
33009
+
32734
33010
  const NOT_EMPTY_CONTENT_TAGS = new Set([
32735
33011
  'img',
32736
33012
  'table',
@@ -32738,7 +33014,19 @@ const NOT_EMPTY_CONTENT_TAGS = new Set([
32738
33014
  'iframe',
32739
33015
  'hr'
32740
33016
  ]);
32741
- class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugin {
33017
+ const KEEPS_SPACES = new Set([
33018
+ 'pre',
33019
+ 'pre-wrap',
33020
+ 'break-spaces'
33021
+ ]);
33022
+ /**
33023
+ * A plain space beside this neighbor isn't shown: there is none, or it's a
33024
+ * line break, a block or text starting (or ending) with a plain space
33025
+ */ function hidesSpace(neighbor, edge) {
33026
+ var _neighbor_nodeValue;
33027
+ return !neighbor || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(neighbor, 'br') || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(neighbor) || jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(neighbor) && edge.test((_neighbor_nodeValue = neighbor.nodeValue) !== null && _neighbor_nodeValue !== void 0 ? _neighbor_nodeValue : '');
33028
+ }
33029
+ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
32742
33030
  afterInit(jodit) {
32743
33031
  jodit.e.on('afterCommand.delete', (command)=>{
32744
33032
  if (command === 'delete') {
@@ -32759,11 +33047,11 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32759
33047
  */ __afterDeleteCommand() {
32760
33048
  const jodit = this.j;
32761
33049
  const current = jodit.s.current();
32762
- if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(current.firstChild, 'br')) {
33050
+ if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(current.firstChild, 'br')) {
32763
33051
  jodit.s.removeNode(current.firstChild);
32764
33052
  }
32765
- 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))) {
32766
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.detach(jodit.editor);
33053
+ 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))) {
33054
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.detach(jodit.editor);
32767
33055
  const node = jodit.s.setCursorIn(jodit.editor);
32768
33056
  jodit.s.removeNode(node);
32769
33057
  }
@@ -32783,14 +33071,15 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32783
33071
  range.deleteContents();
32784
33072
  const fake = jodit.createInside.fake();
32785
33073
  range.insertNode(fake);
32786
- const leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(fake, true);
32787
- const rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(fake, false);
33074
+ const leftSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.findSibling(fake, true);
33075
+ const rightSibling = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.findSibling(fake, false);
32788
33076
  this.__moveContentInLeftSibling(fake, leftSibling, rightSibling);
33077
+ this.__keepSpacesVisible(fake);
32789
33078
  range.setStartBefore(fake);
32790
33079
  range.collapse(true);
32791
33080
  this.__moveCursorInEditableSibling(jodit, leftSibling, fake, range);
32792
33081
  this.__addBrInEmptyBlock(fake, range);
32793
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(fake);
33082
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
32794
33083
  jodit.s.selectRange(caret !== null && caret !== void 0 ? caret : range);
32795
33084
  return false;
32796
33085
  }
@@ -32804,23 +33093,23 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32804
33093
  * Returns where the caret goes, or null when no table is involved
32805
33094
  */ __clearSelectedCells(range) {
32806
33095
  const { editor, createInside } = this.j;
32807
- const startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell, editor);
32808
- const endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isCell, editor);
33096
+ const startCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(range.startContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell, editor);
33097
+ const endCell = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(range.endContainer, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isCell, editor);
32809
33098
  if (startCell === endCell) {
32810
33099
  return null;
32811
33100
  }
32812
- const startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(startCell, 'table', editor);
32813
- const endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(endCell, 'table', editor);
33101
+ const startTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(startCell, 'table', editor);
33102
+ const endTable = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(endCell, 'table', editor);
32814
33103
  const caret = range.cloneRange();
32815
33104
  caret.collapse(true);
32816
33105
  const parts = [];
32817
33106
  const addParts = (table)=>{
32818
- (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)=>{
33107
+ (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)=>{
32819
33108
  const part = range.cloneRange();
32820
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(cell, range.startContainer)) {
33109
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.startContainer)) {
32821
33110
  part.setStart(cell, 0);
32822
33111
  }
32823
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isOrContains(cell, range.endContainer)) {
33112
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isOrContains(cell, range.endContainer)) {
32824
33113
  part.setEnd(cell, cell.childNodes.length);
32825
33114
  }
32826
33115
  parts.push([
@@ -32843,9 +33132,9 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32843
33132
  }
32844
33133
  parts.forEach(([cell, part])=>{
32845
33134
  part.deleteContents();
32846
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(cell)) {
32847
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.detach(cell);
32848
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(cell, createInside.element('br'));
33135
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(cell)) {
33136
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.detach(cell);
33137
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(cell, createInside.element('br'));
32849
33138
  }
32850
33139
  });
32851
33140
  return startTable ? caret : null;
@@ -32853,46 +33142,76 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32853
33142
  __moveContentInLeftSibling(fake, leftSibling, rightSibling) {
32854
33143
  leftSibling = this.__defineRightLeftBox(leftSibling);
32855
33144
  // Nothing is moved into a table, and a block left empty after it goes
32856
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(leftSibling, 'table')) {
32857
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(rightSibling)) {
32858
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
33145
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isTag(leftSibling, 'table')) {
33146
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
33147
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32859
33148
  }
32860
33149
  return;
32861
33150
  }
32862
- 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)) {
32863
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, fake);
32864
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.moveContent(rightSibling, leftSibling);
32865
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
33151
+ 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)) {
33152
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, fake);
33153
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.moveContent(rightSibling, leftSibling);
33154
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32866
33155
  }
32867
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(rightSibling.firstElementChild)) {
33156
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(rightSibling) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(rightSibling.firstElementChild)) {
32868
33157
  const item = rightSibling.firstElementChild;
32869
33158
  // What's left of the right list's first item joins the left block,
32870
33159
  // up to a list nested in the item
32871
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(leftSibling)) {
32872
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, fake);
32873
- while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(item.firstChild)){
32874
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, item.firstChild);
33160
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item) && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(leftSibling)) {
33161
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, fake);
33162
+ while(item.firstChild && !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(item.firstChild)){
33163
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, item.firstChild);
32875
33164
  }
32876
33165
  }
32877
33166
  // Remove empty right LI
32878
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(item)) {
32879
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(item);
33167
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(item)) {
33168
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(item);
32880
33169
  }
32881
- if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmpty(rightSibling)) {
32882
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(rightSibling);
33170
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isEmpty(rightSibling)) {
33171
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(rightSibling);
32883
33172
  }
32884
33173
  }
32885
33174
  }
33175
+ /**
33176
+ * A plain space the deletion leaves at an edge of the block, before a line
33177
+ * break or next to another space isn't shown, and the browser drops it when
33178
+ * the next char is typed. It becomes non-breaking, as in the browsers' own
33179
+ * delete and in Backspace without a selection (#1522)
33180
+ */ __keepSpacesVisible(fake) {
33181
+ var _Dom_closest;
33182
+ const { jodit } = this;
33183
+ const block = (_Dom_closest = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor)) !== null && _Dom_closest !== void 0 ? _Dom_closest : jodit.editor;
33184
+ if (KEEPS_SPACES.has(jodit.ew.getComputedStyle(block).whiteSpace)) {
33185
+ return;
33186
+ }
33187
+ const before = this.__findNeighbor(fake, true, block);
33188
+ const after = this.__findNeighbor(fake, false, block);
33189
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(before) && hidesSpace(after, /^ /)) {
33190
+ before.nodeValue = before.nodeValue.replace(/ +$/, (spaces)=>jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.NBSP_SPACE.repeat(spaces.length));
33191
+ }
33192
+ if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(after) && hidesSpace(before, / $/)) {
33193
+ after.nodeValue = after.nodeValue.replace(/^ +/, (spaces)=>jodit_core_constants__WEBPACK_IMPORTED_MODULE_1__.NBSP_SPACE.repeat(spaces.length));
33194
+ }
33195
+ }
33196
+ /**
33197
+ * The text, line break or other element next to the caret in its block,
33198
+ * looking inside inline elements
33199
+ */ __findNeighbor(fake, left, block) {
33200
+ 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)=>{
33201
+ var _node_nodeValue;
33202
+ return jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(node) ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.trimInv)((_node_nodeValue = node.nodeValue) !== null && _node_nodeValue !== void 0 ? _node_nodeValue : '').length > 0 : !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isComment(node) && !(jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isInlineBlock(node) && node.firstChild);
33203
+ }, block);
33204
+ }
32886
33205
  /**
32887
33206
  * If left sibling is list - return last leaf
32888
33207
  */ __defineRightLeftBox(leftSibling) {
32889
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isList(leftSibling)) {
33208
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isList(leftSibling)) {
32890
33209
  return leftSibling;
32891
33210
  }
32892
33211
  let lastLeaf = leftSibling.lastElementChild;
32893
- if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isLeaf(lastLeaf)) {
33212
+ if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isLeaf(lastLeaf)) {
32894
33213
  lastLeaf = this.j.createInside.element('li');
32895
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(leftSibling, lastLeaf);
33214
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.append(leftSibling, lastLeaf);
32896
33215
  }
32897
33216
  return lastLeaf;
32898
33217
  }
@@ -32900,22 +33219,22 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32900
33219
  * Add BR in the empty block left at the caret
32901
33220
  */ __addBrInEmptyBlock(fake, range) {
32902
33221
  const jodit = this.j;
32903
- if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
33222
+ if (fake.isConnected && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock(fake.parentNode) && !fake.nextSibling && !fake.previousSibling) {
32904
33223
  const br = jodit.createInside.element('br');
32905
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(fake, br);
33224
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.after(fake, br);
32906
33225
  range.setStartBefore(br);
32907
33226
  range.collapse(true);
32908
33227
  }
32909
33228
  }
32910
33229
  __moveCursorInEditableSibling(jodit, leftSibling, fake, range) {
32911
- if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText(leftSibling)) {
33230
+ if (!leftSibling || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText(leftSibling)) {
32912
33231
  var _Dom_closest;
32913
- const root = (_Dom_closest = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isBlock, jodit.editor)) !== null && _Dom_closest !== void 0 ? _Dom_closest : jodit.editor;
32914
- const leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isText, root);
33232
+ const root = (_Dom_closest = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isBlock, jodit.editor)) !== null && _Dom_closest !== void 0 ? _Dom_closest : jodit.editor;
33233
+ const leftText = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.prev(fake, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isText, root);
32915
33234
  if (leftText) {
32916
33235
  range.setStartAfter(leftText);
32917
33236
  range.collapse(true);
32918
- jodit_core_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(fake);
33237
+ jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.safeRemove(fake);
32919
33238
  }
32920
33239
  }
32921
33240
  }
@@ -32923,7 +33242,7 @@ class deleteCommand extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_5__.Plugi
32923
33242
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(deleteCommand, "requires", [
32924
33243
  'backspace'
32925
33244
  ]);
32926
- jodit_core_global__WEBPACK_IMPORTED_MODULE_2__.pluginSystem.add('deleteCommand', deleteCommand);
33245
+ jodit_core_global__WEBPACK_IMPORTED_MODULE_3__.pluginSystem.add('deleteCommand', deleteCommand);
32927
33246
 
32928
33247
 
32929
33248
  /***/ }),
@@ -43930,7 +44249,7 @@ const key = 'table_processor_observer-resize';
43930
44249
  /**
43931
44250
  * Click on resize handle
43932
44251
  */ onHandleMouseDown(event) {
43933
- if (this.j.isLocked) {
44252
+ if (this.j.isLocked || this.j.o.readonly) {
43934
44253
  return;
43935
44254
  }
43936
44255
  this.drag = true;
@@ -43965,10 +44284,15 @@ const key = 'table_processor_observer-resize';
43965
44284
  let box;
43966
44285
  this.minX = 0;
43967
44286
  this.maxX = 1000000;
44287
+ this.startTableWidth = this.workTable.offsetWidth;
43968
44288
  if (this.wholeTable != null) {
43969
- const tableBox = this.workTable.parentNode.getBoundingClientRect();
44289
+ const parent = this.workTable.parentNode;
44290
+ const tableBox = parent.getBoundingClientRect();
43970
44291
  this.minX = tableBox.left;
43971
44292
  this.maxX = this.minX + tableBox.width;
44293
+ const side = this.isRTL ? 'marginRight' : 'marginLeft';
44294
+ this.startParentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getContentWidth)(parent, this.j.ew);
44295
+ this.startMargin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
43972
44296
  } else {
43973
44297
  // find maximum columns
43974
44298
  const coordinate = this.module.formalCoordinate(this.workTable, this.workCell, true);
@@ -43982,6 +44306,17 @@ const key = 'table_processor_observer-resize';
43982
44306
  this.maxX = Math.min(box.left + box.width - jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.NEARBY / 2, this.maxX);
43983
44307
  }
43984
44308
  });
44309
+ const matrix = this.module.formalMatrix(this.workTable);
44310
+ this.startWidths = this.resizedColumns().map((column)=>{
44311
+ const cells = matrix.map((row)=>row[column]);
44312
+ const index = cells.findIndex((td)=>td.colSpan === 1 || cells.length === 1);
44313
+ const cell = cells[index];
44314
+ return [
44315
+ cell,
44316
+ cell ? cell.offsetWidth : 0,
44317
+ cells.slice(Math.max(index, 0) + 1)
44318
+ ];
44319
+ });
43985
44320
  }
43986
44321
  return false;
43987
44322
  }
@@ -44010,8 +44345,11 @@ const key = 'table_processor_observer-resize';
44010
44345
  x = this.maxX;
44011
44346
  }
44012
44347
  this.resizeDelta = x - this.startX + (!this.j.o.iframe ? 0 : workplacePosition.left);
44013
- this.restoreStyles();
44014
- this.resizeColumnsOrTable();
44348
+ if (this.wholeTable == null) {
44349
+ this.setColumnWidths();
44350
+ } else {
44351
+ this.resizeTable();
44352
+ }
44015
44353
  const tableBox = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.offset)(this.workTable, this.j, this.j.ed);
44016
44354
  Object.assign(this.resizeHandler.style, {
44017
44355
  left: this.startLeft + this.columnEdge() - this.startEdge + 'px',
@@ -44124,21 +44462,49 @@ const key = 'table_processor_observer-resize';
44124
44462
  };
44125
44463
  this.scrollFrame = this.j.async.requestAnimationFrame(scroll);
44126
44464
  }
44465
+ /**
44466
+ * The two columns a column drag resizes: the work cell's last, and the
44467
+ * next cell's first
44468
+ */ resizedColumns() {
44469
+ 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);
44470
+ return [
44471
+ this.module.formalCoordinate(this.workTable, this.workCell, true)[1],
44472
+ this.module.formalCoordinate(this.workTable, nextTD)[1]
44473
+ ];
44474
+ }
44127
44475
  /**
44128
44476
  * Resize only one column
44129
44477
  */ resizeColumns() {
44130
44478
  const delta = this.resizeDelta;
44131
44479
  const marked = [];
44132
44480
  const tableModule = this.module;
44133
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, this.workCell, true)[1], delta, true, marked);
44134
- 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);
44135
- tableModule.setColumnWidthByDelta(this.workTable, tableModule.formalCoordinate(this.workTable, nextTD)[1], -delta, false, marked);
44481
+ const [column, nextColumn] = this.resizedColumns();
44482
+ tableModule.setColumnWidthByDelta(this.workTable, column, delta, true, marked);
44483
+ tableModule.setColumnWidthByDelta(this.workTable, nextColumn, -delta, false, marked);
44484
+ }
44485
+ /**
44486
+ * Sets the widths `resizeColumns` would while the handle is dragged, from
44487
+ * the widths the drag started with, so that a move doesn't put back every
44488
+ * cell's style and lay the table out again to measure them
44489
+ */ setColumnWidths() {
44490
+ this.startWidths.forEach(([cell, width, below], index)=>{
44491
+ const delta = index ? -this.resizeDelta : this.resizeDelta;
44492
+ if (cell) {
44493
+ (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) + '%');
44494
+ }
44495
+ below.forEach((td)=>{
44496
+ td.style.removeProperty('width');
44497
+ if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(td, 'style')) {
44498
+ (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(td, 'style', null);
44499
+ }
44500
+ });
44501
+ });
44136
44502
  }
44137
44503
  /**
44138
44504
  * Resize whole table
44139
44505
  */ resizeTable() {
44140
44506
  const delta = this.resizeDelta * (this.isRTL ? -1 : 1);
44141
- const width = this.workTable.offsetWidth, parentWidth = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.getContentWidth)(this.workTable.parentNode, this.j.ew);
44507
+ const width = this.startTableWidth, parentWidth = this.startParentWidth;
44142
44508
  // for RTL use mirror logic
44143
44509
  const rightSide = !this.wholeTable;
44144
44510
  const needChangeWidth = this.isRTL ? !rightSide : rightSide;
@@ -44147,10 +44513,9 @@ const key = 'table_processor_observer-resize';
44147
44513
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, 'width', (width + delta) / parentWidth * 100 + '%');
44148
44514
  } else {
44149
44515
  const side = this.isRTL ? 'marginRight' : 'marginLeft';
44150
- const margin = parseInt(this.j.ew.getComputedStyle(this.workTable)[side] || '0', 10);
44151
44516
  (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_7__.css)(this.workTable, {
44152
44517
  width: (width - delta) / parentWidth * 100 + '%',
44153
- [side]: (margin + delta) / parentWidth * 100 + '%'
44518
+ [side]: (this.startMargin + delta) / parentWidth * 100 + '%'
44154
44519
  });
44155
44520
  }
44156
44521
  }
@@ -44226,9 +44591,10 @@ const key = 'table_processor_observer-resize';
44226
44591
  if (!editor.o.tableAllowCellResize) {
44227
44592
  return;
44228
44593
  }
44229
- editor.e.off(this.j.ow, '.resize-cells').off('.resize-cells').on('change.resize-cells afterCommand.resize-cells afterSetMode.resize-cells', ()=>{
44594
+ const observeTables = ()=>{
44230
44595
  ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', editor.editor).forEach(this.observe);
44231
- }).on(this.j.ow, 'scroll.resize-cells', ()=>{
44596
+ };
44597
+ 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', ()=>{
44232
44598
  if (!this.drag || this.workRow) {
44233
44599
  return;
44234
44600
  }
@@ -44244,6 +44610,8 @@ const key = 'table_processor_observer-resize';
44244
44610
  tableModule.normalizeTable(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(td, 'table', editor.editor));
44245
44611
  });
44246
44612
  });
44613
+ // None of those events comes with the editor's starting value
44614
+ observeTables();
44247
44615
  }
44248
44616
  /**
44249
44617
  * Add to every Table listeners
@@ -44257,7 +44625,9 @@ const key = 'table_processor_observer-resize';
44257
44625
  this.hideResizeHandle();
44258
44626
  }
44259
44627
  }).on(table, 'mousemove.resize-cells touchmove.resize-cells', this.j.async.throttle((event)=>{
44260
- if (this.j.isLocked) {
44628
+ // A drag from a cell isn't a resize, and the handle on
44629
+ // a border it passes would take its moves (#1778)
44630
+ if (this.j.isLocked || this.j.o.readonly || event.buttons) {
44261
44631
  return;
44262
44632
  }
44263
44633
  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);
@@ -44290,8 +44660,15 @@ const key = 'table_processor_observer-resize';
44290
44660
  }
44291
44661
  }), (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), /**
44292
44662
  * The table's and its cells' styles as a column drag started, put back
44293
- * before each new width
44663
+ * as it ends, before the final widths
44294
44664
  */ (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), /**
44665
+ * For each of the two columns a drag resizes, the cell whose width
44666
+ * `setColumnWidthByDelta` sets, with its width as the drag started, and
44667
+ * the cells below it, whose widths it clears
44668
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "startWidths", []), /**
44669
+ * The table's width as the drag started, and for a drag of its edge, the
44670
+ * width inside what holds it and its margin on that side
44671
+ */ (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), /**
44295
44672
  * The row whose height the handle sets, or null while it sets a width
44296
44673
  */ (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), /**
44297
44674
  * The boxes that scroll the row, with their styles, as a row drag turns
@@ -46073,7 +46450,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.tableAllowCellSelecti
46073
46450
 
46074
46451
 
46075
46452
  const key = 'table_processor_observer';
46076
- const MOUSE_MOVE_LABEL = 'onMoveTableSelectCell';
46077
46453
  class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
46078
46454
  /**
46079
46455
  * Shortcut for Jodit.modules.Table
@@ -46088,6 +46464,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46088
46464
  // move the caret, as table-keyboard-navigation's do
46089
46465
  .on('keydown', this.__onKeyDown, {
46090
46466
  top: true
46467
+ }).on('clickEditor', this.__onClickAfterDrag, {
46468
+ top: true
46091
46469
  }).on('keydown.select-cells', (event)=>{
46092
46470
  if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB) {
46093
46471
  this.unselectCells();
@@ -46207,18 +46585,36 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46207
46585
  }
46208
46586
  this.__isSelectionMode = true;
46209
46587
  this.__selectedCell = cell;
46588
+ this.__movedTo = cell;
46210
46589
  this.__tableModule.addSelection(cell);
46211
- this.j.e.on(table, 'mousemove.select-cells touchmove.select-cells', // Don't use decorator because need clear label on mouseup
46212
- this.j.async.throttle(this.__onMove.bind(this, table), {
46213
- label: MOUSE_MOVE_LABEL,
46214
- timeout: this.j.defaultTimeout / 2
46215
- })).on(table, 'mouseup.select-cells touchend.select-cells', this.__onStopSelection.bind(this, table));
46590
+ 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));
46591
+ new Set([
46592
+ this.j.ew,
46593
+ this.j.ow
46594
+ ]).forEach((win)=>this.j.e.on(win, 'mouseup.select-cells touchend.select-cells', this.__onRelease.bind(this, table)));
46216
46595
  return false;
46217
46596
  }
46218
46597
  onOutsideClick() {
46219
46598
  this.__selectedCell = null;
46220
46599
  this.__onRemoveSelection();
46221
46600
  }
46601
+ onMouseDown() {
46602
+ this.__keepMarks = false;
46603
+ }
46604
+ /**
46605
+ * The click that ends a drag let go outside the table, and inside the
46606
+ * editor, lands on the editor. Taken on, it would unmark the cells and
46607
+ * close their popup. As for the click on a row after a drag over the
46608
+ * cells, the browser's own selection from the drag goes
46609
+ */ __onClickAfterDrag() {
46610
+ if (this.__keepMarks) {
46611
+ var _this_j_s_sel;
46612
+ this.__keepMarks = false;
46613
+ (_this_j_s_sel = this.j.s.sel) === null || _this_j_s_sel === void 0 ? void 0 : _this_j_s_sel.removeAllRanges();
46614
+ this.j.e.stopPropagation('clickEditor');
46615
+ return false;
46616
+ }
46617
+ }
46222
46618
  onChange() {
46223
46619
  if (!this.j.isLocked && !this.__isSelectionMode) {
46224
46620
  this.__onRemoveSelection();
@@ -46237,16 +46633,20 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46237
46633
  // Inside Shadow DOM `document.elementFromPoint` returns the shadow
46238
46634
  // host, so the lookup must start from the shadow root
46239
46635
  const node = ((_this_j_o_shadowRoot = this.j.o.shadowRoot) !== null && _this_j_o_shadowRoot !== void 0 ? _this_j_o_shadowRoot : this.j.ed).elementFromPoint(e.clientX, e.clientY);
46240
- if (!node) {
46241
- return;
46242
- }
46243
- const cell = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
46636
+ const cell = node && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, [
46244
46637
  'td',
46245
46638
  'th'
46246
46639
  ], table);
46247
46640
  if (!cell || !this.__selectedCell) {
46248
46641
  return;
46249
46642
  }
46643
+ // The marks change only when the mouse goes into another cell, and then
46644
+ // at once rather than throttled, as the browser's own selection from
46645
+ // the drag shows in the cells between until they do (#1778)
46646
+ if (cell === this.__movedTo) {
46647
+ return;
46648
+ }
46649
+ this.__movedTo = cell;
46250
46650
  if (cell !== this.__selectedCell) {
46251
46651
  this.j.lock(key);
46252
46652
  }
@@ -46285,7 +46685,6 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46285
46685
  * Stop a selection process
46286
46686
  */ __onStopSelection(table, e) {
46287
46687
  var _this_j_o_shadowRoot;
46288
- var _box_bound__, _box_bound__1;
46289
46688
  if (!this.__selectedCell) {
46290
46689
  return;
46291
46690
  }
@@ -46308,10 +46707,33 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46308
46707
  if (ownTable && ownTable !== table) {
46309
46708
  return; // Nested tables
46310
46709
  }
46311
- const bound = this.__tableModule.getSelectedBound(table, [
46710
+ this.__showCellsPopup(table, [
46312
46711
  cell,
46313
46712
  this.__selectedCell
46314
- ]), box = this.__tableModule.formalMatrix(table);
46713
+ ]);
46714
+ this.__stopListening();
46715
+ }
46716
+ /**
46717
+ * A drag let go outside the table doesn't reach the table's `mouseup`, so
46718
+ * the window's ends it, leaving the cells marked as they were (#1774)
46719
+ */ __onRelease(table, e) {
46720
+ if (this.__isSelectionMode) {
46721
+ this.__isSelectionMode = false;
46722
+ if (!this.j.isLockedNotBy(key)) {
46723
+ this.j.unlock();
46724
+ }
46725
+ const cells = this.__tableModule.getAllSelectedCells();
46726
+ // One let go outside the editor clicks outside it, which unmarks them
46727
+ if (cells.length > 1 && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.j.editor, e.target)) {
46728
+ this.__keepMarks = true;
46729
+ this.__showCellsPopup(table, cells);
46730
+ }
46731
+ }
46732
+ this.__stopListening();
46733
+ }
46734
+ __showCellsPopup(table, cells) {
46735
+ var _box_bound__, _box_bound__1;
46736
+ const bound = this.__tableModule.getSelectedBound(table, cells), box = this.__tableModule.formalMatrix(table);
46315
46737
  const max = (_box_bound__ = box[bound[1][0]]) === null || _box_bound__ === void 0 ? void 0 : _box_bound__[bound[1][1]], min = (_box_bound__1 = box[bound[0][0]]) === null || _box_bound__1 === void 0 ? void 0 : _box_bound__1[bound[0][1]];
46316
46738
  // `getSelectedBound` keeps its `Infinity` sentinel when none of the
46317
46739
  // selected cells belong to this table's matrix — e.g. after a
@@ -46331,10 +46753,16 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46331
46753
  height: maxOffset.top - minOffset.top + maxOffset.height
46332
46754
  };
46333
46755
  }, 'cells');
46334
- (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', this.j.editor).forEach((table)=>{
46756
+ }
46757
+ __stopListening() {
46758
+ ;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.$$)('table', this.j.editor).forEach((table)=>{
46335
46759
  this.j.e.off(table, 'mousemove.select-cells touchmove.select-cells mouseup.select-cells touchend.select-cells');
46336
46760
  });
46337
- this.j.async.clearTimeout(MOUSE_MOVE_LABEL);
46761
+ new Set([
46762
+ this.j.ew,
46763
+ this.j.ow
46764
+ ]).forEach((win)=>this.j.e.off(win, 'mouseup.select-cells touchend.select-cells'));
46765
+ this.__movedTo = null;
46338
46766
  }
46339
46767
  /**
46340
46768
  * Remove selection for all cells
@@ -46505,7 +46933,8 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46505
46933
  }
46506
46934
  /** @override */ beforeDestruct(jodit) {
46507
46935
  this.__onRemoveSelection();
46508
- jodit.e.off('.select-cells').off('keydown', this.__onKeyDown);
46936
+ this.__stopListening();
46937
+ jodit.e.off('.select-cells').off('keydown', this.__onKeyDown).off('clickEditor', this.__onClickAfterDrag);
46509
46938
  }
46510
46939
  constructor(...args){
46511
46940
  super(...args), /**
@@ -46516,7 +46945,12 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46516
46945
  * First selected cell
46517
46946
  */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__selectedCell", null), /**
46518
46947
  * User is selecting cells now
46519
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isSelectionMode", false);
46948
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__isSelectionMode", false), /**
46949
+ * The cell the marks were last drawn to
46950
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__movedTo", null), /**
46951
+ * A drag let go outside the table ends in a click on the editor, which
46952
+ * would unmark its cells
46953
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__keepMarks", false);
46520
46954
  }
46521
46955
  }
46522
46956
  ;(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(selectCells, "requires", [
@@ -46534,6 +46968,15 @@ class selectCells extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin
46534
46968
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46535
46969
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':outsideClick')
46536
46970
  ], selectCells.prototype, "onOutsideClick", null);
46971
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46972
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
46973
+ ':mousedown',
46974
+ ':touchstart'
46975
+ ])
46976
+ ], selectCells.prototype, "onMouseDown", null);
46977
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46978
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
46979
+ ], selectCells.prototype, "__onClickAfterDrag", null);
46537
46980
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46538
46981
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':change')
46539
46982
  ], selectCells.prototype, "onChange", null);
@@ -46585,10 +47028,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46585
47028
  /* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
46586
47029
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
46587
47030
  /* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
46588
- /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(57821);
46589
- /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
46590
- /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(4099);
46591
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(47670);
47031
+ /* harmony import */ var jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(88475);
47032
+ /* harmony import */ var jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(57821);
47033
+ /* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(91206);
47034
+ /* harmony import */ var jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(4099);
47035
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(47670);
46592
47036
  /*!
46593
47037
  * Jodit Editor (https://xdsoft.net/jodit/)
46594
47038
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -46607,6 +47051,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46607
47051
 
46608
47052
 
46609
47053
 
47054
+
46610
47055
  /**
46611
47056
  * A utility plugin that allows you to subscribe to a click/mousedown/touchstart/mouseup on an element in DOM order
46612
47057
  *
@@ -46617,22 +47062,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46617
47062
  * console.log(img.src);
46618
47063
  * })
46619
47064
  * ```
46620
- */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
47065
+ */ class select extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_8__.Plugin {
46621
47066
  afterInit(jodit) {
46622
47067
  this.proxyEventsList.forEach((eventName)=>{
46623
47068
  jodit.e.on(eventName + '.select', this.onStartSelection);
46624
47069
  });
47070
+ jodit.e.on('dblclick', this.__onDblClickBesideRow, {
47071
+ top: true
47072
+ });
46625
47073
  }
46626
47074
  beforeDestruct(jodit) {
46627
47075
  this.proxyEventsList.forEach((eventName)=>{
46628
- jodit.e.on(eventName + '.select', this.onStartSelection);
47076
+ jodit.e.off(eventName + '.select', this.onStartSelection);
46629
47077
  });
47078
+ this.__endPressBesideRow();
47079
+ jodit.e.off('dblclick', this.__onDblClickBesideRow);
46630
47080
  }
46631
47081
  onStartSelection(e) {
46632
47082
  const { j } = this;
46633
47083
  let result, target = e.target;
46634
47084
  while(result === undefined && target && target !== j.editor){
46635
- result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_6__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
47085
+ result = j.e.fire((0,jodit_core_helpers_string_camel_case__WEBPACK_IMPORTED_MODULE_7__.camelCase)(e.type + '_' + target.nodeName.toLowerCase()), target, e);
46636
47086
  target = target.parentElement;
46637
47087
  }
46638
47088
  if (e.type === 'click' && result === undefined && target === j.editor) {
@@ -46652,10 +47102,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46652
47102
  }
46653
47103
  // Selecting the text of a popup input with the mouse and releasing
46654
47104
  // the button past the popup's edge is not a click outside of it.
46655
- if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup)) {
47105
+ if (pressed && jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(pressed, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup)) {
46656
47106
  return;
46657
47107
  }
46658
- const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_8__.Popup);
47108
+ const box = jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.UIElement.closestElement(node, jodit_core_ui__WEBPACK_IMPORTED_MODULE_9__.Popup);
46659
47109
  if (!box) {
46660
47110
  this.j.e.fire('outsideClick', e);
46661
47111
  }
@@ -46701,6 +47151,128 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46701
47151
  s.setCursorAfter(text);
46702
47152
  }
46703
47153
  }
47154
+ /**
47155
+ * The table row the mouse is to the right of
47156
+ */ __rowBeside(e) {
47157
+ var _rows_find;
47158
+ const { j } = this;
47159
+ const target = e.target;
47160
+ 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)) {
47161
+ return null;
47162
+ }
47163
+ const table = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(target.children).find((elm)=>{
47164
+ if (!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(elm, 'table')) {
47165
+ return false;
47166
+ }
47167
+ const box = elm.getBoundingClientRect();
47168
+ return e.clientX >= box.right && e.clientY >= box.top && e.clientY < box.bottom;
47169
+ });
47170
+ const rows = table ? (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(table.rows).filter((row)=>row.cells.length) : [];
47171
+ if (!table || !rows.length) {
47172
+ return null;
47173
+ }
47174
+ const row = (_rows_find = rows.find((row)=>e.clientY < row.getBoundingClientRect().bottom)) !== null && _rows_find !== void 0 ? _rows_find : rows[rows.length - 1];
47175
+ return {
47176
+ table,
47177
+ row
47178
+ };
47179
+ }
47180
+ /**
47181
+ * A press to the right of a table row puts the caret where Word's typing
47182
+ * goes from there: the start of the next row's first cell, or of the block
47183
+ * after the table for the last row (#1770). The browsers put it after the
47184
+ * table, whichever row it's beside, so typing starts a new line below it.
47185
+ * Their own press is stopped, as its drag would start after the table and
47186
+ * take in the rows below first
47187
+ */ onMouseDownBesideTableRow(e) {
47188
+ const { j } = this;
47189
+ const beside = this.__rowBeside(e);
47190
+ if (!beside) {
47191
+ return;
47192
+ }
47193
+ // A press before the last one was let go must not stack its listeners
47194
+ this.__endPressBesideRow();
47195
+ e.preventDefault();
47196
+ this.__putCaretBesideRow(beside.table, beside.row);
47197
+ this.__pressBesideRow = {
47198
+ row: beside.row,
47199
+ caret: j.s.range.cloneRange()
47200
+ };
47201
+ j.e.on(j.ew, 'mousemove', this.__onDragFromRow);
47202
+ new Set([
47203
+ j.ew,
47204
+ j.ow
47205
+ ]).forEach((win)=>j.e.on(win, 'mouseup', this.__onReleaseFromRow));
47206
+ }
47207
+ /**
47208
+ * A drag from beside a row selects from the end of the row to the mouse,
47209
+ * and back beside the row it's the caret again
47210
+ */ __onDragFromRow(e) {
47211
+ var _this___rowBeside;
47212
+ const { s } = this.j;
47213
+ const press = this.__pressBesideRow;
47214
+ if (!press || !(e.buttons & 1)) {
47215
+ this.__endPressBesideRow();
47216
+ return;
47217
+ }
47218
+ if (((_this___rowBeside = this.__rowBeside(e)) === null || _this___rowBeside === void 0 ? void 0 : _this___rowBeside.row) === press.row) {
47219
+ if (!s.isCollapsed()) {
47220
+ s.selectRange(press.caret.cloneRange());
47221
+ }
47222
+ return;
47223
+ }
47224
+ const { cells } = press.row;
47225
+ const last = cells[cells.length - 1];
47226
+ if (s.insertCursorAtPoint(e.clientX, e.clientY)) {
47227
+ var _s_sel;
47228
+ const { startContainer, startOffset } = s.range;
47229
+ (_s_sel = s.sel) === null || _s_sel === void 0 ? void 0 : _s_sel.setBaseAndExtent(last, last.childNodes.length, startContainer, startOffset);
47230
+ }
47231
+ }
47232
+ /**
47233
+ * In iframe mode, a press in an editor without the focus puts the caret at
47234
+ * its end, so a release that selected nothing puts it back
47235
+ */ __onReleaseFromRow() {
47236
+ const press = this.__pressBesideRow;
47237
+ this.__endPressBesideRow();
47238
+ if (press && this.j.s.isCollapsed()) {
47239
+ this.j.s.selectRange(press.caret);
47240
+ }
47241
+ }
47242
+ __endPressBesideRow() {
47243
+ const { j } = this;
47244
+ this.__pressBesideRow = null;
47245
+ j.e.off(j.ew, 'mousemove', this.__onDragFromRow);
47246
+ new Set([
47247
+ j.ew,
47248
+ j.ow
47249
+ ]).forEach((win)=>j.e.off(win, 'mouseup', this.__onReleaseFromRow));
47250
+ }
47251
+ /**
47252
+ * A double click beside a row is two clicks there, so add-new-line,
47253
+ * which adds a line on a double click with a caret, doesn't see it
47254
+ */ __onDblClickBesideRow(e) {
47255
+ if (this.__rowBeside(e)) {
47256
+ this.j.e.stopPropagation('dblclick');
47257
+ return false;
47258
+ }
47259
+ }
47260
+ __putCaretBesideRow(table, row) {
47261
+ const { j } = this;
47262
+ const rows = (0,jodit_core_helpers_array_to_array__WEBPACK_IMPORTED_MODULE_6__.toArray)(table.rows);
47263
+ const next = rows.slice(rows.indexOf(row) + 1).find((row)=>row.cells.length);
47264
+ let after = table.nextSibling;
47265
+ while(after && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isEmptyTextNode(after)){
47266
+ after = after.nextSibling;
47267
+ }
47268
+ if (next) {
47269
+ j.s.setCursorIn(next.cells[0], true);
47270
+ } 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)) {
47271
+ j.s.setCursorIn(after, true);
47272
+ } else {
47273
+ j.s.setCursorAfter(table);
47274
+ }
47275
+ }
46704
47276
  /**
46705
47277
  * Keep pending inline formatting after a click. Toggling Bold/Italic/etc. on
46706
47278
  * a collapsed cursor leaves empty marker elements with the caret inside; a
@@ -46764,7 +47336,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46764
47336
  * Where the last press started. Chrome reports a drag that begins in one
46765
47337
  * element and ends in another as a `click` on their common ancestor, so a
46766
47338
  * press inside a popup is remembered to tell such a drag from a real click.
46767
- */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null);
47339
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressTarget", null), /**
47340
+ * The row a press to its right was beside, and the caret it put there,
47341
+ * while the button is down
47342
+ */ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__pressBesideRow", null);
46768
47343
  }
46769
47344
  }
46770
47345
  ;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
@@ -46794,6 +47369,18 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.select = {
46794
47369
  ':click'
46795
47370
  ])
46796
47371
  ], select.prototype, "onClickRightOfNestedListItem", null);
47372
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47373
+ (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)(':mousedown')
47374
+ ], select.prototype, "onMouseDownBesideTableRow", null);
47375
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47376
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
47377
+ ], select.prototype, "__onDragFromRow", null);
47378
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47379
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
47380
+ ], select.prototype, "__onReleaseFromRow", null);
47381
+ (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
47382
+ jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
47383
+ ], select.prototype, "__onDblClickBesideRow", null);
46797
47384
  (0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
46798
47385
  (0,jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.watch)([
46799
47386
  ':click'