jodit 4.19.7 → 4.19.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +8 -8
- package/es2015/jodit.js +295 -100
- package/es2015/jodit.min.js +4 -4
- package/es2015/plugins/debug/debug.css +1 -1
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.fat.min.js +8 -8
- package/es2018/jodit.min.js +4 -4
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.js +9 -9
- package/es2021/jodit.js +229 -44
- package/es2021/jodit.min.js +57 -57
- package/es2021/plugins/debug/debug.css +1 -1
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +1 -1
- package/es2021.en/jodit.fat.min.js +5 -5
- package/es2021.en/jodit.js +229 -44
- package/es2021.en/jodit.min.js +5 -5
- package/es2021.en/plugins/debug/debug.css +1 -1
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/jodit.css +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +371 -103
- package/es5/jodit.min.css +2 -2
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/core/constants.d.ts +1 -0
- package/esm/core/constants.js +3 -1
- package/esm/core/helpers/utils/error/error.d.ts +1 -0
- package/esm/core/helpers/utils/error/error.js +4 -1
- package/esm/core/helpers/utils/error/errors/answer-error.d.ts +13 -0
- package/esm/core/helpers/utils/error/errors/answer-error.js +17 -0
- package/esm/core/helpers/utils/error/errors/index.d.ts +1 -0
- package/esm/core/helpers/utils/error/errors/index.js +1 -0
- package/esm/core/request/ajax.d.ts +1 -0
- package/esm/core/request/ajax.js +20 -1
- package/esm/modules/file-browser/data-provider.js +5 -3
- package/esm/modules/uploader/config.js +4 -0
- package/esm/modules/uploader/helpers/send-files.d.ts +2 -2
- package/esm/modules/uploader/helpers/send-files.js +76 -9
- package/esm/modules/uploader/helpers/upload-error.d.ts +15 -0
- package/esm/modules/uploader/helpers/upload-error.js +16 -0
- package/esm/modules/uploader/uploader.js +15 -3
- package/esm/types/uploader.d.ts +117 -11
- package/package.json +2 -2
- package/types/core/constants.d.ts +1 -0
- package/types/core/helpers/utils/error/error.d.ts +1 -0
- package/types/core/helpers/utils/error/errors/answer-error.d.ts +13 -0
- package/types/core/helpers/utils/error/errors/index.d.ts +1 -0
- package/types/core/request/ajax.d.ts +1 -0
- package/types/modules/uploader/helpers/send-files.d.ts +2 -2
- package/types/modules/uploader/helpers/upload-error.d.ts +15 -0
- 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.
|
|
4
|
+
* Version: v4.19.8
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -1824,7 +1824,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1824
1824
|
* ```
|
|
1825
1825
|
* @packageDocumentation
|
|
1826
1826
|
* @module constants
|
|
1827
|
-
*/ const APP_VERSION = "4.19.
|
|
1827
|
+
*/ const APP_VERSION = "4.19.8";
|
|
1828
1828
|
// prettier-ignore
|
|
1829
1829
|
const ES = "es2021";
|
|
1830
1830
|
const IS_ES_MODERN = true;
|
|
@@ -1963,6 +1963,8 @@ const EMULATE_DBLCLICK_TIMEOUT = 300;
|
|
|
1963
1963
|
* ```
|
|
1964
1964
|
*/ const INSERT_ONLY_TEXT = 'insert_only_text';
|
|
1965
1965
|
const SAFE_COUNT_CHANGE_CALL = 10;
|
|
1966
|
+
// Connector answer code for a file name that is already taken (same as the HTTP status)
|
|
1967
|
+
const ERROR_CODE_CONFLICT = 409;
|
|
1966
1968
|
const IS_MAC = typeof globalWindow !== 'undefined' && /Mac|iPod|iPhone|iPad/.test(globalWindow.navigator.platform);
|
|
1967
1969
|
const KEY_ALIASES = {
|
|
1968
1970
|
add: '+',
|
|
@@ -2046,6 +2048,7 @@ const PASSIVE_EVENTS = new Set([
|
|
|
2046
2048
|
/* harmony export */ "CLIPBOARD_ID", 0, /* binding */ CLIPBOARD_ID,
|
|
2047
2049
|
/* harmony export */ "COMMAND_KEYS", 0, /* binding */ COMMAND_KEYS,
|
|
2048
2050
|
/* harmony export */ "EMULATE_DBLCLICK_TIMEOUT", 0, /* binding */ EMULATE_DBLCLICK_TIMEOUT,
|
|
2051
|
+
/* harmony export */ "ERROR_CODE_CONFLICT", 0, /* binding */ ERROR_CODE_CONFLICT,
|
|
2049
2052
|
/* harmony export */ "ES", 0, /* binding */ ES,
|
|
2050
2053
|
/* harmony export */ "FAT_MODE", 0, /* binding */ FAT_MODE,
|
|
2051
2054
|
/* harmony export */ "HOMEPAGE", 0, /* binding */ HOMEPAGE,
|
|
@@ -8745,6 +8748,7 @@ const dataBind = (elm, key, value)=>{
|
|
|
8745
8748
|
|
|
8746
8749
|
"use strict";
|
|
8747
8750
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8751
|
+
/* harmony export */ answer: function() { return /* binding */ answer; },
|
|
8748
8752
|
/* harmony export */ connection: function() { return /* binding */ connection; },
|
|
8749
8753
|
/* harmony export */ error: function() { return /* binding */ error; },
|
|
8750
8754
|
/* harmony export */ options: function() { return /* binding */ options; }
|
|
@@ -8768,6 +8772,9 @@ function connection(message) {
|
|
|
8768
8772
|
function options(message) {
|
|
8769
8773
|
return new _errors__WEBPACK_IMPORTED_MODULE_0__.OptionsError(message);
|
|
8770
8774
|
}
|
|
8775
|
+
function answer(message, resp, code) {
|
|
8776
|
+
return new _errors__WEBPACK_IMPORTED_MODULE_0__.AnswerError(message, resp, code);
|
|
8777
|
+
}
|
|
8771
8778
|
|
|
8772
8779
|
|
|
8773
8780
|
/***/ }),
|
|
@@ -8793,6 +8800,32 @@ function options(message) {
|
|
|
8793
8800
|
}
|
|
8794
8801
|
|
|
8795
8802
|
|
|
8803
|
+
/***/ }),
|
|
8804
|
+
|
|
8805
|
+
/***/ 45052:
|
|
8806
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8807
|
+
|
|
8808
|
+
"use strict";
|
|
8809
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8810
|
+
/* harmony export */ AnswerError: function() { return /* binding */ AnswerError; }
|
|
8811
|
+
/* harmony export */ });
|
|
8812
|
+
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
8813
|
+
|
|
8814
|
+
/*!
|
|
8815
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
8816
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
8817
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
8818
|
+
*/ /**
|
|
8819
|
+
* @module helpers/utils
|
|
8820
|
+
*/ // A connector refused the request: the answer and its `data.code` stay reachable for the handler
|
|
8821
|
+
class AnswerError extends Error {
|
|
8822
|
+
constructor(message, answer, code){
|
|
8823
|
+
super(message), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "answer", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "code", void 0), this.answer = answer, this.code = code;
|
|
8824
|
+
Object.setPrototypeOf(this, AnswerError.prototype);
|
|
8825
|
+
}
|
|
8826
|
+
}
|
|
8827
|
+
|
|
8828
|
+
|
|
8796
8829
|
/***/ }),
|
|
8797
8830
|
|
|
8798
8831
|
/***/ 58250:
|
|
@@ -8823,13 +8856,15 @@ function options(message) {
|
|
|
8823
8856
|
|
|
8824
8857
|
"use strict";
|
|
8825
8858
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8826
|
-
/* harmony export */
|
|
8827
|
-
/* harmony export */
|
|
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
|
|
8832
|
-
/* harmony import */ var
|
|
8865
|
+
/* harmony import */ var _answer_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(45052);
|
|
8866
|
+
/* harmony import */ var _connection_error__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(58250);
|
|
8867
|
+
/* harmony import */ var _options_error__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11080);
|
|
8833
8868
|
/*!
|
|
8834
8869
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
8835
8870
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -8841,6 +8876,7 @@ function options(message) {
|
|
|
8841
8876
|
|
|
8842
8877
|
|
|
8843
8878
|
|
|
8879
|
+
|
|
8844
8880
|
/***/ }),
|
|
8845
8881
|
|
|
8846
8882
|
/***/ 11080:
|
|
@@ -8871,9 +8907,11 @@ function options(message) {
|
|
|
8871
8907
|
|
|
8872
8908
|
"use strict";
|
|
8873
8909
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8910
|
+
/* harmony export */ AnswerError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.AnswerError; },
|
|
8874
8911
|
/* harmony export */ ConnectionError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.ConnectionError; },
|
|
8875
8912
|
/* harmony export */ OptionsError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.OptionsError; },
|
|
8876
8913
|
/* harmony export */ abort: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.abort; },
|
|
8914
|
+
/* harmony export */ answer: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.answer; },
|
|
8877
8915
|
/* harmony export */ connection: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.connection; },
|
|
8878
8916
|
/* harmony export */ error: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.error; },
|
|
8879
8917
|
/* harmony export */ options: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.options; }
|
|
@@ -9115,6 +9153,7 @@ const isPart = (node, part)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom
|
|
|
9115
9153
|
__webpack_require__.r(__webpack_exports__);
|
|
9116
9154
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9117
9155
|
/* harmony export */ $$: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_27__.$$; },
|
|
9156
|
+
/* harmony export */ AnswerError: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.AnswerError; },
|
|
9118
9157
|
/* harmony export */ ConfigDeepFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigDeepFlatten; },
|
|
9119
9158
|
/* harmony export */ ConfigFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigFlatten; },
|
|
9120
9159
|
/* harmony export */ ConfigMerge: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigMerge; },
|
|
@@ -9126,6 +9165,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9126
9165
|
/* harmony export */ abort: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.abort; },
|
|
9127
9166
|
/* harmony export */ alignElement: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.alignElement; },
|
|
9128
9167
|
/* harmony export */ alreadyLoadedList: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.alreadyLoadedList; },
|
|
9168
|
+
/* harmony export */ answer: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.answer; },
|
|
9129
9169
|
/* harmony export */ appendScriptAsync: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.appendScriptAsync; },
|
|
9130
9170
|
/* harmony export */ appendStyleAsync: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.appendStyleAsync; },
|
|
9131
9171
|
/* harmony export */ attr: function() { return /* reexport safe */ _attr__WEBPACK_IMPORTED_MODULE_3__.attr; },
|
|
@@ -10705,6 +10745,23 @@ class Ajax {
|
|
|
10705
10745
|
} catch {}
|
|
10706
10746
|
return this;
|
|
10707
10747
|
}
|
|
10748
|
+
// A connector answers an error with its JSON envelope and a real HTTP status (403, 409): the body says why, the reason phrase does not
|
|
10749
|
+
__hasAnswerEnvelope() {
|
|
10750
|
+
const { xhr } = this;
|
|
10751
|
+
if (xhr.responseType && xhr.responseType !== 'text') {
|
|
10752
|
+
return false;
|
|
10753
|
+
}
|
|
10754
|
+
const text = xhr.responseText;
|
|
10755
|
+
if (!text || text[0] !== '{') {
|
|
10756
|
+
return false;
|
|
10757
|
+
}
|
|
10758
|
+
try {
|
|
10759
|
+
const answer = JSON.parse(text);
|
|
10760
|
+
return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isPlainObject)(answer) && 'success' in answer;
|
|
10761
|
+
} catch {
|
|
10762
|
+
return false;
|
|
10763
|
+
}
|
|
10764
|
+
}
|
|
10708
10765
|
send() {
|
|
10709
10766
|
this.__activated = true;
|
|
10710
10767
|
const { xhr, o } = this;
|
|
@@ -10738,7 +10795,7 @@ class Ajax {
|
|
|
10738
10795
|
xhr.onreadystatechange = ()=>{
|
|
10739
10796
|
this.options.onProgress?.(10);
|
|
10740
10797
|
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
10741
|
-
if (o.successStatuses.includes(xhr.status)) {
|
|
10798
|
+
if (o.successStatuses.includes(xhr.status) || this.__hasAnswerEnvelope()) {
|
|
10742
10799
|
onResolve();
|
|
10743
10800
|
} else if (xhr.statusText) {
|
|
10744
10801
|
this.__isFulfilled = true;
|
|
@@ -21589,7 +21646,7 @@ class DataProvider {
|
|
|
21589
21646
|
}).catch(()=>null);
|
|
21590
21647
|
return promise.then((resp)=>resp.json()).then((resp)=>{
|
|
21591
21648
|
if (resp && !this.isSuccess(resp)) {
|
|
21592
|
-
throw
|
|
21649
|
+
throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.answer)(this.getMessage(resp), resp, resp.data?.code);
|
|
21593
21650
|
}
|
|
21594
21651
|
return resp;
|
|
21595
21652
|
});
|
|
@@ -21724,7 +21781,7 @@ class DataProvider {
|
|
|
21724
21781
|
if (this.isSuccess(resp)) {
|
|
21725
21782
|
return resp.data;
|
|
21726
21783
|
}
|
|
21727
|
-
throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.
|
|
21784
|
+
throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_9__.answer)(this.getMessage(resp), resp, resp.data?.code);
|
|
21728
21785
|
});
|
|
21729
21786
|
}
|
|
21730
21787
|
/**
|
|
@@ -26564,6 +26621,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.uploader = {
|
|
|
26564
26621
|
defaultHandlerError (e) {
|
|
26565
26622
|
this.j.message.error(e.message);
|
|
26566
26623
|
},
|
|
26624
|
+
promptOnExists: true,
|
|
26625
|
+
promptOnExistsSuggestName (name) {
|
|
26626
|
+
return name;
|
|
26627
|
+
},
|
|
26567
26628
|
contentType (requestData) {
|
|
26568
26629
|
return this.ow.FormData !== undefined && typeof requestData !== 'string' ? false : 'application/x-www-form-urlencoded; charset=UTF-8';
|
|
26569
26630
|
}
|
|
@@ -26740,8 +26801,12 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
|
|
|
26740
26801
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
26741
26802
|
/* harmony export */ sendFiles: function() { return /* binding */ sendFiles; }
|
|
26742
26803
|
/* harmony export */ });
|
|
26743
|
-
/* harmony import */ var
|
|
26744
|
-
/* harmony import */ var
|
|
26804
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81937);
|
|
26805
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65946);
|
|
26806
|
+
/* harmony import */ var jodit_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80512);
|
|
26807
|
+
/* harmony import */ var jodit_modules_dialog_prompt__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(74103);
|
|
26808
|
+
/* harmony import */ var jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(77911);
|
|
26809
|
+
/* harmony import */ var jodit_modules_uploader_helpers_upload_error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(55083);
|
|
26745
26810
|
/*!
|
|
26746
26811
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
26747
26812
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -26750,24 +26815,46 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
|
|
|
26750
26815
|
* @module modules/uploader
|
|
26751
26816
|
*/
|
|
26752
26817
|
|
|
26818
|
+
|
|
26819
|
+
|
|
26820
|
+
|
|
26821
|
+
|
|
26753
26822
|
/**
|
|
26754
26823
|
* Send files to server
|
|
26755
|
-
*/ function sendFiles(uploader, files, handlerSuccess, handlerError, process
|
|
26824
|
+
*/ async function sendFiles(uploader, files, handlerSuccess, handlerError, process, // Set when a refused upload is sent again: `beforeUpload` already had its say
|
|
26825
|
+
retryOf) {
|
|
26756
26826
|
if (!files) {
|
|
26757
|
-
|
|
26827
|
+
throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Need files');
|
|
26758
26828
|
}
|
|
26759
26829
|
const { o } = uploader;
|
|
26760
|
-
let fileList = (0,
|
|
26830
|
+
let fileList = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.toArray)(files);
|
|
26761
26831
|
if (!fileList.length) {
|
|
26762
|
-
|
|
26832
|
+
throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Need files');
|
|
26763
26833
|
}
|
|
26764
|
-
|
|
26834
|
+
let extraData = retryOf?.data;
|
|
26835
|
+
// Client-side validation hook — returning `false` aborts the upload, and it may hand back the files to send instead
|
|
26765
26836
|
// See https://github.com/xdan/jodit/issues/1329
|
|
26766
|
-
if ((0,
|
|
26767
|
-
|
|
26768
|
-
|
|
26837
|
+
if (!retryOf && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(o.beforeUpload)) {
|
|
26838
|
+
let plan;
|
|
26839
|
+
try {
|
|
26840
|
+
plan = await o.beforeUpload.call(uploader, fileList);
|
|
26841
|
+
} catch (e) {
|
|
26842
|
+
(handlerError || o.defaultHandlerError).call(uploader, e);
|
|
26843
|
+
throw e;
|
|
26844
|
+
}
|
|
26845
|
+
if (plan === false) {
|
|
26846
|
+
const err = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.error)('Upload canceled');
|
|
26769
26847
|
(handlerError || o.defaultHandlerError).call(uploader, err);
|
|
26770
|
-
|
|
26848
|
+
throw err;
|
|
26849
|
+
}
|
|
26850
|
+
if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(plan)) {
|
|
26851
|
+
fileList = plan;
|
|
26852
|
+
} else if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(plan) && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isArray)(plan.files)) {
|
|
26853
|
+
fileList = plan.files;
|
|
26854
|
+
extraData = plan.data;
|
|
26855
|
+
}
|
|
26856
|
+
if (!fileList.length) {
|
|
26857
|
+
return [];
|
|
26771
26858
|
}
|
|
26772
26859
|
}
|
|
26773
26860
|
const promises = [];
|
|
@@ -26807,20 +26894,35 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
|
|
|
26807
26894
|
if (process) {
|
|
26808
26895
|
process(form);
|
|
26809
26896
|
}
|
|
26810
|
-
if (o.data && (0,
|
|
26897
|
+
if (o.data && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isPlainObject)(o.data)) {
|
|
26811
26898
|
Object.keys(o.data).forEach((key)=>{
|
|
26812
26899
|
form.append(key, o.data[key]);
|
|
26813
26900
|
});
|
|
26814
26901
|
}
|
|
26902
|
+
if (extraData) {
|
|
26903
|
+
Object.keys(extraData).forEach((key)=>{
|
|
26904
|
+
form.append(key, extraData[key]);
|
|
26905
|
+
});
|
|
26906
|
+
}
|
|
26815
26907
|
o.prepareData.call(uploader, form);
|
|
26816
|
-
promises.push((0,
|
|
26908
|
+
promises.push((0,jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_4__.send)(uploader, form).then((resp)=>{
|
|
26817
26909
|
if (o.isSuccess.call(uploader, resp)) {
|
|
26818
|
-
const handler = (0,
|
|
26910
|
+
const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
|
|
26819
26911
|
handler.call(uploader, o.process.call(uploader, resp));
|
|
26820
26912
|
return resp;
|
|
26821
26913
|
}
|
|
26822
|
-
const
|
|
26823
|
-
|
|
26914
|
+
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, {
|
|
26915
|
+
data: {
|
|
26916
|
+
...extraData,
|
|
26917
|
+
...plan?.data
|
|
26918
|
+
}
|
|
26919
|
+
}));
|
|
26920
|
+
// A taken name is part of the upload, not a failure: ask for another one first
|
|
26921
|
+
if (err.code === jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.ERROR_CODE_CONFLICT && o.promptOnExists) {
|
|
26922
|
+
return askAnotherName(uploader, err);
|
|
26923
|
+
}
|
|
26924
|
+
const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
|
|
26925
|
+
handler.call(uploader, err);
|
|
26824
26926
|
return resp;
|
|
26825
26927
|
}).then(()=>{
|
|
26826
26928
|
uploader.j.events && uploader.j.e.fire('filesWereUploaded');
|
|
@@ -26828,6 +26930,45 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
|
|
|
26828
26930
|
}
|
|
26829
26931
|
return Promise.all(promises);
|
|
26830
26932
|
}
|
|
26933
|
+
function askAnotherName(uploader, err) {
|
|
26934
|
+
const { files } = err;
|
|
26935
|
+
// A batch is refused as a whole (the connector saved nothing) and the answer does not say which name is taken,
|
|
26936
|
+
// so the files go again one by one: the free ones are simply stored, the taken one answers 409 alone and gets its prompt
|
|
26937
|
+
if (files.length > 1) {
|
|
26938
|
+
return files.reduce((chain, file)=>chain.then(()=>err.retry({
|
|
26939
|
+
files: [
|
|
26940
|
+
file
|
|
26941
|
+
]
|
|
26942
|
+
})), Promise.resolve());
|
|
26943
|
+
}
|
|
26944
|
+
const [file] = files;
|
|
26945
|
+
const { j, o } = uploader;
|
|
26946
|
+
return new Promise((resolve)=>{
|
|
26947
|
+
let answered = false;
|
|
26948
|
+
// `Dlgs.prototype.dlg`: the uploader's view does not always carry the Dlgs trait
|
|
26949
|
+
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, {
|
|
26950
|
+
closeOnClickOverlay: true
|
|
26951
|
+
}), j.i18n(err.message), j.i18n('Rename'), (newName)=>{
|
|
26952
|
+
newName = newName.trim();
|
|
26953
|
+
if (!newName) {
|
|
26954
|
+
return false;
|
|
26955
|
+
}
|
|
26956
|
+
answered = true;
|
|
26957
|
+
resolve(err.retry({
|
|
26958
|
+
files: [
|
|
26959
|
+
new File([
|
|
26960
|
+
file
|
|
26961
|
+
], newName, {
|
|
26962
|
+
type: file.type
|
|
26963
|
+
})
|
|
26964
|
+
]
|
|
26965
|
+
}));
|
|
26966
|
+
}, j.i18n('Enter new name'), o.promptOnExistsSuggestName.call(uploader, file.name));
|
|
26967
|
+
dialog.e.on(dialog, 'afterClose', ()=>{
|
|
26968
|
+
!answered && resolve(undefined);
|
|
26969
|
+
});
|
|
26970
|
+
});
|
|
26971
|
+
}
|
|
26831
26972
|
function readImagesWithReader(fileList, imagesExtensions, promises, uploader, handlerSuccess, defaultHandlerSuccess) {
|
|
26832
26973
|
const readerPromises = [];
|
|
26833
26974
|
let file, i;
|
|
@@ -26856,7 +26997,7 @@ function readImagesWithReader(fileList, imagesExtensions, promises, uploader, ha
|
|
|
26856
26997
|
name
|
|
26857
26998
|
]
|
|
26858
26999
|
};
|
|
26859
|
-
const handler = (0,
|
|
27000
|
+
const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handlerSuccess) ? handlerSuccess : defaultHandlerSuccess;
|
|
26860
27001
|
handler.call(uploader, resp);
|
|
26861
27002
|
resolve(resp);
|
|
26862
27003
|
};
|
|
@@ -26972,6 +27113,34 @@ function send(uploader, data) {
|
|
|
26972
27113
|
/* harmony export */ ]);
|
|
26973
27114
|
|
|
26974
27115
|
|
|
27116
|
+
/***/ }),
|
|
27117
|
+
|
|
27118
|
+
/***/ 55083:
|
|
27119
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
27120
|
+
|
|
27121
|
+
"use strict";
|
|
27122
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
27123
|
+
/* harmony export */ UploadError: function() { return /* binding */ UploadError; }
|
|
27124
|
+
/* harmony export */ });
|
|
27125
|
+
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
27126
|
+
/* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33201);
|
|
27127
|
+
/*!
|
|
27128
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
27129
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
27130
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
27131
|
+
*/ /**
|
|
27132
|
+
* @module modules/uploader
|
|
27133
|
+
*/
|
|
27134
|
+
|
|
27135
|
+
// The connector refused these files: the handler can change the request and send it again
|
|
27136
|
+
class UploadError extends jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__.AnswerError {
|
|
27137
|
+
constructor(message, answer, files, retry){
|
|
27138
|
+
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;
|
|
27139
|
+
Object.setPrototypeOf(this, UploadError.prototype);
|
|
27140
|
+
}
|
|
27141
|
+
}
|
|
27142
|
+
|
|
27143
|
+
|
|
26975
27144
|
/***/ }),
|
|
26976
27145
|
|
|
26977
27146
|
/***/ 94925:
|
|
@@ -26986,9 +27155,10 @@ function send(uploader, data) {
|
|
|
26986
27155
|
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
26987
27156
|
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23211);
|
|
26988
27157
|
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
|
|
26989
|
-
/* harmony import */ var
|
|
26990
|
-
/* harmony import */ var
|
|
26991
|
-
/* harmony import */ var
|
|
27158
|
+
/* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(33201);
|
|
27159
|
+
/* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5266);
|
|
27160
|
+
/* harmony import */ var jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11981);
|
|
27161
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(40013);
|
|
26992
27162
|
/*!
|
|
26993
27163
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
26994
27164
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -27006,6 +27176,7 @@ function send(uploader, data) {
|
|
|
27006
27176
|
|
|
27007
27177
|
|
|
27008
27178
|
|
|
27179
|
+
|
|
27009
27180
|
class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewComponent {
|
|
27010
27181
|
get j() {
|
|
27011
27182
|
return this.jodit;
|
|
@@ -27061,14 +27232,14 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
27061
27232
|
}
|
|
27062
27233
|
};
|
|
27063
27234
|
// send data on server
|
|
27064
|
-
if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,
|
|
27065
|
-
(0,
|
|
27235
|
+
if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(cData)) {
|
|
27236
|
+
(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, cData.files, handlerSuccess, handlerError).finally(onFinally);
|
|
27066
27237
|
return false;
|
|
27067
27238
|
}
|
|
27068
27239
|
if (jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && !jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_ES_NEXT) {
|
|
27069
|
-
return (0,
|
|
27240
|
+
return (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.processOldBrowserDrag)(self, cData, handlerSuccess, handlerError, onFinally);
|
|
27070
27241
|
}
|
|
27071
|
-
if ((0,
|
|
27242
|
+
if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasItems)(cData)) {
|
|
27072
27243
|
const { items } = cData;
|
|
27073
27244
|
for(i = 0; i < items.length; i += 1){
|
|
27074
27245
|
if (items[i].kind === 'file' && items[i].type === 'image/png') {
|
|
@@ -27076,7 +27247,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
27076
27247
|
if (file) {
|
|
27077
27248
|
const mime = file.type.match(/\/([a-z0-9]+)/i);
|
|
27078
27249
|
extension = mime[1] ? mime[1].toLowerCase() : '';
|
|
27079
|
-
(0,
|
|
27250
|
+
(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, [
|
|
27080
27251
|
file
|
|
27081
27252
|
], handlerSuccess, handlerError, processData).finally(onFinally);
|
|
27082
27253
|
}
|
|
@@ -27098,27 +27269,27 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
27098
27269
|
self.j.e.on(form, 'dragend dragover dragenter dragleave drop', (e)=>{
|
|
27099
27270
|
e.preventDefault();
|
|
27100
27271
|
}).on(form, 'dragover', (event)=>{
|
|
27101
|
-
if ((0,
|
|
27272
|
+
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
27273
|
form.classList.add('jodit_drag_hover');
|
|
27103
27274
|
event.preventDefault();
|
|
27104
27275
|
}
|
|
27105
27276
|
}).on(form, 'dragend dragleave', (event)=>{
|
|
27106
27277
|
form.classList.remove('jodit_drag_hover');
|
|
27107
|
-
if ((0,
|
|
27278
|
+
if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
|
|
27108
27279
|
event.preventDefault();
|
|
27109
27280
|
}
|
|
27110
27281
|
}).on(form, 'drop', (event)=>{
|
|
27111
27282
|
form.classList.remove('jodit_drag_hover');
|
|
27112
|
-
if ((0,
|
|
27283
|
+
if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
|
|
27113
27284
|
event.preventDefault();
|
|
27114
27285
|
event.stopImmediatePropagation();
|
|
27115
|
-
(0,
|
|
27286
|
+
(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, event.dataTransfer.files, handlerSuccess, handlerError).finally(onFinally);
|
|
27116
27287
|
}
|
|
27117
27288
|
});
|
|
27118
27289
|
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
27290
|
if (inputFile) {
|
|
27120
27291
|
self.j.e.on(inputFile, 'change', ()=>{
|
|
27121
|
-
(0,
|
|
27292
|
+
(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, inputFile.files, handlerSuccess, handlerError).then(()=>{
|
|
27122
27293
|
inputFile.value = '';
|
|
27123
27294
|
if (!/safari/i.test(navigator.userAgent)) {
|
|
27124
27295
|
inputFile.type = '';
|
|
@@ -27133,7 +27304,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
27133
27304
|
*/ uploadRemoteImage(url, handlerSuccess, handlerError) {
|
|
27134
27305
|
const uploader = this, { o } = uploader;
|
|
27135
27306
|
const handlerE = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
|
|
27136
|
-
(0,
|
|
27307
|
+
(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.send)(uploader, {
|
|
27137
27308
|
action: 'fileUploadRemote',
|
|
27138
27309
|
url
|
|
27139
27310
|
}).then((resp)=>{
|
|
@@ -27142,17 +27313,31 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
27142
27313
|
handler.call(uploader, o.process.call(uploader, resp));
|
|
27143
27314
|
return;
|
|
27144
27315
|
}
|
|
27145
|
-
handlerE.call(uploader, (0,
|
|
27316
|
+
handlerE.call(uploader, (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__.answer)(o.getMessage.call(uploader, resp), resp, resp.data?.code));
|
|
27146
27317
|
}).catch((e)=>handlerE.call(uploader, e));
|
|
27147
27318
|
}
|
|
27148
27319
|
upload(files) {
|
|
27149
27320
|
return this.async.promise((resolve, reject)=>{
|
|
27150
|
-
|
|
27321
|
+
let settled = false;
|
|
27322
|
+
const settle = (end)=>(value)=>{
|
|
27323
|
+
settled = true;
|
|
27324
|
+
end(value);
|
|
27325
|
+
};
|
|
27326
|
+
(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(this, files, settle(resolve), settle(reject)).then(()=>{
|
|
27327
|
+
// `beforeUpload` kept no file, so no handler ran
|
|
27328
|
+
if (!settled) {
|
|
27329
|
+
resolve({
|
|
27330
|
+
baseurl: '',
|
|
27331
|
+
files: [],
|
|
27332
|
+
isImages: []
|
|
27333
|
+
});
|
|
27334
|
+
}
|
|
27335
|
+
}, settle(reject));
|
|
27151
27336
|
});
|
|
27152
27337
|
}
|
|
27153
27338
|
destruct() {
|
|
27154
27339
|
this.setStatus(jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.STATUSES.beforeDestruct);
|
|
27155
|
-
const instances =
|
|
27340
|
+
const instances = jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.ajaxInstances.get(this);
|
|
27156
27341
|
if (instances) {
|
|
27157
27342
|
instances.forEach((ajax)=>{
|
|
27158
27343
|
try {
|
|
@@ -27165,7 +27350,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
27165
27350
|
}
|
|
27166
27351
|
constructor(editor, options){
|
|
27167
27352
|
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)(
|
|
27353
|
+
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
27354
|
}
|
|
27170
27355
|
}
|
|
27171
27356
|
|