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
@@ -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
  */
@@ -1824,7 +1824,7 @@ __webpack_require__.r(__webpack_exports__);
1824
1824
  * ```
1825
1825
  * @packageDocumentation
1826
1826
  * @module constants
1827
- */ const APP_VERSION = "4.19.7";
1827
+ */ const APP_VERSION = "4.19.9";
1828
1828
  // prettier-ignore
1829
1829
  const ES = "es2021";
1830
1830
  const IS_ES_MODERN = true;
@@ -1963,6 +1963,8 @@ const EMULATE_DBLCLICK_TIMEOUT = 300;
1963
1963
  * ```
1964
1964
  */ const INSERT_ONLY_TEXT = 'insert_only_text';
1965
1965
  const SAFE_COUNT_CHANGE_CALL = 10;
1966
+ // Connector answer code for a file name that is already taken (same as the HTTP status)
1967
+ const ERROR_CODE_CONFLICT = 409;
1966
1968
  const IS_MAC = typeof globalWindow !== 'undefined' && /Mac|iPod|iPhone|iPad/.test(globalWindow.navigator.platform);
1967
1969
  const KEY_ALIASES = {
1968
1970
  add: '+',
@@ -2046,6 +2048,7 @@ const PASSIVE_EVENTS = new Set([
2046
2048
  /* harmony export */ "CLIPBOARD_ID", 0, /* binding */ CLIPBOARD_ID,
2047
2049
  /* harmony export */ "COMMAND_KEYS", 0, /* binding */ COMMAND_KEYS,
2048
2050
  /* harmony export */ "EMULATE_DBLCLICK_TIMEOUT", 0, /* binding */ EMULATE_DBLCLICK_TIMEOUT,
2051
+ /* harmony export */ "ERROR_CODE_CONFLICT", 0, /* binding */ ERROR_CODE_CONFLICT,
2049
2052
  /* harmony export */ "ES", 0, /* binding */ ES,
2050
2053
  /* harmony export */ "FAT_MODE", 0, /* binding */ FAT_MODE,
2051
2054
  /* harmony export */ "HOMEPAGE", 0, /* binding */ HOMEPAGE,
@@ -8745,6 +8748,7 @@ const dataBind = (elm, key, value)=>{
8745
8748
 
8746
8749
  "use strict";
8747
8750
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8751
+ /* harmony export */ answer: function() { return /* binding */ answer; },
8748
8752
  /* harmony export */ connection: function() { return /* binding */ connection; },
8749
8753
  /* harmony export */ error: function() { return /* binding */ error; },
8750
8754
  /* harmony export */ options: function() { return /* binding */ options; }
@@ -8768,6 +8772,9 @@ function connection(message) {
8768
8772
  function options(message) {
8769
8773
  return new _errors__WEBPACK_IMPORTED_MODULE_0__.OptionsError(message);
8770
8774
  }
8775
+ function answer(message, resp, code) {
8776
+ return new _errors__WEBPACK_IMPORTED_MODULE_0__.AnswerError(message, resp, code);
8777
+ }
8771
8778
 
8772
8779
 
8773
8780
  /***/ }),
@@ -8793,6 +8800,32 @@ function options(message) {
8793
8800
  }
8794
8801
 
8795
8802
 
8803
+ /***/ }),
8804
+
8805
+ /***/ 45052:
8806
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8807
+
8808
+ "use strict";
8809
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8810
+ /* harmony export */ AnswerError: function() { return /* binding */ AnswerError; }
8811
+ /* harmony export */ });
8812
+ /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
8813
+
8814
+ /*!
8815
+ * Jodit Editor (https://xdsoft.net/jodit/)
8816
+ * Released under MIT see LICENSE.txt in the project root for license information.
8817
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
8818
+ */ /**
8819
+ * @module helpers/utils
8820
+ */ // A connector refused the request: the answer and its `data.code` stay reachable for the handler
8821
+ class AnswerError extends Error {
8822
+ constructor(message, answer, code){
8823
+ super(message), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "answer", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "code", void 0), this.answer = answer, this.code = code;
8824
+ Object.setPrototypeOf(this, AnswerError.prototype);
8825
+ }
8826
+ }
8827
+
8828
+
8796
8829
  /***/ }),
8797
8830
 
8798
8831
  /***/ 58250:
@@ -8823,13 +8856,15 @@ function options(message) {
8823
8856
 
8824
8857
  "use strict";
8825
8858
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8826
- /* harmony export */ ConnectionError: function() { return /* reexport safe */ _connection_error__WEBPACK_IMPORTED_MODULE_1__.ConnectionError; },
8827
- /* harmony export */ OptionsError: function() { return /* reexport safe */ _options_error__WEBPACK_IMPORTED_MODULE_2__.OptionsError; },
8859
+ /* harmony export */ AnswerError: function() { return /* reexport safe */ _answer_error__WEBPACK_IMPORTED_MODULE_1__.AnswerError; },
8860
+ /* harmony export */ ConnectionError: function() { return /* reexport safe */ _connection_error__WEBPACK_IMPORTED_MODULE_2__.ConnectionError; },
8861
+ /* harmony export */ OptionsError: function() { return /* reexport safe */ _options_error__WEBPACK_IMPORTED_MODULE_3__.OptionsError; },
8828
8862
  /* harmony export */ abort: function() { return /* reexport safe */ _abort_error__WEBPACK_IMPORTED_MODULE_0__.abort; }
8829
8863
  /* harmony export */ });
8830
8864
  /* harmony import */ var _abort_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14228);
8831
- /* harmony import */ var _connection_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58250);
8832
- /* harmony import */ var _options_error__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11080);
8865
+ /* harmony import */ var _answer_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(45052);
8866
+ /* harmony import */ var _connection_error__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(58250);
8867
+ /* harmony import */ var _options_error__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11080);
8833
8868
  /*!
8834
8869
  * Jodit Editor (https://xdsoft.net/jodit/)
8835
8870
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -8841,6 +8876,7 @@ function options(message) {
8841
8876
 
8842
8877
 
8843
8878
 
8879
+
8844
8880
  /***/ }),
8845
8881
 
8846
8882
  /***/ 11080:
@@ -8871,9 +8907,11 @@ function options(message) {
8871
8907
 
8872
8908
  "use strict";
8873
8909
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8910
+ /* harmony export */ AnswerError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.AnswerError; },
8874
8911
  /* harmony export */ ConnectionError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.ConnectionError; },
8875
8912
  /* harmony export */ OptionsError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.OptionsError; },
8876
8913
  /* harmony export */ abort: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.abort; },
8914
+ /* harmony export */ answer: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.answer; },
8877
8915
  /* harmony export */ connection: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.connection; },
8878
8916
  /* harmony export */ error: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.error; },
8879
8917
  /* harmony export */ options: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.options; }
@@ -9115,6 +9153,7 @@ const isPart = (node, part)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom
9115
9153
  __webpack_require__.r(__webpack_exports__);
9116
9154
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9117
9155
  /* harmony export */ $$: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_27__.$$; },
9156
+ /* harmony export */ AnswerError: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.AnswerError; },
9118
9157
  /* harmony export */ ConfigDeepFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigDeepFlatten; },
9119
9158
  /* harmony export */ ConfigFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigFlatten; },
9120
9159
  /* harmony export */ ConfigMerge: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigMerge; },
@@ -9126,6 +9165,7 @@ __webpack_require__.r(__webpack_exports__);
9126
9165
  /* harmony export */ abort: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.abort; },
9127
9166
  /* harmony export */ alignElement: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.alignElement; },
9128
9167
  /* harmony export */ alreadyLoadedList: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.alreadyLoadedList; },
9168
+ /* harmony export */ answer: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.answer; },
9129
9169
  /* harmony export */ appendScriptAsync: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.appendScriptAsync; },
9130
9170
  /* harmony export */ appendStyleAsync: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.appendStyleAsync; },
9131
9171
  /* harmony export */ attr: function() { return /* reexport safe */ _attr__WEBPACK_IMPORTED_MODULE_3__.attr; },
@@ -9762,7 +9802,11 @@ const map = {};
9762
9802
  // element scrolled above the top was wrongly reported as visible and never
9763
9803
  // scrolled to. See #1279
9764
9804
  const clientHeight = doc.documentElement && doc.documentElement.clientHeight || 0;
9765
- return (top + height <= clientHeight + SUBPIXEL_TOLERANCE || top <= 0) && top + height >= 0;
9805
+ // `scrollIntoView` keeps clear of the document's `scroll-padding`, which
9806
+ // is how a page allows for a fixed header or footer, so its edges are the
9807
+ // viewport's edges here too
9808
+ const style = doc.defaultView?.getComputedStyle(doc.documentElement), padding = (value = '')=>value.endsWith('%') ? parseFloat(value) * clientHeight / 100 : parseFloat(value) || 0, viewTop = padding(style?.scrollPaddingTop), viewBottom = clientHeight - padding(style?.scrollPaddingBottom);
9809
+ return (top + height <= viewBottom + SUBPIXEL_TOLERANCE || top <= viewTop) && top + height >= viewTop;
9766
9810
  }
9767
9811
  /**
9768
9812
  * Scroll element into view if it is not in view
@@ -10705,6 +10749,23 @@ class Ajax {
10705
10749
  } catch {}
10706
10750
  return this;
10707
10751
  }
10752
+ // 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
10753
+ __hasAnswerEnvelope() {
10754
+ const { xhr } = this;
10755
+ if (xhr.responseType && xhr.responseType !== 'text') {
10756
+ return false;
10757
+ }
10758
+ const text = xhr.responseText;
10759
+ if (!text || text[0] !== '{') {
10760
+ return false;
10761
+ }
10762
+ try {
10763
+ const answer = JSON.parse(text);
10764
+ return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isPlainObject)(answer) && 'success' in answer;
10765
+ } catch {
10766
+ return false;
10767
+ }
10768
+ }
10708
10769
  send() {
10709
10770
  this.__activated = true;
10710
10771
  const { xhr, o } = this;
@@ -10738,7 +10799,7 @@ class Ajax {
10738
10799
  xhr.onreadystatechange = ()=>{
10739
10800
  this.options.onProgress?.(10);
10740
10801
  if (xhr.readyState === XMLHttpRequest.DONE) {
10741
- if (o.successStatuses.includes(xhr.status)) {
10802
+ if (o.successStatuses.includes(xhr.status) || this.__hasAnswerEnvelope()) {
10742
10803
  onResolve();
10743
10804
  } else if (xhr.statusText) {
10744
10805
  this.__isFulfilled = true;
@@ -11920,16 +11981,19 @@ class Selection {
11920
11981
  }
11921
11982
  if (sel && sel.rangeCount) {
11922
11983
  const range = sel.getRangeAt(0);
11923
- const { firstChild } = node;
11984
+ // A block has no first child outside itself to go by, and what's
11985
+ // left beside it would show as a line of its own
11986
+ const isBlock = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isBlock(node), first = isBlock ? node : node.firstChild;
11924
11987
  if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.area, range.commonAncestorContainer)) {
11925
11988
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeInsertNode(range, node);
11926
11989
  } else {
11927
11990
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(this.area, node);
11928
11991
  }
11929
11992
  [
11930
- ()=>firstChild?.previousSibling,
11931
- ()=>firstChild?.previousSibling,
11932
- ()=>firstChild?.previousSibling?.lastChild
11993
+ ()=>first?.previousSibling,
11994
+ ()=>first?.previousSibling,
11995
+ ()=>first?.previousSibling?.lastChild,
11996
+ ()=>isBlock ? node.nextSibling : null
11933
11997
  ].forEach((getChildNode)=>{
11934
11998
  const childNode = getChildNode();
11935
11999
  // Only a text node left with nothing in it by the split
@@ -21565,7 +21629,7 @@ class DataProvider {
21565
21629
  }).catch(()=>null);
21566
21630
  return promise.then((resp)=>resp.json()).then((resp)=>{
21567
21631
  if (resp && !this.isSuccess(resp)) {
21568
- throw new Error(this.getMessage(resp));
21632
+ throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.answer)(this.getMessage(resp), resp, resp.data?.code);
21569
21633
  }
21570
21634
  return resp;
21571
21635
  });
@@ -21700,7 +21764,7 @@ class DataProvider {
21700
21764
  if (this.isSuccess(resp)) {
21701
21765
  return resp.data;
21702
21766
  }
21703
- throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.error)(this.getMessage(resp));
21767
+ throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.answer)(this.getMessage(resp), resp, resp.data?.code);
21704
21768
  });
21705
21769
  }
21706
21770
  /**
@@ -26540,6 +26604,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.uploader = {
26540
26604
  defaultHandlerError (e) {
26541
26605
  this.j.message.error(e.message);
26542
26606
  },
26607
+ promptOnExists: true,
26608
+ promptOnExistsSuggestName (name) {
26609
+ return name;
26610
+ },
26543
26611
  contentType (requestData) {
26544
26612
  return this.ow.FormData !== undefined && typeof requestData !== 'string' ? false : 'application/x-www-form-urlencoded; charset=UTF-8';
26545
26613
  }
@@ -26716,8 +26784,12 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26716
26784
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
26717
26785
  /* harmony export */ sendFiles: function() { return /* binding */ sendFiles; }
26718
26786
  /* harmony export */ });
26719
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(65946);
26720
- /* harmony import */ var jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(77911);
26787
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
26788
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
26789
+ /* harmony import */ var jodit_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80512);
26790
+ /* harmony import */ var jodit_modules_dialog_prompt__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(74103);
26791
+ /* harmony import */ var jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(77911);
26792
+ /* harmony import */ var jodit_modules_uploader_helpers_upload_error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(55083);
26721
26793
  /*!
26722
26794
  * Jodit Editor (https://xdsoft.net/jodit/)
26723
26795
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -26726,24 +26798,46 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26726
26798
  * @module modules/uploader
26727
26799
  */
26728
26800
 
26801
+
26802
+
26803
+
26804
+
26729
26805
  /**
26730
26806
  * Send files to server
26731
- */ function sendFiles(uploader, files, handlerSuccess, handlerError, process) {
26807
+ */ async function sendFiles(uploader, files, handlerSuccess, handlerError, process, // Set when a refused upload is sent again: `beforeUpload` already had its say
26808
+ retryOf) {
26732
26809
  if (!files) {
26733
- return Promise.reject((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Need files'));
26810
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Need files');
26734
26811
  }
26735
26812
  const { o } = uploader;
26736
- let fileList = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.toArray)(files);
26813
+ let fileList = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.toArray)(files);
26737
26814
  if (!fileList.length) {
26738
- return Promise.reject((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Need files'));
26815
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Need files');
26739
26816
  }
26740
- // Client-side validation hook — returning `false` aborts the upload.
26817
+ let extraData = retryOf?.data;
26818
+ // Client-side validation hook — returning `false` aborts the upload, and it may hand back the files to send instead
26741
26819
  // See https://github.com/xdan/jodit/issues/1329
26742
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(o.beforeUpload)) {
26743
- if (o.beforeUpload.call(uploader, fileList) === false) {
26744
- const err = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Upload canceled');
26820
+ if (!retryOf && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(o.beforeUpload)) {
26821
+ let plan;
26822
+ try {
26823
+ plan = await o.beforeUpload.call(uploader, fileList);
26824
+ } catch (e) {
26825
+ (handlerError || o.defaultHandlerError).call(uploader, e);
26826
+ throw e;
26827
+ }
26828
+ if (plan === false) {
26829
+ const err = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Upload canceled');
26745
26830
  (handlerError || o.defaultHandlerError).call(uploader, err);
26746
- return Promise.reject(err);
26831
+ throw err;
26832
+ }
26833
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(plan)) {
26834
+ fileList = plan;
26835
+ } else if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(plan) && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(plan.files)) {
26836
+ fileList = plan.files;
26837
+ extraData = plan.data;
26838
+ }
26839
+ if (!fileList.length) {
26840
+ return [];
26747
26841
  }
26748
26842
  }
26749
26843
  const promises = [];
@@ -26783,20 +26877,35 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26783
26877
  if (process) {
26784
26878
  process(form);
26785
26879
  }
26786
- if (o.data && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isPlainObject)(o.data)) {
26880
+ if (o.data && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(o.data)) {
26787
26881
  Object.keys(o.data).forEach((key)=>{
26788
26882
  form.append(key, o.data[key]);
26789
26883
  });
26790
26884
  }
26885
+ if (extraData) {
26886
+ Object.keys(extraData).forEach((key)=>{
26887
+ form.append(key, extraData[key]);
26888
+ });
26889
+ }
26791
26890
  o.prepareData.call(uploader, form);
26792
- promises.push((0,jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_1__.send)(uploader, form).then((resp)=>{
26891
+ promises.push((0,jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_4__.send)(uploader, form).then((resp)=>{
26793
26892
  if (o.isSuccess.call(uploader, resp)) {
26794
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
26893
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
26795
26894
  handler.call(uploader, o.process.call(uploader, resp));
26796
26895
  return resp;
26797
26896
  }
26798
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
26799
- handler.call(uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)(o.getMessage.call(uploader, resp)));
26897
+ const err = new jodit_modules_uploader_helpers_upload_error__WEBPACK_IMPORTED_MODULE_5__.UploadError(o.getMessage.call(uploader, resp), resp, fileList, (plan)=>sendFiles(uploader, plan?.files ?? fileList, handlerSuccess, handlerError, process, {
26898
+ data: {
26899
+ ...extraData,
26900
+ ...plan?.data
26901
+ }
26902
+ }));
26903
+ // A taken name is part of the upload, not a failure: ask for another one first
26904
+ if (err.code === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.ERROR_CODE_CONFLICT && o.promptOnExists) {
26905
+ return askAnotherName(uploader, err);
26906
+ }
26907
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
26908
+ handler.call(uploader, err);
26800
26909
  return resp;
26801
26910
  }).then(()=>{
26802
26911
  uploader.j.events && uploader.j.e.fire('filesWereUploaded');
@@ -26804,6 +26913,45 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26804
26913
  }
26805
26914
  return Promise.all(promises);
26806
26915
  }
26916
+ function askAnotherName(uploader, err) {
26917
+ const { files } = err;
26918
+ // A batch is refused as a whole (the connector saved nothing) and the answer does not say which name is taken,
26919
+ // so the files go again one by one: the free ones are simply stored, the taken one answers 409 alone and gets its prompt
26920
+ if (files.length > 1) {
26921
+ return files.reduce((chain, file)=>chain.then(()=>err.retry({
26922
+ files: [
26923
+ file
26924
+ ]
26925
+ })), Promise.resolve());
26926
+ }
26927
+ const [file] = files;
26928
+ const { j, o } = uploader;
26929
+ return new Promise((resolve)=>{
26930
+ let answered = false;
26931
+ // `Dlgs.prototype.dlg`: the uploader's view does not always carry the Dlgs trait
26932
+ const dialog = jodit_modules_dialog_prompt__WEBPACK_IMPORTED_MODULE_3__.Prompt.call(jodit_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_2__.Dlgs.prototype.dlg.call(j, {
26933
+ closeOnClickOverlay: true
26934
+ }), j.i18n(err.message), j.i18n('Rename'), (newName)=>{
26935
+ newName = newName.trim();
26936
+ if (!newName) {
26937
+ return false;
26938
+ }
26939
+ answered = true;
26940
+ resolve(err.retry({
26941
+ files: [
26942
+ new File([
26943
+ file
26944
+ ], newName, {
26945
+ type: file.type
26946
+ })
26947
+ ]
26948
+ }));
26949
+ }, j.i18n('Enter new name'), o.promptOnExistsSuggestName.call(uploader, file.name));
26950
+ dialog.e.on(dialog, 'afterClose', ()=>{
26951
+ !answered && resolve(undefined);
26952
+ });
26953
+ });
26954
+ }
26807
26955
  function readImagesWithReader(fileList, imagesExtensions, promises, uploader, handlerSuccess, defaultHandlerSuccess) {
26808
26956
  const readerPromises = [];
26809
26957
  let file, i;
@@ -26832,7 +26980,7 @@ function readImagesWithReader(fileList, imagesExtensions, promises, uploader, ha
26832
26980
  name
26833
26981
  ]
26834
26982
  };
26835
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerSuccess) ? handlerSuccess : defaultHandlerSuccess;
26983
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerSuccess) ? handlerSuccess : defaultHandlerSuccess;
26836
26984
  handler.call(uploader, resp);
26837
26985
  resolve(resp);
26838
26986
  };
@@ -26948,6 +27096,34 @@ function send(uploader, data) {
26948
27096
  /* harmony export */ ]);
26949
27097
 
26950
27098
 
27099
+ /***/ }),
27100
+
27101
+ /***/ 55083:
27102
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
27103
+
27104
+ "use strict";
27105
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
27106
+ /* harmony export */ UploadError: function() { return /* binding */ UploadError; }
27107
+ /* harmony export */ });
27108
+ /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
27109
+ /* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33201);
27110
+ /*!
27111
+ * Jodit Editor (https://xdsoft.net/jodit/)
27112
+ * Released under MIT see LICENSE.txt in the project root for license information.
27113
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
27114
+ */ /**
27115
+ * @module modules/uploader
27116
+ */
27117
+
27118
+ // The connector refused these files: the handler can change the request and send it again
27119
+ class UploadError extends jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__.AnswerError {
27120
+ constructor(message, answer, files, retry){
27121
+ super(message, answer, answer.data?.code), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "files", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "retry", void 0), this.files = files, this.retry = retry;
27122
+ Object.setPrototypeOf(this, UploadError.prototype);
27123
+ }
27124
+ }
27125
+
27126
+
26951
27127
  /***/ }),
26952
27128
 
26953
27129
  /***/ 94925:
@@ -26962,9 +27138,10 @@ function send(uploader, data) {
26962
27138
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
26963
27139
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23211);
26964
27140
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
26965
- /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5266);
26966
- /* harmony import */ var jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(11981);
26967
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(40013);
27141
+ /* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(33201);
27142
+ /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5266);
27143
+ /* harmony import */ var jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11981);
27144
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(40013);
26968
27145
  /*!
26969
27146
  * Jodit Editor (https://xdsoft.net/jodit/)
26970
27147
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -26982,6 +27159,7 @@ function send(uploader, data) {
26982
27159
 
26983
27160
 
26984
27161
 
27162
+
26985
27163
  class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewComponent {
26986
27164
  get j() {
26987
27165
  return this.jodit;
@@ -27037,14 +27215,14 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27037
27215
  }
27038
27216
  };
27039
27217
  // send data on server
27040
- if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(cData)) {
27041
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, cData.files, handlerSuccess, handlerError).finally(onFinally);
27218
+ if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(cData)) {
27219
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, cData.files, handlerSuccess, handlerError).finally(onFinally);
27042
27220
  return false;
27043
27221
  }
27044
27222
  if (jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && !jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_ES_NEXT) {
27045
- return (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.processOldBrowserDrag)(self, cData, handlerSuccess, handlerError, onFinally);
27223
+ return (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.processOldBrowserDrag)(self, cData, handlerSuccess, handlerError, onFinally);
27046
27224
  }
27047
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasItems)(cData)) {
27225
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasItems)(cData)) {
27048
27226
  const { items } = cData;
27049
27227
  for(i = 0; i < items.length; i += 1){
27050
27228
  if (items[i].kind === 'file' && items[i].type === 'image/png') {
@@ -27052,7 +27230,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27052
27230
  if (file) {
27053
27231
  const mime = file.type.match(/\/([a-z0-9]+)/i);
27054
27232
  extension = mime[1] ? mime[1].toLowerCase() : '';
27055
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, [
27233
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, [
27056
27234
  file
27057
27235
  ], handlerSuccess, handlerError, processData).finally(onFinally);
27058
27236
  }
@@ -27074,27 +27252,27 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27074
27252
  self.j.e.on(form, 'dragend dragover dragenter dragleave drop', (e)=>{
27075
27253
  e.preventDefault();
27076
27254
  }).on(form, 'dragover', (event)=>{
27077
- 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)) {
27255
+ 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)) {
27078
27256
  form.classList.add('jodit_drag_hover');
27079
27257
  event.preventDefault();
27080
27258
  }
27081
27259
  }).on(form, 'dragend dragleave', (event)=>{
27082
27260
  form.classList.remove('jodit_drag_hover');
27083
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(event.dataTransfer)) {
27261
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
27084
27262
  event.preventDefault();
27085
27263
  }
27086
27264
  }).on(form, 'drop', (event)=>{
27087
27265
  form.classList.remove('jodit_drag_hover');
27088
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(event.dataTransfer)) {
27266
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
27089
27267
  event.preventDefault();
27090
27268
  event.stopImmediatePropagation();
27091
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, event.dataTransfer.files, handlerSuccess, handlerError).finally(onFinally);
27269
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, event.dataTransfer.files, handlerSuccess, handlerError).finally(onFinally);
27092
27270
  }
27093
27271
  });
27094
27272
  const inputFile = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.first(form, (node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isTag(node, 'input') && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.attr)(node, 'type')?.toLowerCase() === 'file');
27095
27273
  if (inputFile) {
27096
27274
  self.j.e.on(inputFile, 'change', ()=>{
27097
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, inputFile.files, handlerSuccess, handlerError).then(()=>{
27275
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, inputFile.files, handlerSuccess, handlerError).then(()=>{
27098
27276
  inputFile.value = '';
27099
27277
  if (!/safari/i.test(navigator.userAgent)) {
27100
27278
  inputFile.type = '';
@@ -27109,7 +27287,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27109
27287
  */ uploadRemoteImage(url, handlerSuccess, handlerError) {
27110
27288
  const uploader = this, { o } = uploader;
27111
27289
  const handlerE = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
27112
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.send)(uploader, {
27290
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.send)(uploader, {
27113
27291
  action: 'fileUploadRemote',
27114
27292
  url
27115
27293
  }).then((resp)=>{
@@ -27118,17 +27296,31 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27118
27296
  handler.call(uploader, o.process.call(uploader, resp));
27119
27297
  return;
27120
27298
  }
27121
- handlerE.call(uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.error)(o.getMessage.call(uploader, resp)));
27299
+ handlerE.call(uploader, (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__.answer)(o.getMessage.call(uploader, resp), resp, resp.data?.code));
27122
27300
  }).catch((e)=>handlerE.call(uploader, e));
27123
27301
  }
27124
27302
  upload(files) {
27125
27303
  return this.async.promise((resolve, reject)=>{
27126
- ;(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(this, files, resolve, reject);
27304
+ let settled = false;
27305
+ const settle = (end)=>(value)=>{
27306
+ settled = true;
27307
+ end(value);
27308
+ };
27309
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(this, files, settle(resolve), settle(reject)).then(()=>{
27310
+ // `beforeUpload` kept no file, so no handler ran
27311
+ if (!settled) {
27312
+ resolve({
27313
+ baseurl: '',
27314
+ files: [],
27315
+ isImages: []
27316
+ });
27317
+ }
27318
+ }, settle(reject));
27127
27319
  });
27128
27320
  }
27129
27321
  destruct() {
27130
27322
  this.setStatus(jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.STATUSES.beforeDestruct);
27131
- const instances = jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.ajaxInstances.get(this);
27323
+ const instances = jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.ajaxInstances.get(this);
27132
27324
  if (instances) {
27133
27325
  instances.forEach((ajax)=>{
27134
27326
  try {
@@ -27141,7 +27333,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27141
27333
  }
27142
27334
  constructor(editor, options){
27143
27335
  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);
27144
- 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 : {}));
27336
+ 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 : {}));
27145
27337
  }
27146
27338
  }
27147
27339
 
@@ -33327,7 +33519,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('enter', enter);
33327
33519
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(br, clone);
33328
33520
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(clone, fake);
33329
33521
  }
33330
- ;(0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_2__.scrollIntoViewIfNeeded)(br, jodit.editor, jodit.ed);
33522
+ // The new `br` ends the line above, so it takes something on the
33523
+ // caret's own line to bring that line into view. Chrome won't scroll to
33524
+ // an inline element without width, but it will to a `br`
33525
+ const mark = br.cloneNode();
33526
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(fake, mark);
33527
+ (0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_2__.scrollIntoViewIfNeeded)(mark, jodit.editor, jodit.ed);
33528
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(mark);
33331
33529
  return true;
33332
33530
  }
33333
33531
  return false;
@@ -33988,6 +34186,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.font = {
33988
34186
  }
33989
34187
  };
33990
34188
  jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_4__.Icon.set('font', (_icons_font_svg__WEBPACK_IMPORTED_MODULE_6___default())).set('fontsize', (_icons_fontsize_svg__WEBPACK_IMPORTED_MODULE_7___default()));
34189
+ const hadSelection = new WeakSet();
33991
34190
  jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize = {
33992
34191
  command: 'fontsize',
33993
34192
  data: {
@@ -34023,17 +34222,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize = {
34023
34222
  },
34024
34223
  tooltip: 'Font size',
34025
34224
  value: (editor, button)=>{
34026
- const current = editor.s.current();
34027
- if (!current) {
34028
- return;
34029
- }
34030
- const box = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement, editor.editor);
34031
- if (!box) {
34225
+ const current = editor.s.current(), box = current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement, editor.editor), control = button.control;
34226
+ // A select names its value, so until there is a selection it shows the
34227
+ // editor's own size, and afterwards the size of the last one
34228
+ if (box) {
34229
+ hadSelection.add(button);
34230
+ } else if (control.component !== 'select' || hadSelection.has(button)) {
34032
34231
  return;
34033
34232
  }
34034
- const control = button.control;
34035
34233
  const cssKey = control.data?.cssRule || 'font-size';
34036
- const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(box, cssKey);
34234
+ const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(box || editor.editor, cssKey);
34037
34235
  if (cssKey === 'font-size') {
34038
34236
  const numValue = parseFloat(value.toString());
34039
34237
  if (editor.o.defaultFontSizePoints === 'pt') {
@@ -34063,7 +34261,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize = {
34063
34261
  return keySet.has(normalize(value.toString()));
34064
34262
  }
34065
34263
  };
34066
- const hadSelection = new WeakSet();
34067
34264
  jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.font = {
34068
34265
  ...jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize,
34069
34266
  command: 'fontname',
@@ -35198,6 +35395,17 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.commandToHotkeys = {
35198
35395
  40: 'down',
35199
35396
  45: 'insert',
35200
35397
  46: 'del',
35398
+ // With Shift the digit keys send other characters: `&` for 7
35399
+ 48: '0',
35400
+ 49: '1',
35401
+ 50: '2',
35402
+ 51: '3',
35403
+ 52: '4',
35404
+ 53: '5',
35405
+ 54: '6',
35406
+ 55: '7',
35407
+ 56: '8',
35408
+ 57: '9',
35201
35409
  59: ';',
35202
35410
  61: '=',
35203
35411
  91: 'meta',