jodit 4.19.7 → 4.19.9

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 (81) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +9 -9
  4. package/es2015/jodit.js +336 -117
  5. package/es2015/jodit.min.js +5 -5
  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 +9 -9
  13. package/es2018/jodit.min.js +5 -5
  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 +11 -11
  18. package/es2021/jodit.js +267 -59
  19. package/es2021/jodit.min.js +57 -57
  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 +7 -7
  28. package/es2021.en/jodit.js +267 -59
  29. package/es2021.en/jodit.min.js +7 -7
  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 +416 -119
  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/helpers/utils/scroll-into-view.js +9 -2
  59. package/esm/core/request/ajax.d.ts +1 -0
  60. package/esm/core/request/ajax.js +20 -1
  61. package/esm/core/selection/selection.js +7 -4
  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/enter/helpers/check-br.js +7 -1
  70. package/esm/plugins/font/config.js +8 -8
  71. package/esm/plugins/hotkeys/hotkeys.js +11 -0
  72. package/esm/types/uploader.d.ts +117 -11
  73. package/package.json +2 -2
  74. package/types/core/constants.d.ts +1 -0
  75. package/types/core/helpers/utils/error/error.d.ts +1 -0
  76. package/types/core/helpers/utils/error/errors/answer-error.d.ts +13 -0
  77. package/types/core/helpers/utils/error/errors/index.d.ts +1 -0
  78. package/types/core/request/ajax.d.ts +1 -0
  79. package/types/modules/uploader/helpers/send-files.d.ts +2 -2
  80. package/types/modules/uploader/helpers/upload-error.d.ts +15 -0
  81. 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.7
4
+ * Version: v4.19.9
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.7";
1833
+ */ const APP_VERSION = "4.19.9";
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; },
@@ -9776,6 +9816,7 @@ const map = {};
9776
9816
  /**
9777
9817
  * Check if element is in view
9778
9818
  */ function inView(elm, root, doc) {
9819
+ var _doc_defaultView;
9779
9820
  let rect = elm.getBoundingClientRect(), el = elm;
9780
9821
  const top = rect.top, height = rect.height;
9781
9822
  while(el && el !== root && el.parentNode){
@@ -9800,7 +9841,11 @@ const map = {};
9800
9841
  // element scrolled above the top was wrongly reported as visible and never
9801
9842
  // scrolled to. See #1279
9802
9843
  const clientHeight = doc.documentElement && doc.documentElement.clientHeight || 0;
9803
- return (top + height <= clientHeight + SUBPIXEL_TOLERANCE || top <= 0) && top + height >= 0;
9844
+ // `scrollIntoView` keeps clear of the document's `scroll-padding`, which
9845
+ // is how a page allows for a fixed header or footer, so its edges are the
9846
+ // viewport's edges here too
9847
+ const style = (_doc_defaultView = doc.defaultView) === null || _doc_defaultView === void 0 ? void 0 : _doc_defaultView.getComputedStyle(doc.documentElement), padding = (value = '')=>value.endsWith('%') ? parseFloat(value) * clientHeight / 100 : parseFloat(value) || 0, viewTop = padding(style === null || style === void 0 ? void 0 : style.scrollPaddingTop), viewBottom = clientHeight - padding(style === null || style === void 0 ? void 0 : style.scrollPaddingBottom);
9848
+ return (top + height <= viewBottom + SUBPIXEL_TOLERANCE || top <= viewTop) && top + height >= viewTop;
9804
9849
  }
9805
9850
  /**
9806
9851
  * Scroll element into view if it is not in view
@@ -10757,6 +10802,23 @@ class Ajax {
10757
10802
  } catch (unused) {}
10758
10803
  return this;
10759
10804
  }
10805
+ // 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
10806
+ __hasAnswerEnvelope() {
10807
+ const { xhr } = this;
10808
+ if (xhr.responseType && xhr.responseType !== 'text') {
10809
+ return false;
10810
+ }
10811
+ const text = xhr.responseText;
10812
+ if (!text || text[0] !== '{') {
10813
+ return false;
10814
+ }
10815
+ try {
10816
+ const answer = JSON.parse(text);
10817
+ return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_9__.isPlainObject)(answer) && 'success' in answer;
10818
+ } catch (unused) {
10819
+ return false;
10820
+ }
10821
+ }
10760
10822
  send() {
10761
10823
  this.__activated = true;
10762
10824
  const { xhr, o } = this;
@@ -10793,7 +10855,7 @@ class Ajax {
10793
10855
  var _this_options_onProgress, _this_options;
10794
10856
  (_this_options_onProgress = (_this_options = this.options).onProgress) === null || _this_options_onProgress === void 0 ? void 0 : _this_options_onProgress.call(_this_options, 10);
10795
10857
  if (xhr.readyState === XMLHttpRequest.DONE) {
10796
- if (o.successStatuses.includes(xhr.status)) {
10858
+ if (o.successStatuses.includes(xhr.status) || this.__hasAnswerEnvelope()) {
10797
10859
  onResolve();
10798
10860
  } else if (xhr.statusText) {
10799
10861
  this.__isFulfilled = true;
@@ -12000,19 +12062,22 @@ class Selection {
12000
12062
  }
12001
12063
  if (sel && sel.rangeCount) {
12002
12064
  const range = sel.getRangeAt(0);
12003
- const { firstChild } = node;
12065
+ // A block has no first child outside itself to go by, and what's
12066
+ // left beside it would show as a line of its own
12067
+ const isBlock = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock(node), first = isBlock ? node : node.firstChild;
12004
12068
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.area, range.commonAncestorContainer)) {
12005
12069
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeInsertNode(range, node);
12006
12070
  } else {
12007
12071
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(this.area, node);
12008
12072
  }
12009
12073
  [
12010
- ()=>firstChild === null || firstChild === void 0 ? void 0 : firstChild.previousSibling,
12011
- ()=>firstChild === null || firstChild === void 0 ? void 0 : firstChild.previousSibling,
12074
+ ()=>first === null || first === void 0 ? void 0 : first.previousSibling,
12075
+ ()=>first === null || first === void 0 ? void 0 : first.previousSibling,
12012
12076
  ()=>{
12013
- var _firstChild_previousSibling;
12014
- return firstChild === null || firstChild === void 0 ? void 0 : (_firstChild_previousSibling = firstChild.previousSibling) === null || _firstChild_previousSibling === void 0 ? void 0 : _firstChild_previousSibling.lastChild;
12015
- }
12077
+ var _first_previousSibling;
12078
+ return first === null || first === void 0 ? void 0 : (_first_previousSibling = first.previousSibling) === null || _first_previousSibling === void 0 ? void 0 : _first_previousSibling.lastChild;
12079
+ },
12080
+ ()=>isBlock ? node.nextSibling : null
12016
12081
  ].forEach((getChildNode)=>{
12017
12082
  const childNode = getChildNode();
12018
12083
  // Only a text node left with nothing in it by the split
@@ -21767,7 +21832,8 @@ class DataProvider {
21767
21832
  }).catch(()=>null);
21768
21833
  return promise.then((resp)=>resp.json()).then((resp)=>{
21769
21834
  if (resp && !this.isSuccess(resp)) {
21770
- throw new Error(this.getMessage(resp));
21835
+ var _resp_data;
21836
+ 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);
21771
21837
  }
21772
21838
  return resp;
21773
21839
  });
@@ -21906,10 +21972,11 @@ class DataProvider {
21906
21972
  */ getPathByUrl(url) {
21907
21973
  ;(0,jodit_core_helpers_utils_set__WEBPACK_IMPORTED_MODULE_13__.set)('options.getLocalFileByUrl.data.url', url, this);
21908
21974
  return this.get('getLocalFileByUrl').then((resp)=>{
21975
+ var _resp_data;
21909
21976
  if (this.isSuccess(resp)) {
21910
21977
  return resp.data;
21911
21978
  }
21912
- throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_12__.error)(this.getMessage(resp));
21979
+ 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);
21913
21980
  });
21914
21981
  }
21915
21982
  /**
@@ -26786,6 +26853,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.uploader = {
26786
26853
  defaultHandlerError (e) {
26787
26854
  this.j.message.error(e.message);
26788
26855
  },
26856
+ promptOnExists: true,
26857
+ promptOnExistsSuggestName (name) {
26858
+ return name;
26859
+ },
26789
26860
  contentType (requestData) {
26790
26861
  return this.ow.FormData !== undefined && typeof requestData !== 'string' ? false : 'application/x-www-form-urlencoded; charset=UTF-8';
26791
26862
  }
@@ -26964,8 +27035,14 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26964
27035
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
26965
27036
  /* harmony export */ sendFiles: function() { return /* binding */ sendFiles; }
26966
27037
  /* harmony export */ });
26967
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(65946);
26968
- /* harmony import */ var jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(77911);
27038
+ /* harmony import */ var _swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(49376);
27039
+ /* harmony import */ var _swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41411);
27040
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
27041
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65946);
27042
+ /* harmony import */ var jodit_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(80512);
27043
+ /* harmony import */ var jodit_modules_dialog_prompt__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(74103);
27044
+ /* harmony import */ var jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(77911);
27045
+ /* harmony import */ var jodit_modules_uploader_helpers_upload_error__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(55083);
26969
27046
  /*!
26970
27047
  * Jodit Editor (https://xdsoft.net/jodit/)
26971
27048
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -26974,83 +27051,163 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26974
27051
  * @module modules/uploader
26975
27052
  */
26976
27053
 
27054
+
27055
+
27056
+
27057
+
27058
+
27059
+
26977
27060
  /**
26978
27061
  * Send files to server
26979
- */ function sendFiles(uploader, files, handlerSuccess, handlerError, process) {
26980
- if (!files) {
26981
- return Promise.reject((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Need files'));
26982
- }
26983
- const { o } = uploader;
26984
- let fileList = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.toArray)(files);
26985
- if (!fileList.length) {
26986
- return Promise.reject((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Need files'));
26987
- }
26988
- // Client-side validation hook — returning `false` aborts the upload.
26989
- // See https://github.com/xdan/jodit/issues/1329
26990
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(o.beforeUpload)) {
26991
- if (o.beforeUpload.call(uploader, fileList) === false) {
26992
- const err = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Upload canceled');
26993
- (handlerError || o.defaultHandlerError).call(uploader, err);
26994
- return Promise.reject(err);
26995
- }
26996
- }
26997
- const promises = [];
26998
- if (o.insertImageAsBase64URI) {
26999
- readImagesWithReader(fileList, o.imagesExtensions, promises, uploader, handlerSuccess, o.defaultHandlerSuccess);
27000
- }
27001
- fileList = fileList.filter((a)=>a);
27002
- if (fileList.length) {
27003
- const form = new FormData();
27004
- form.append(o.pathVariableName, uploader.path);
27005
- form.append('source', uploader.source);
27006
- let file;
27007
- for(let i = 0; i < fileList.length; i += 1){
27008
- file = fileList[i];
27009
- if (file) {
27010
- const hasRealExtension = /\.\w+$/.test(file.name);
27011
- const mime = file.type.match(/\/([a-z0-9]+)/i);
27012
- const extension = mime && mime[1] ? mime[1].toLowerCase() : '';
27013
- let newName = fileList[i].name || Math.random().toString().replace('.', '');
27014
- if (!hasRealExtension && extension) {
27015
- let extForReg = extension;
27016
- if ([
27017
- 'jpeg',
27018
- 'jpg'
27019
- ].includes(extForReg)) {
27020
- extForReg = 'jpeg|jpg';
27021
- }
27022
- const reEnd = new RegExp('.(' + extForReg + ')$', 'i');
27023
- if (!reEnd.test(newName)) {
27024
- newName += '.' + extension;
27062
+ */ function sendFiles(uploader, files, handlerSuccess, handlerError, process, // Set when a refused upload is sent again: `beforeUpload` already had its say
27063
+ retryOf) {
27064
+ return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function*() {
27065
+ if (!files) {
27066
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.error)('Need files');
27067
+ }
27068
+ const { o } = uploader;
27069
+ let fileList = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.toArray)(files);
27070
+ if (!fileList.length) {
27071
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.error)('Need files');
27072
+ }
27073
+ let extraData = retryOf === null || retryOf === void 0 ? void 0 : retryOf.data;
27074
+ // Client-side validation hook — returning `false` aborts the upload, and it may hand back the files to send instead
27075
+ // See https://github.com/xdan/jodit/issues/1329
27076
+ if (!retryOf && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isFunction)(o.beforeUpload)) {
27077
+ let plan;
27078
+ try {
27079
+ plan = yield o.beforeUpload.call(uploader, fileList);
27080
+ } catch (e) {
27081
+ (handlerError || o.defaultHandlerError).call(uploader, e);
27082
+ throw e;
27083
+ }
27084
+ if (plan === false) {
27085
+ const err = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.error)('Upload canceled');
27086
+ (handlerError || o.defaultHandlerError).call(uploader, err);
27087
+ throw err;
27088
+ }
27089
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isArray)(plan)) {
27090
+ fileList = plan;
27091
+ } else if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isPlainObject)(plan) && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isArray)(plan.files)) {
27092
+ fileList = plan.files;
27093
+ extraData = plan.data;
27094
+ }
27095
+ if (!fileList.length) {
27096
+ return [];
27097
+ }
27098
+ }
27099
+ const promises = [];
27100
+ if (o.insertImageAsBase64URI) {
27101
+ readImagesWithReader(fileList, o.imagesExtensions, promises, uploader, handlerSuccess, o.defaultHandlerSuccess);
27102
+ }
27103
+ fileList = fileList.filter((a)=>a);
27104
+ if (fileList.length) {
27105
+ const form = new FormData();
27106
+ form.append(o.pathVariableName, uploader.path);
27107
+ form.append('source', uploader.source);
27108
+ let file;
27109
+ for(let i = 0; i < fileList.length; i += 1){
27110
+ file = fileList[i];
27111
+ if (file) {
27112
+ const hasRealExtension = /\.\w+$/.test(file.name);
27113
+ const mime = file.type.match(/\/([a-z0-9]+)/i);
27114
+ const extension = mime && mime[1] ? mime[1].toLowerCase() : '';
27115
+ let newName = fileList[i].name || Math.random().toString().replace('.', '');
27116
+ if (!hasRealExtension && extension) {
27117
+ let extForReg = extension;
27118
+ if ([
27119
+ 'jpeg',
27120
+ 'jpg'
27121
+ ].includes(extForReg)) {
27122
+ extForReg = 'jpeg|jpg';
27123
+ }
27124
+ const reEnd = new RegExp('.(' + extForReg + ')$', 'i');
27125
+ if (!reEnd.test(newName)) {
27126
+ newName += '.' + extension;
27127
+ }
27025
27128
  }
27129
+ const [key, iFile, name] = o.processFileName.call(uploader, o.filesVariableName(i), fileList[i], newName);
27130
+ form.append(key, iFile, name);
27026
27131
  }
27027
- const [key, iFile, name] = o.processFileName.call(uploader, o.filesVariableName(i), fileList[i], newName);
27028
- form.append(key, iFile, name);
27029
27132
  }
27030
- }
27031
- if (process) {
27032
- process(form);
27033
- }
27034
- if (o.data && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isPlainObject)(o.data)) {
27035
- Object.keys(o.data).forEach((key)=>{
27036
- form.append(key, o.data[key]);
27037
- });
27038
- }
27039
- o.prepareData.call(uploader, form);
27040
- promises.push((0,jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_1__.send)(uploader, form).then((resp)=>{
27041
- if (o.isSuccess.call(uploader, resp)) {
27042
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
27043
- handler.call(uploader, o.process.call(uploader, resp));
27133
+ if (process) {
27134
+ process(form);
27135
+ }
27136
+ if (o.data && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isPlainObject)(o.data)) {
27137
+ Object.keys(o.data).forEach((key)=>{
27138
+ form.append(key, o.data[key]);
27139
+ });
27140
+ }
27141
+ if (extraData) {
27142
+ Object.keys(extraData).forEach((key)=>{
27143
+ form.append(key, extraData[key]);
27144
+ });
27145
+ }
27146
+ o.prepareData.call(uploader, form);
27147
+ promises.push((0,jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_6__.send)(uploader, form).then((resp)=>{
27148
+ if (o.isSuccess.call(uploader, resp)) {
27149
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
27150
+ handler.call(uploader, o.process.call(uploader, resp));
27151
+ return resp;
27152
+ }
27153
+ const err = new jodit_modules_uploader_helpers_upload_error__WEBPACK_IMPORTED_MODULE_7__.UploadError(o.getMessage.call(uploader, resp), resp, fileList, (plan)=>{
27154
+ var _ref;
27155
+ return sendFiles(uploader, (_ref = plan === null || plan === void 0 ? void 0 : plan.files) !== null && _ref !== void 0 ? _ref : fileList, handlerSuccess, handlerError, process, {
27156
+ data: (0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_1__._)({}, extraData, plan === null || plan === void 0 ? void 0 : plan.data)
27157
+ });
27158
+ });
27159
+ // A taken name is part of the upload, not a failure: ask for another one first
27160
+ if (err.code === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.ERROR_CODE_CONFLICT && o.promptOnExists) {
27161
+ return askAnotherName(uploader, err);
27162
+ }
27163
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
27164
+ handler.call(uploader, err);
27044
27165
  return resp;
27166
+ }).then(()=>{
27167
+ uploader.j.events && uploader.j.e.fire('filesWereUploaded');
27168
+ }));
27169
+ }
27170
+ return Promise.all(promises);
27171
+ })();
27172
+ }
27173
+ function askAnotherName(uploader, err) {
27174
+ const { files } = err;
27175
+ // A batch is refused as a whole (the connector saved nothing) and the answer does not say which name is taken,
27176
+ // so the files go again one by one: the free ones are simply stored, the taken one answers 409 alone and gets its prompt
27177
+ if (files.length > 1) {
27178
+ return files.reduce((chain, file)=>chain.then(()=>err.retry({
27179
+ files: [
27180
+ file
27181
+ ]
27182
+ })), Promise.resolve());
27183
+ }
27184
+ const [file] = files;
27185
+ const { j, o } = uploader;
27186
+ return new Promise((resolve)=>{
27187
+ let answered = false;
27188
+ // `Dlgs.prototype.dlg`: the uploader's view does not always carry the Dlgs trait
27189
+ 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, {
27190
+ closeOnClickOverlay: true
27191
+ }), j.i18n(err.message), j.i18n('Rename'), (newName)=>{
27192
+ newName = newName.trim();
27193
+ if (!newName) {
27194
+ return false;
27045
27195
  }
27046
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
27047
- handler.call(uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)(o.getMessage.call(uploader, resp)));
27048
- return resp;
27049
- }).then(()=>{
27050
- uploader.j.events && uploader.j.e.fire('filesWereUploaded');
27051
- }));
27052
- }
27053
- return Promise.all(promises);
27196
+ answered = true;
27197
+ resolve(err.retry({
27198
+ files: [
27199
+ new File([
27200
+ file
27201
+ ], newName, {
27202
+ type: file.type
27203
+ })
27204
+ ]
27205
+ }));
27206
+ }, j.i18n('Enter new name'), o.promptOnExistsSuggestName.call(uploader, file.name));
27207
+ dialog.e.on(dialog, 'afterClose', ()=>{
27208
+ !answered && resolve(undefined);
27209
+ });
27210
+ });
27054
27211
  }
27055
27212
  function readImagesWithReader(fileList, imagesExtensions, promises, uploader, handlerSuccess, defaultHandlerSuccess) {
27056
27213
  const readerPromises = [];
@@ -27080,7 +27237,7 @@ function readImagesWithReader(fileList, imagesExtensions, promises, uploader, ha
27080
27237
  name
27081
27238
  ]
27082
27239
  };
27083
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerSuccess) ? handlerSuccess : defaultHandlerSuccess;
27240
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isFunction)(handlerSuccess) ? handlerSuccess : defaultHandlerSuccess;
27084
27241
  handler.call(uploader, resp);
27085
27242
  resolve(resp);
27086
27243
  };
@@ -27196,6 +27353,35 @@ function send(uploader, data) {
27196
27353
  /* harmony export */ ]);
27197
27354
 
27198
27355
 
27356
+ /***/ }),
27357
+
27358
+ /***/ 55083:
27359
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
27360
+
27361
+ "use strict";
27362
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
27363
+ /* harmony export */ UploadError: function() { return /* binding */ UploadError; }
27364
+ /* harmony export */ });
27365
+ /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
27366
+ /* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33201);
27367
+ /*!
27368
+ * Jodit Editor (https://xdsoft.net/jodit/)
27369
+ * Released under MIT see LICENSE.txt in the project root for license information.
27370
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
27371
+ */ /**
27372
+ * @module modules/uploader
27373
+ */
27374
+
27375
+ // The connector refused these files: the handler can change the request and send it again
27376
+ class UploadError extends jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__.AnswerError {
27377
+ constructor(message, answer, files, retry){
27378
+ var _answer_data;
27379
+ 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;
27380
+ Object.setPrototypeOf(this, UploadError.prototype);
27381
+ }
27382
+ }
27383
+
27384
+
27199
27385
  /***/ }),
27200
27386
 
27201
27387
  /***/ 94925:
@@ -27210,9 +27396,10 @@ function send(uploader, data) {
27210
27396
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
27211
27397
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23211);
27212
27398
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
27213
- /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5266);
27214
- /* harmony import */ var jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(11981);
27215
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(40013);
27399
+ /* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(33201);
27400
+ /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5266);
27401
+ /* harmony import */ var jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11981);
27402
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(40013);
27216
27403
  /*!
27217
27404
  * Jodit Editor (https://xdsoft.net/jodit/)
27218
27405
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -27230,6 +27417,7 @@ function send(uploader, data) {
27230
27417
 
27231
27418
 
27232
27419
 
27420
+
27233
27421
  class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewComponent {
27234
27422
  get j() {
27235
27423
  return this.jodit;
@@ -27285,14 +27473,14 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27285
27473
  }
27286
27474
  };
27287
27475
  // send data on server
27288
- if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(cData)) {
27289
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, cData.files, handlerSuccess, handlerError).finally(onFinally);
27476
+ if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(cData)) {
27477
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, cData.files, handlerSuccess, handlerError).finally(onFinally);
27290
27478
  return false;
27291
27479
  }
27292
27480
  if (jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && !jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_ES_NEXT) {
27293
- return (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.processOldBrowserDrag)(self, cData, handlerSuccess, handlerError, onFinally);
27481
+ return (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.processOldBrowserDrag)(self, cData, handlerSuccess, handlerError, onFinally);
27294
27482
  }
27295
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasItems)(cData)) {
27483
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasItems)(cData)) {
27296
27484
  const { items } = cData;
27297
27485
  for(i = 0; i < items.length; i += 1){
27298
27486
  if (items[i].kind === 'file' && items[i].type === 'image/png') {
@@ -27300,7 +27488,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27300
27488
  if (file) {
27301
27489
  const mime = file.type.match(/\/([a-z0-9]+)/i);
27302
27490
  extension = mime[1] ? mime[1].toLowerCase() : '';
27303
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, [
27491
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, [
27304
27492
  file
27305
27493
  ], handlerSuccess, handlerError, processData).finally(onFinally);
27306
27494
  }
@@ -27322,21 +27510,21 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27322
27510
  self.j.e.on(form, 'dragend dragover dragenter dragleave drop', (e)=>{
27323
27511
  e.preventDefault();
27324
27512
  }).on(form, 'dragover', (event)=>{
27325
- 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)) {
27513
+ 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)) {
27326
27514
  form.classList.add('jodit_drag_hover');
27327
27515
  event.preventDefault();
27328
27516
  }
27329
27517
  }).on(form, 'dragend dragleave', (event)=>{
27330
27518
  form.classList.remove('jodit_drag_hover');
27331
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(event.dataTransfer)) {
27519
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
27332
27520
  event.preventDefault();
27333
27521
  }
27334
27522
  }).on(form, 'drop', (event)=>{
27335
27523
  form.classList.remove('jodit_drag_hover');
27336
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(event.dataTransfer)) {
27524
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
27337
27525
  event.preventDefault();
27338
27526
  event.stopImmediatePropagation();
27339
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, event.dataTransfer.files, handlerSuccess, handlerError).finally(onFinally);
27527
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, event.dataTransfer.files, handlerSuccess, handlerError).finally(onFinally);
27340
27528
  }
27341
27529
  });
27342
27530
  const inputFile = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.first(form, (node)=>{
@@ -27345,7 +27533,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27345
27533
  });
27346
27534
  if (inputFile) {
27347
27535
  self.j.e.on(inputFile, 'change', ()=>{
27348
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, inputFile.files, handlerSuccess, handlerError).then(()=>{
27536
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, inputFile.files, handlerSuccess, handlerError).then(()=>{
27349
27537
  inputFile.value = '';
27350
27538
  if (!/safari/i.test(navigator.userAgent)) {
27351
27539
  inputFile.type = '';
@@ -27360,26 +27548,41 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27360
27548
  */ uploadRemoteImage(url, handlerSuccess, handlerError) {
27361
27549
  const uploader = this, { o } = uploader;
27362
27550
  const handlerE = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
27363
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.send)(uploader, {
27551
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.send)(uploader, {
27364
27552
  action: 'fileUploadRemote',
27365
27553
  url
27366
27554
  }).then((resp)=>{
27555
+ var _resp_data;
27367
27556
  if (o.isSuccess.call(uploader, resp)) {
27368
27557
  const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
27369
27558
  handler.call(uploader, o.process.call(uploader, resp));
27370
27559
  return;
27371
27560
  }
27372
- handlerE.call(uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.error)(o.getMessage.call(uploader, resp)));
27561
+ 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));
27373
27562
  }).catch((e)=>handlerE.call(uploader, e));
27374
27563
  }
27375
27564
  upload(files) {
27376
27565
  return this.async.promise((resolve, reject)=>{
27377
- ;(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(this, files, resolve, reject);
27566
+ let settled = false;
27567
+ const settle = (end)=>(value)=>{
27568
+ settled = true;
27569
+ end(value);
27570
+ };
27571
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(this, files, settle(resolve), settle(reject)).then(()=>{
27572
+ // `beforeUpload` kept no file, so no handler ran
27573
+ if (!settled) {
27574
+ resolve({
27575
+ baseurl: '',
27576
+ files: [],
27577
+ isImages: []
27578
+ });
27579
+ }
27580
+ }, settle(reject));
27378
27581
  });
27379
27582
  }
27380
27583
  destruct() {
27381
27584
  this.setStatus(jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.STATUSES.beforeDestruct);
27382
- const instances = jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.ajaxInstances.get(this);
27585
+ const instances = jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.ajaxInstances.get(this);
27383
27586
  if (instances) {
27384
27587
  instances.forEach((ajax)=>{
27385
27588
  try {
@@ -27392,7 +27595,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27392
27595
  }
27393
27596
  constructor(editor, options){
27394
27597
  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);
27395
- 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 : {}));
27598
+ 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 : {}));
27396
27599
  }
27397
27600
  }
27398
27601
 
@@ -33976,7 +34179,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('enter', enter);
33976
34179
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(br, clone);
33977
34180
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(clone, fake);
33978
34181
  }
33979
- ;(0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_2__.scrollIntoViewIfNeeded)(br, jodit.editor, jodit.ed);
34182
+ // The new `br` ends the line above, so it takes something on the
34183
+ // caret's own line to bring that line into view. Chrome won't scroll to
34184
+ // an inline element without width, but it will to a `br`
34185
+ const mark = br.cloneNode();
34186
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(fake, mark);
34187
+ (0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_2__.scrollIntoViewIfNeeded)(mark, jodit.editor, jodit.ed);
34188
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(mark);
33980
34189
  return true;
33981
34190
  }
33982
34191
  return false;
@@ -34644,6 +34853,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.font = {
34644
34853
  }
34645
34854
  };
34646
34855
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_6__.Icon.set('font', (_icons_font_svg__WEBPACK_IMPORTED_MODULE_8___default())).set('fontsize', (_icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_9___default()));
34856
+ const hadSelection = new WeakSet();
34647
34857
  jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.controls.fontsize = {
34648
34858
  command: 'fontsize',
34649
34859
  data: {
@@ -34680,17 +34890,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.controls.fontsize = {
34680
34890
  tooltip: 'Font size',
34681
34891
  value: (editor, button)=>{
34682
34892
  var _control_data;
34683
- const current = editor.s.current();
34684
- if (!current) {
34685
- return;
34686
- }
34687
- const box = jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isElement, editor.editor);
34688
- if (!box) {
34893
+ const current = editor.s.current(), box = current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_2__.Dom.isElement, editor.editor), control = button.control;
34894
+ // A select names its value, so until there is a selection it shows the
34895
+ // editor's own size, and afterwards the size of the last one
34896
+ if (box) {
34897
+ hadSelection.add(button);
34898
+ } else if (control.component !== 'select' || hadSelection.has(button)) {
34689
34899
  return;
34690
34900
  }
34691
- const control = button.control;
34692
34901
  const cssKey = ((_control_data = control.data) === null || _control_data === void 0 ? void 0 : _control_data.cssRule) || 'font-size';
34693
- const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.css)(box, cssKey);
34902
+ const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_5__.css)(box || editor.editor, cssKey);
34694
34903
  if (cssKey === 'font-size') {
34695
34904
  const numValue = parseFloat(value.toString());
34696
34905
  if (editor.o.defaultFontSizePoints === 'pt') {
@@ -34724,7 +34933,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.controls.fontsize = {
34724
34933
  return keySet.has(normalize(value.toString()));
34725
34934
  }
34726
34935
  };
34727
- const hadSelection = new WeakSet();
34728
34936
  jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.controls.font = (0,_swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_1__._)((0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_0__._)({}, jodit_config__WEBPACK_IMPORTED_MODULE_7__.Config.prototype.controls.fontsize), {
34729
34937
  command: 'fontname',
34730
34938
  textTemplate: (j, value)=>{
@@ -35873,6 +36081,17 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.commandToHotkeys = {
35873
36081
  40: 'down',
35874
36082
  45: 'insert',
35875
36083
  46: 'del',
36084
+ // With Shift the digit keys send other characters: `&` for 7
36085
+ 48: '0',
36086
+ 49: '1',
36087
+ 50: '2',
36088
+ 51: '3',
36089
+ 52: '4',
36090
+ 53: '5',
36091
+ 54: '6',
36092
+ 55: '7',
36093
+ 56: '8',
36094
+ 57: '9',
35876
36095
  59: ';',
35877
36096
  61: '=',
35878
36097
  91: 'meta',