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/es2021/jodit.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
3
3
  * Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
4
- * Version: v4.19.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
@@ -21589,7 +21653,7 @@ class DataProvider {
21589
21653
  }).catch(()=>null);
21590
21654
  return promise.then((resp)=>resp.json()).then((resp)=>{
21591
21655
  if (resp && !this.isSuccess(resp)) {
21592
- throw new Error(this.getMessage(resp));
21656
+ throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.answer)(this.getMessage(resp), resp, resp.data?.code);
21593
21657
  }
21594
21658
  return resp;
21595
21659
  });
@@ -21724,7 +21788,7 @@ class DataProvider {
21724
21788
  if (this.isSuccess(resp)) {
21725
21789
  return resp.data;
21726
21790
  }
21727
- throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.error)(this.getMessage(resp));
21791
+ throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.answer)(this.getMessage(resp), resp, resp.data?.code);
21728
21792
  });
21729
21793
  }
21730
21794
  /**
@@ -26564,6 +26628,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.uploader = {
26564
26628
  defaultHandlerError (e) {
26565
26629
  this.j.message.error(e.message);
26566
26630
  },
26631
+ promptOnExists: true,
26632
+ promptOnExistsSuggestName (name) {
26633
+ return name;
26634
+ },
26567
26635
  contentType (requestData) {
26568
26636
  return this.ow.FormData !== undefined && typeof requestData !== 'string' ? false : 'application/x-www-form-urlencoded; charset=UTF-8';
26569
26637
  }
@@ -26740,8 +26808,12 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26740
26808
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
26741
26809
  /* harmony export */ sendFiles: function() { return /* binding */ sendFiles; }
26742
26810
  /* harmony export */ });
26743
- /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(65946);
26744
- /* harmony import */ var jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(77911);
26811
+ /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
26812
+ /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
26813
+ /* harmony import */ var jodit_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80512);
26814
+ /* harmony import */ var jodit_modules_dialog_prompt__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(74103);
26815
+ /* harmony import */ var jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(77911);
26816
+ /* harmony import */ var jodit_modules_uploader_helpers_upload_error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(55083);
26745
26817
  /*!
26746
26818
  * Jodit Editor (https://xdsoft.net/jodit/)
26747
26819
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -26750,24 +26822,46 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26750
26822
  * @module modules/uploader
26751
26823
  */
26752
26824
 
26825
+
26826
+
26827
+
26828
+
26753
26829
  /**
26754
26830
  * Send files to server
26755
- */ function sendFiles(uploader, files, handlerSuccess, handlerError, process) {
26831
+ */ async function sendFiles(uploader, files, handlerSuccess, handlerError, process, // Set when a refused upload is sent again: `beforeUpload` already had its say
26832
+ retryOf) {
26756
26833
  if (!files) {
26757
- return Promise.reject((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Need files'));
26834
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Need files');
26758
26835
  }
26759
26836
  const { o } = uploader;
26760
- let fileList = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.toArray)(files);
26837
+ let fileList = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.toArray)(files);
26761
26838
  if (!fileList.length) {
26762
- return Promise.reject((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Need files'));
26839
+ throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Need files');
26763
26840
  }
26764
- // Client-side validation hook — returning `false` aborts the upload.
26841
+ let extraData = retryOf?.data;
26842
+ // Client-side validation hook — returning `false` aborts the upload, and it may hand back the files to send instead
26765
26843
  // See https://github.com/xdan/jodit/issues/1329
26766
- if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(o.beforeUpload)) {
26767
- if (o.beforeUpload.call(uploader, fileList) === false) {
26768
- const err = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)('Upload canceled');
26844
+ if (!retryOf && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(o.beforeUpload)) {
26845
+ let plan;
26846
+ try {
26847
+ plan = await o.beforeUpload.call(uploader, fileList);
26848
+ } catch (e) {
26849
+ (handlerError || o.defaultHandlerError).call(uploader, e);
26850
+ throw e;
26851
+ }
26852
+ if (plan === false) {
26853
+ const err = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Upload canceled');
26769
26854
  (handlerError || o.defaultHandlerError).call(uploader, err);
26770
- return Promise.reject(err);
26855
+ throw err;
26856
+ }
26857
+ if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(plan)) {
26858
+ fileList = plan;
26859
+ } else if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(plan) && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(plan.files)) {
26860
+ fileList = plan.files;
26861
+ extraData = plan.data;
26862
+ }
26863
+ if (!fileList.length) {
26864
+ return [];
26771
26865
  }
26772
26866
  }
26773
26867
  const promises = [];
@@ -26807,20 +26901,35 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26807
26901
  if (process) {
26808
26902
  process(form);
26809
26903
  }
26810
- if (o.data && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isPlainObject)(o.data)) {
26904
+ if (o.data && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(o.data)) {
26811
26905
  Object.keys(o.data).forEach((key)=>{
26812
26906
  form.append(key, o.data[key]);
26813
26907
  });
26814
26908
  }
26909
+ if (extraData) {
26910
+ Object.keys(extraData).forEach((key)=>{
26911
+ form.append(key, extraData[key]);
26912
+ });
26913
+ }
26815
26914
  o.prepareData.call(uploader, form);
26816
- promises.push((0,jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_1__.send)(uploader, form).then((resp)=>{
26915
+ promises.push((0,jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_4__.send)(uploader, form).then((resp)=>{
26817
26916
  if (o.isSuccess.call(uploader, resp)) {
26818
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
26917
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
26819
26918
  handler.call(uploader, o.process.call(uploader, resp));
26820
26919
  return resp;
26821
26920
  }
26822
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
26823
- handler.call(uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.error)(o.getMessage.call(uploader, resp)));
26921
+ 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, {
26922
+ data: {
26923
+ ...extraData,
26924
+ ...plan?.data
26925
+ }
26926
+ }));
26927
+ // A taken name is part of the upload, not a failure: ask for another one first
26928
+ if (err.code === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.ERROR_CODE_CONFLICT && o.promptOnExists) {
26929
+ return askAnotherName(uploader, err);
26930
+ }
26931
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
26932
+ handler.call(uploader, err);
26824
26933
  return resp;
26825
26934
  }).then(()=>{
26826
26935
  uploader.j.events && uploader.j.e.fire('filesWereUploaded');
@@ -26828,6 +26937,45 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
26828
26937
  }
26829
26938
  return Promise.all(promises);
26830
26939
  }
26940
+ function askAnotherName(uploader, err) {
26941
+ const { files } = err;
26942
+ // A batch is refused as a whole (the connector saved nothing) and the answer does not say which name is taken,
26943
+ // so the files go again one by one: the free ones are simply stored, the taken one answers 409 alone and gets its prompt
26944
+ if (files.length > 1) {
26945
+ return files.reduce((chain, file)=>chain.then(()=>err.retry({
26946
+ files: [
26947
+ file
26948
+ ]
26949
+ })), Promise.resolve());
26950
+ }
26951
+ const [file] = files;
26952
+ const { j, o } = uploader;
26953
+ return new Promise((resolve)=>{
26954
+ let answered = false;
26955
+ // `Dlgs.prototype.dlg`: the uploader's view does not always carry the Dlgs trait
26956
+ 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, {
26957
+ closeOnClickOverlay: true
26958
+ }), j.i18n(err.message), j.i18n('Rename'), (newName)=>{
26959
+ newName = newName.trim();
26960
+ if (!newName) {
26961
+ return false;
26962
+ }
26963
+ answered = true;
26964
+ resolve(err.retry({
26965
+ files: [
26966
+ new File([
26967
+ file
26968
+ ], newName, {
26969
+ type: file.type
26970
+ })
26971
+ ]
26972
+ }));
26973
+ }, j.i18n('Enter new name'), o.promptOnExistsSuggestName.call(uploader, file.name));
26974
+ dialog.e.on(dialog, 'afterClose', ()=>{
26975
+ !answered && resolve(undefined);
26976
+ });
26977
+ });
26978
+ }
26831
26979
  function readImagesWithReader(fileList, imagesExtensions, promises, uploader, handlerSuccess, defaultHandlerSuccess) {
26832
26980
  const readerPromises = [];
26833
26981
  let file, i;
@@ -26856,7 +27004,7 @@ function readImagesWithReader(fileList, imagesExtensions, promises, uploader, ha
26856
27004
  name
26857
27005
  ]
26858
27006
  };
26859
- const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handlerSuccess) ? handlerSuccess : defaultHandlerSuccess;
27007
+ const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerSuccess) ? handlerSuccess : defaultHandlerSuccess;
26860
27008
  handler.call(uploader, resp);
26861
27009
  resolve(resp);
26862
27010
  };
@@ -26972,6 +27120,34 @@ function send(uploader, data) {
26972
27120
  /* harmony export */ ]);
26973
27121
 
26974
27122
 
27123
+ /***/ }),
27124
+
27125
+ /***/ 55083:
27126
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
27127
+
27128
+ "use strict";
27129
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
27130
+ /* harmony export */ UploadError: function() { return /* binding */ UploadError; }
27131
+ /* harmony export */ });
27132
+ /* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
27133
+ /* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33201);
27134
+ /*!
27135
+ * Jodit Editor (https://xdsoft.net/jodit/)
27136
+ * Released under MIT see LICENSE.txt in the project root for license information.
27137
+ * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
27138
+ */ /**
27139
+ * @module modules/uploader
27140
+ */
27141
+
27142
+ // The connector refused these files: the handler can change the request and send it again
27143
+ class UploadError extends jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__.AnswerError {
27144
+ constructor(message, answer, files, retry){
27145
+ 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;
27146
+ Object.setPrototypeOf(this, UploadError.prototype);
27147
+ }
27148
+ }
27149
+
27150
+
26975
27151
  /***/ }),
26976
27152
 
26977
27153
  /***/ 94925:
@@ -26986,9 +27162,10 @@ function send(uploader, data) {
26986
27162
  /* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
26987
27163
  /* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23211);
26988
27164
  /* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
26989
- /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5266);
26990
- /* harmony import */ var jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(11981);
26991
- /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(40013);
27165
+ /* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(33201);
27166
+ /* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5266);
27167
+ /* harmony import */ var jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11981);
27168
+ /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(40013);
26992
27169
  /*!
26993
27170
  * Jodit Editor (https://xdsoft.net/jodit/)
26994
27171
  * Released under MIT see LICENSE.txt in the project root for license information.
@@ -27006,6 +27183,7 @@ function send(uploader, data) {
27006
27183
 
27007
27184
 
27008
27185
 
27186
+
27009
27187
  class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewComponent {
27010
27188
  get j() {
27011
27189
  return this.jodit;
@@ -27061,14 +27239,14 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27061
27239
  }
27062
27240
  };
27063
27241
  // send data on server
27064
- if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(cData)) {
27065
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, cData.files, handlerSuccess, handlerError).finally(onFinally);
27242
+ if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(cData)) {
27243
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, cData.files, handlerSuccess, handlerError).finally(onFinally);
27066
27244
  return false;
27067
27245
  }
27068
27246
  if (jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && !jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_ES_NEXT) {
27069
- return (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.processOldBrowserDrag)(self, cData, handlerSuccess, handlerError, onFinally);
27247
+ return (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.processOldBrowserDrag)(self, cData, handlerSuccess, handlerError, onFinally);
27070
27248
  }
27071
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasItems)(cData)) {
27249
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasItems)(cData)) {
27072
27250
  const { items } = cData;
27073
27251
  for(i = 0; i < items.length; i += 1){
27074
27252
  if (items[i].kind === 'file' && items[i].type === 'image/png') {
@@ -27076,7 +27254,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27076
27254
  if (file) {
27077
27255
  const mime = file.type.match(/\/([a-z0-9]+)/i);
27078
27256
  extension = mime[1] ? mime[1].toLowerCase() : '';
27079
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, [
27257
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, [
27080
27258
  file
27081
27259
  ], handlerSuccess, handlerError, processData).finally(onFinally);
27082
27260
  }
@@ -27098,27 +27276,27 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27098
27276
  self.j.e.on(form, 'dragend dragover dragenter dragleave drop', (e)=>{
27099
27277
  e.preventDefault();
27100
27278
  }).on(form, 'dragover', (event)=>{
27101
- 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)) {
27279
+ 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)) {
27102
27280
  form.classList.add('jodit_drag_hover');
27103
27281
  event.preventDefault();
27104
27282
  }
27105
27283
  }).on(form, 'dragend dragleave', (event)=>{
27106
27284
  form.classList.remove('jodit_drag_hover');
27107
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(event.dataTransfer)) {
27285
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
27108
27286
  event.preventDefault();
27109
27287
  }
27110
27288
  }).on(form, 'drop', (event)=>{
27111
27289
  form.classList.remove('jodit_drag_hover');
27112
- if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.hasFiles)(event.dataTransfer)) {
27290
+ if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
27113
27291
  event.preventDefault();
27114
27292
  event.stopImmediatePropagation();
27115
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, event.dataTransfer.files, handlerSuccess, handlerError).finally(onFinally);
27293
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, event.dataTransfer.files, handlerSuccess, handlerError).finally(onFinally);
27116
27294
  }
27117
27295
  });
27118
27296
  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');
27119
27297
  if (inputFile) {
27120
27298
  self.j.e.on(inputFile, 'change', ()=>{
27121
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(self, inputFile.files, handlerSuccess, handlerError).then(()=>{
27299
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, inputFile.files, handlerSuccess, handlerError).then(()=>{
27122
27300
  inputFile.value = '';
27123
27301
  if (!/safari/i.test(navigator.userAgent)) {
27124
27302
  inputFile.type = '';
@@ -27133,7 +27311,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27133
27311
  */ uploadRemoteImage(url, handlerSuccess, handlerError) {
27134
27312
  const uploader = this, { o } = uploader;
27135
27313
  const handlerE = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
27136
- (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.send)(uploader, {
27314
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.send)(uploader, {
27137
27315
  action: 'fileUploadRemote',
27138
27316
  url
27139
27317
  }).then((resp)=>{
@@ -27142,17 +27320,31 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27142
27320
  handler.call(uploader, o.process.call(uploader, resp));
27143
27321
  return;
27144
27322
  }
27145
- handlerE.call(uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.error)(o.getMessage.call(uploader, resp)));
27323
+ handlerE.call(uploader, (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__.answer)(o.getMessage.call(uploader, resp), resp, resp.data?.code));
27146
27324
  }).catch((e)=>handlerE.call(uploader, e));
27147
27325
  }
27148
27326
  upload(files) {
27149
27327
  return this.async.promise((resolve, reject)=>{
27150
- ;(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.sendFiles)(this, files, resolve, reject);
27328
+ let settled = false;
27329
+ const settle = (end)=>(value)=>{
27330
+ settled = true;
27331
+ end(value);
27332
+ };
27333
+ (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(this, files, settle(resolve), settle(reject)).then(()=>{
27334
+ // `beforeUpload` kept no file, so no handler ran
27335
+ if (!settled) {
27336
+ resolve({
27337
+ baseurl: '',
27338
+ files: [],
27339
+ isImages: []
27340
+ });
27341
+ }
27342
+ }, settle(reject));
27151
27343
  });
27152
27344
  }
27153
27345
  destruct() {
27154
27346
  this.setStatus(jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.STATUSES.beforeDestruct);
27155
- const instances = jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_6__.ajaxInstances.get(this);
27347
+ const instances = jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.ajaxInstances.get(this);
27156
27348
  if (instances) {
27157
27349
  instances.forEach((ajax)=>{
27158
27350
  try {
@@ -27165,7 +27357,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
27165
27357
  }
27166
27358
  constructor(editor, options){
27167
27359
  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);
27168
- 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 : {}));
27360
+ 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 : {}));
27169
27361
  }
27170
27362
  }
27171
27363
 
@@ -33714,7 +33906,13 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('enter', enter);
33714
33906
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.after(br, clone);
33715
33907
  jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(clone, fake);
33716
33908
  }
33717
- ;(0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_2__.scrollIntoViewIfNeeded)(br, jodit.editor, jodit.ed);
33909
+ // The new `br` ends the line above, so it takes something on the
33910
+ // caret's own line to bring that line into view. Chrome won't scroll to
33911
+ // an inline element without width, but it will to a `br`
33912
+ const mark = br.cloneNode();
33913
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.before(fake, mark);
33914
+ (0,jodit_core_helpers_utils_scroll_into_view__WEBPACK_IMPORTED_MODULE_2__.scrollIntoViewIfNeeded)(mark, jodit.editor, jodit.ed);
33915
+ jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.safeRemove(mark);
33718
33916
  return true;
33719
33917
  }
33720
33918
  return false;
@@ -34375,6 +34573,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.font = {
34375
34573
  }
34376
34574
  };
34377
34575
  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()));
34576
+ const hadSelection = new WeakSet();
34378
34577
  jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize = {
34379
34578
  command: 'fontsize',
34380
34579
  data: {
@@ -34410,17 +34609,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize = {
34410
34609
  },
34411
34610
  tooltip: 'Font size',
34412
34611
  value: (editor, button)=>{
34413
- const current = editor.s.current();
34414
- if (!current) {
34415
- return;
34416
- }
34417
- const box = jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(current, jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isElement, editor.editor);
34418
- if (!box) {
34612
+ 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;
34613
+ // A select names its value, so until there is a selection it shows the
34614
+ // editor's own size, and afterwards the size of the last one
34615
+ if (box) {
34616
+ hadSelection.add(button);
34617
+ } else if (control.component !== 'select' || hadSelection.has(button)) {
34419
34618
  return;
34420
34619
  }
34421
- const control = button.control;
34422
34620
  const cssKey = control.data?.cssRule || 'font-size';
34423
- const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(box, cssKey);
34621
+ const value = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(box || editor.editor, cssKey);
34424
34622
  if (cssKey === 'font-size') {
34425
34623
  const numValue = parseFloat(value.toString());
34426
34624
  if (editor.o.defaultFontSizePoints === 'pt') {
@@ -34450,7 +34648,6 @@ jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize = {
34450
34648
  return keySet.has(normalize(value.toString()));
34451
34649
  }
34452
34650
  };
34453
- const hadSelection = new WeakSet();
34454
34651
  jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.font = {
34455
34652
  ...jodit_config__WEBPACK_IMPORTED_MODULE_5__.Config.prototype.controls.fontsize,
34456
34653
  command: 'fontname',
@@ -35585,6 +35782,17 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.commandToHotkeys = {
35585
35782
  40: 'down',
35586
35783
  45: 'insert',
35587
35784
  46: 'del',
35785
+ // With Shift the digit keys send other characters: `&` for 7
35786
+ 48: '0',
35787
+ 49: '1',
35788
+ 50: '2',
35789
+ 51: '3',
35790
+ 52: '4',
35791
+ 53: '5',
35792
+ 54: '6',
35793
+ 55: '7',
35794
+ 56: '8',
35795
+ 57: '9',
35588
35796
  59: ';',
35589
35797
  61: '=',
35590
35798
  91: 'meta',