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/es2015/jodit.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
4
|
-
* Version: v4.19.
|
|
4
|
+
* Version: v4.19.8
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -1830,7 +1830,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1830
1830
|
* ```
|
|
1831
1831
|
* @packageDocumentation
|
|
1832
1832
|
* @module constants
|
|
1833
|
-
*/ const APP_VERSION = "4.19.
|
|
1833
|
+
*/ const APP_VERSION = "4.19.8";
|
|
1834
1834
|
// prettier-ignore
|
|
1835
1835
|
const ES = "es2015";
|
|
1836
1836
|
const IS_ES_MODERN = true;
|
|
@@ -1969,6 +1969,8 @@ const EMULATE_DBLCLICK_TIMEOUT = 300;
|
|
|
1969
1969
|
* ```
|
|
1970
1970
|
*/ const INSERT_ONLY_TEXT = 'insert_only_text';
|
|
1971
1971
|
const SAFE_COUNT_CHANGE_CALL = 10;
|
|
1972
|
+
// Connector answer code for a file name that is already taken (same as the HTTP status)
|
|
1973
|
+
const ERROR_CODE_CONFLICT = 409;
|
|
1972
1974
|
const IS_MAC = typeof globalWindow !== 'undefined' && /Mac|iPod|iPhone|iPad/.test(globalWindow.navigator.platform);
|
|
1973
1975
|
const KEY_ALIASES = {
|
|
1974
1976
|
add: '+',
|
|
@@ -2052,6 +2054,7 @@ const PASSIVE_EVENTS = new Set([
|
|
|
2052
2054
|
/* harmony export */ "CLIPBOARD_ID", 0, /* binding */ CLIPBOARD_ID,
|
|
2053
2055
|
/* harmony export */ "COMMAND_KEYS", 0, /* binding */ COMMAND_KEYS,
|
|
2054
2056
|
/* harmony export */ "EMULATE_DBLCLICK_TIMEOUT", 0, /* binding */ EMULATE_DBLCLICK_TIMEOUT,
|
|
2057
|
+
/* harmony export */ "ERROR_CODE_CONFLICT", 0, /* binding */ ERROR_CODE_CONFLICT,
|
|
2055
2058
|
/* harmony export */ "ES", 0, /* binding */ ES,
|
|
2056
2059
|
/* harmony export */ "FAT_MODE", 0, /* binding */ FAT_MODE,
|
|
2057
2060
|
/* harmony export */ "HOMEPAGE", 0, /* binding */ HOMEPAGE,
|
|
@@ -8777,6 +8780,7 @@ const dataBind = (elm, key, value)=>{
|
|
|
8777
8780
|
|
|
8778
8781
|
"use strict";
|
|
8779
8782
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8783
|
+
/* harmony export */ answer: function() { return /* binding */ answer; },
|
|
8780
8784
|
/* harmony export */ connection: function() { return /* binding */ connection; },
|
|
8781
8785
|
/* harmony export */ error: function() { return /* binding */ error; },
|
|
8782
8786
|
/* harmony export */ options: function() { return /* binding */ options; }
|
|
@@ -8800,6 +8804,9 @@ function connection(message) {
|
|
|
8800
8804
|
function options(message) {
|
|
8801
8805
|
return new _errors__WEBPACK_IMPORTED_MODULE_0__.OptionsError(message);
|
|
8802
8806
|
}
|
|
8807
|
+
function answer(message, resp, code) {
|
|
8808
|
+
return new _errors__WEBPACK_IMPORTED_MODULE_0__.AnswerError(message, resp, code);
|
|
8809
|
+
}
|
|
8803
8810
|
|
|
8804
8811
|
|
|
8805
8812
|
/***/ }),
|
|
@@ -8825,6 +8832,32 @@ function options(message) {
|
|
|
8825
8832
|
}
|
|
8826
8833
|
|
|
8827
8834
|
|
|
8835
|
+
/***/ }),
|
|
8836
|
+
|
|
8837
|
+
/***/ 45052:
|
|
8838
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8839
|
+
|
|
8840
|
+
"use strict";
|
|
8841
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8842
|
+
/* harmony export */ AnswerError: function() { return /* binding */ AnswerError; }
|
|
8843
|
+
/* harmony export */ });
|
|
8844
|
+
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
8845
|
+
|
|
8846
|
+
/*!
|
|
8847
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
8848
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
8849
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
8850
|
+
*/ /**
|
|
8851
|
+
* @module helpers/utils
|
|
8852
|
+
*/ // A connector refused the request: the answer and its `data.code` stay reachable for the handler
|
|
8853
|
+
class AnswerError extends Error {
|
|
8854
|
+
constructor(message, answer, code){
|
|
8855
|
+
super(message), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "answer", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "code", void 0), this.answer = answer, this.code = code;
|
|
8856
|
+
Object.setPrototypeOf(this, AnswerError.prototype);
|
|
8857
|
+
}
|
|
8858
|
+
}
|
|
8859
|
+
|
|
8860
|
+
|
|
8828
8861
|
/***/ }),
|
|
8829
8862
|
|
|
8830
8863
|
/***/ 58250:
|
|
@@ -8855,13 +8888,15 @@ function options(message) {
|
|
|
8855
8888
|
|
|
8856
8889
|
"use strict";
|
|
8857
8890
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8858
|
-
/* harmony export */
|
|
8859
|
-
/* harmony export */
|
|
8891
|
+
/* harmony export */ AnswerError: function() { return /* reexport safe */ _answer_error__WEBPACK_IMPORTED_MODULE_1__.AnswerError; },
|
|
8892
|
+
/* harmony export */ ConnectionError: function() { return /* reexport safe */ _connection_error__WEBPACK_IMPORTED_MODULE_2__.ConnectionError; },
|
|
8893
|
+
/* harmony export */ OptionsError: function() { return /* reexport safe */ _options_error__WEBPACK_IMPORTED_MODULE_3__.OptionsError; },
|
|
8860
8894
|
/* harmony export */ abort: function() { return /* reexport safe */ _abort_error__WEBPACK_IMPORTED_MODULE_0__.abort; }
|
|
8861
8895
|
/* harmony export */ });
|
|
8862
8896
|
/* harmony import */ var _abort_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14228);
|
|
8863
|
-
/* harmony import */ var
|
|
8864
|
-
/* harmony import */ var
|
|
8897
|
+
/* harmony import */ var _answer_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(45052);
|
|
8898
|
+
/* harmony import */ var _connection_error__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(58250);
|
|
8899
|
+
/* harmony import */ var _options_error__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(11080);
|
|
8865
8900
|
/*!
|
|
8866
8901
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
8867
8902
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -8873,6 +8908,7 @@ function options(message) {
|
|
|
8873
8908
|
|
|
8874
8909
|
|
|
8875
8910
|
|
|
8911
|
+
|
|
8876
8912
|
/***/ }),
|
|
8877
8913
|
|
|
8878
8914
|
/***/ 11080:
|
|
@@ -8903,9 +8939,11 @@ function options(message) {
|
|
|
8903
8939
|
|
|
8904
8940
|
"use strict";
|
|
8905
8941
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
8942
|
+
/* harmony export */ AnswerError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.AnswerError; },
|
|
8906
8943
|
/* harmony export */ ConnectionError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.ConnectionError; },
|
|
8907
8944
|
/* harmony export */ OptionsError: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.OptionsError; },
|
|
8908
8945
|
/* harmony export */ abort: function() { return /* reexport safe */ _errors___WEBPACK_IMPORTED_MODULE_1__.abort; },
|
|
8946
|
+
/* harmony export */ answer: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.answer; },
|
|
8909
8947
|
/* harmony export */ connection: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.connection; },
|
|
8910
8948
|
/* harmony export */ error: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.error; },
|
|
8911
8949
|
/* harmony export */ options: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_0__.options; }
|
|
@@ -9149,6 +9187,7 @@ const isPart = (node, part)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom
|
|
|
9149
9187
|
__webpack_require__.r(__webpack_exports__);
|
|
9150
9188
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9151
9189
|
/* harmony export */ $$: function() { return /* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_27__.$$; },
|
|
9190
|
+
/* harmony export */ AnswerError: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.AnswerError; },
|
|
9152
9191
|
/* harmony export */ ConfigDeepFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigDeepFlatten; },
|
|
9153
9192
|
/* harmony export */ ConfigFlatten: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigFlatten; },
|
|
9154
9193
|
/* harmony export */ ConfigMerge: function() { return /* reexport safe */ _config_proto__WEBPACK_IMPORTED_MODULE_7__.ConfigMerge; },
|
|
@@ -9160,6 +9199,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9160
9199
|
/* harmony export */ abort: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.abort; },
|
|
9161
9200
|
/* harmony export */ alignElement: function() { return /* reexport safe */ _align__WEBPACK_IMPORTED_MODULE_0__.alignElement; },
|
|
9162
9201
|
/* harmony export */ alreadyLoadedList: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.alreadyLoadedList; },
|
|
9202
|
+
/* harmony export */ answer: function() { return /* reexport safe */ _error__WEBPACK_IMPORTED_MODULE_13__.answer; },
|
|
9163
9203
|
/* harmony export */ appendScriptAsync: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.appendScriptAsync; },
|
|
9164
9204
|
/* harmony export */ appendStyleAsync: function() { return /* reexport safe */ _append_script__WEBPACK_IMPORTED_MODULE_1__.appendStyleAsync; },
|
|
9165
9205
|
/* harmony export */ attr: function() { return /* reexport safe */ _attr__WEBPACK_IMPORTED_MODULE_3__.attr; },
|
|
@@ -10757,6 +10797,23 @@ class Ajax {
|
|
|
10757
10797
|
} catch (unused) {}
|
|
10758
10798
|
return this;
|
|
10759
10799
|
}
|
|
10800
|
+
// A connector answers an error with its JSON envelope and a real HTTP status (403, 409): the body says why, the reason phrase does not
|
|
10801
|
+
__hasAnswerEnvelope() {
|
|
10802
|
+
const { xhr } = this;
|
|
10803
|
+
if (xhr.responseType && xhr.responseType !== 'text') {
|
|
10804
|
+
return false;
|
|
10805
|
+
}
|
|
10806
|
+
const text = xhr.responseText;
|
|
10807
|
+
if (!text || text[0] !== '{') {
|
|
10808
|
+
return false;
|
|
10809
|
+
}
|
|
10810
|
+
try {
|
|
10811
|
+
const answer = JSON.parse(text);
|
|
10812
|
+
return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_9__.isPlainObject)(answer) && 'success' in answer;
|
|
10813
|
+
} catch (unused) {
|
|
10814
|
+
return false;
|
|
10815
|
+
}
|
|
10816
|
+
}
|
|
10760
10817
|
send() {
|
|
10761
10818
|
this.__activated = true;
|
|
10762
10819
|
const { xhr, o } = this;
|
|
@@ -10793,7 +10850,7 @@ class Ajax {
|
|
|
10793
10850
|
var _this_options_onProgress, _this_options;
|
|
10794
10851
|
(_this_options_onProgress = (_this_options = this.options).onProgress) === null || _this_options_onProgress === void 0 ? void 0 : _this_options_onProgress.call(_this_options, 10);
|
|
10795
10852
|
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
10796
|
-
if (o.successStatuses.includes(xhr.status)) {
|
|
10853
|
+
if (o.successStatuses.includes(xhr.status) || this.__hasAnswerEnvelope()) {
|
|
10797
10854
|
onResolve();
|
|
10798
10855
|
} else if (xhr.statusText) {
|
|
10799
10856
|
this.__isFulfilled = true;
|
|
@@ -21767,7 +21824,8 @@ class DataProvider {
|
|
|
21767
21824
|
}).catch(()=>null);
|
|
21768
21825
|
return promise.then((resp)=>resp.json()).then((resp)=>{
|
|
21769
21826
|
if (resp && !this.isSuccess(resp)) {
|
|
21770
|
-
|
|
21827
|
+
var _resp_data;
|
|
21828
|
+
throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_12__.answer)(this.getMessage(resp), resp, (_resp_data = resp.data) === null || _resp_data === void 0 ? void 0 : _resp_data.code);
|
|
21771
21829
|
}
|
|
21772
21830
|
return resp;
|
|
21773
21831
|
});
|
|
@@ -21906,10 +21964,11 @@ class DataProvider {
|
|
|
21906
21964
|
*/ getPathByUrl(url) {
|
|
21907
21965
|
;(0,jodit_core_helpers_utils_set__WEBPACK_IMPORTED_MODULE_13__.set)('options.getLocalFileByUrl.data.url', url, this);
|
|
21908
21966
|
return this.get('getLocalFileByUrl').then((resp)=>{
|
|
21967
|
+
var _resp_data;
|
|
21909
21968
|
if (this.isSuccess(resp)) {
|
|
21910
21969
|
return resp.data;
|
|
21911
21970
|
}
|
|
21912
|
-
throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_12__.
|
|
21971
|
+
throw (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_12__.answer)(this.getMessage(resp), resp, (_resp_data = resp.data) === null || _resp_data === void 0 ? void 0 : _resp_data.code);
|
|
21913
21972
|
});
|
|
21914
21973
|
}
|
|
21915
21974
|
/**
|
|
@@ -26786,6 +26845,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.uploader = {
|
|
|
26786
26845
|
defaultHandlerError (e) {
|
|
26787
26846
|
this.j.message.error(e.message);
|
|
26788
26847
|
},
|
|
26848
|
+
promptOnExists: true,
|
|
26849
|
+
promptOnExistsSuggestName (name) {
|
|
26850
|
+
return name;
|
|
26851
|
+
},
|
|
26789
26852
|
contentType (requestData) {
|
|
26790
26853
|
return this.ow.FormData !== undefined && typeof requestData !== 'string' ? false : 'application/x-www-form-urlencoded; charset=UTF-8';
|
|
26791
26854
|
}
|
|
@@ -26964,8 +27027,14 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
|
|
|
26964
27027
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
26965
27028
|
/* harmony export */ sendFiles: function() { return /* binding */ sendFiles; }
|
|
26966
27029
|
/* harmony export */ });
|
|
26967
|
-
/* harmony import */ var
|
|
26968
|
-
/* harmony import */ var
|
|
27030
|
+
/* harmony import */ var _swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(49376);
|
|
27031
|
+
/* harmony import */ var _swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41411);
|
|
27032
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
27033
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(65946);
|
|
27034
|
+
/* harmony import */ var jodit_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(80512);
|
|
27035
|
+
/* harmony import */ var jodit_modules_dialog_prompt__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(74103);
|
|
27036
|
+
/* harmony import */ var jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(77911);
|
|
27037
|
+
/* harmony import */ var jodit_modules_uploader_helpers_upload_error__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(55083);
|
|
26969
27038
|
/*!
|
|
26970
27039
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
26971
27040
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -26974,83 +27043,163 @@ function processOldBrowserDrag(self, cData, handlerSuccess, handlerError, onFina
|
|
|
26974
27043
|
* @module modules/uploader
|
|
26975
27044
|
*/
|
|
26976
27045
|
|
|
27046
|
+
|
|
27047
|
+
|
|
27048
|
+
|
|
27049
|
+
|
|
27050
|
+
|
|
27051
|
+
|
|
26977
27052
|
/**
|
|
26978
27053
|
* Send files to server
|
|
26979
|
-
*/ function sendFiles(uploader, files, handlerSuccess, handlerError, process
|
|
26980
|
-
|
|
26981
|
-
|
|
26982
|
-
|
|
26983
|
-
|
|
26984
|
-
|
|
26985
|
-
|
|
26986
|
-
|
|
26987
|
-
|
|
26988
|
-
|
|
26989
|
-
|
|
26990
|
-
|
|
26991
|
-
|
|
26992
|
-
|
|
26993
|
-
|
|
26994
|
-
|
|
26995
|
-
|
|
26996
|
-
|
|
26997
|
-
|
|
26998
|
-
|
|
26999
|
-
|
|
27000
|
-
|
|
27001
|
-
|
|
27002
|
-
|
|
27003
|
-
|
|
27004
|
-
|
|
27005
|
-
|
|
27006
|
-
|
|
27007
|
-
|
|
27008
|
-
|
|
27009
|
-
|
|
27010
|
-
|
|
27011
|
-
|
|
27012
|
-
|
|
27013
|
-
|
|
27014
|
-
|
|
27015
|
-
|
|
27016
|
-
|
|
27017
|
-
|
|
27018
|
-
|
|
27019
|
-
|
|
27020
|
-
|
|
27021
|
-
|
|
27022
|
-
|
|
27023
|
-
|
|
27024
|
-
|
|
27054
|
+
*/ function sendFiles(uploader, files, handlerSuccess, handlerError, process, // Set when a refused upload is sent again: `beforeUpload` already had its say
|
|
27055
|
+
retryOf) {
|
|
27056
|
+
return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function*() {
|
|
27057
|
+
if (!files) {
|
|
27058
|
+
throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.error)('Need files');
|
|
27059
|
+
}
|
|
27060
|
+
const { o } = uploader;
|
|
27061
|
+
let fileList = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.toArray)(files);
|
|
27062
|
+
if (!fileList.length) {
|
|
27063
|
+
throw (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.error)('Need files');
|
|
27064
|
+
}
|
|
27065
|
+
let extraData = retryOf === null || retryOf === void 0 ? void 0 : retryOf.data;
|
|
27066
|
+
// Client-side validation hook — returning `false` aborts the upload, and it may hand back the files to send instead
|
|
27067
|
+
// See https://github.com/xdan/jodit/issues/1329
|
|
27068
|
+
if (!retryOf && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isFunction)(o.beforeUpload)) {
|
|
27069
|
+
let plan;
|
|
27070
|
+
try {
|
|
27071
|
+
plan = yield o.beforeUpload.call(uploader, fileList);
|
|
27072
|
+
} catch (e) {
|
|
27073
|
+
(handlerError || o.defaultHandlerError).call(uploader, e);
|
|
27074
|
+
throw e;
|
|
27075
|
+
}
|
|
27076
|
+
if (plan === false) {
|
|
27077
|
+
const err = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.error)('Upload canceled');
|
|
27078
|
+
(handlerError || o.defaultHandlerError).call(uploader, err);
|
|
27079
|
+
throw err;
|
|
27080
|
+
}
|
|
27081
|
+
if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isArray)(plan)) {
|
|
27082
|
+
fileList = plan;
|
|
27083
|
+
} else if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isPlainObject)(plan) && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isArray)(plan.files)) {
|
|
27084
|
+
fileList = plan.files;
|
|
27085
|
+
extraData = plan.data;
|
|
27086
|
+
}
|
|
27087
|
+
if (!fileList.length) {
|
|
27088
|
+
return [];
|
|
27089
|
+
}
|
|
27090
|
+
}
|
|
27091
|
+
const promises = [];
|
|
27092
|
+
if (o.insertImageAsBase64URI) {
|
|
27093
|
+
readImagesWithReader(fileList, o.imagesExtensions, promises, uploader, handlerSuccess, o.defaultHandlerSuccess);
|
|
27094
|
+
}
|
|
27095
|
+
fileList = fileList.filter((a)=>a);
|
|
27096
|
+
if (fileList.length) {
|
|
27097
|
+
const form = new FormData();
|
|
27098
|
+
form.append(o.pathVariableName, uploader.path);
|
|
27099
|
+
form.append('source', uploader.source);
|
|
27100
|
+
let file;
|
|
27101
|
+
for(let i = 0; i < fileList.length; i += 1){
|
|
27102
|
+
file = fileList[i];
|
|
27103
|
+
if (file) {
|
|
27104
|
+
const hasRealExtension = /\.\w+$/.test(file.name);
|
|
27105
|
+
const mime = file.type.match(/\/([a-z0-9]+)/i);
|
|
27106
|
+
const extension = mime && mime[1] ? mime[1].toLowerCase() : '';
|
|
27107
|
+
let newName = fileList[i].name || Math.random().toString().replace('.', '');
|
|
27108
|
+
if (!hasRealExtension && extension) {
|
|
27109
|
+
let extForReg = extension;
|
|
27110
|
+
if ([
|
|
27111
|
+
'jpeg',
|
|
27112
|
+
'jpg'
|
|
27113
|
+
].includes(extForReg)) {
|
|
27114
|
+
extForReg = 'jpeg|jpg';
|
|
27115
|
+
}
|
|
27116
|
+
const reEnd = new RegExp('.(' + extForReg + ')$', 'i');
|
|
27117
|
+
if (!reEnd.test(newName)) {
|
|
27118
|
+
newName += '.' + extension;
|
|
27119
|
+
}
|
|
27025
27120
|
}
|
|
27121
|
+
const [key, iFile, name] = o.processFileName.call(uploader, o.filesVariableName(i), fileList[i], newName);
|
|
27122
|
+
form.append(key, iFile, name);
|
|
27026
27123
|
}
|
|
27027
|
-
const [key, iFile, name] = o.processFileName.call(uploader, o.filesVariableName(i), fileList[i], newName);
|
|
27028
|
-
form.append(key, iFile, name);
|
|
27029
27124
|
}
|
|
27030
|
-
|
|
27031
|
-
|
|
27032
|
-
|
|
27033
|
-
|
|
27034
|
-
|
|
27035
|
-
|
|
27036
|
-
|
|
27037
|
-
}
|
|
27038
|
-
|
|
27039
|
-
|
|
27040
|
-
|
|
27041
|
-
|
|
27042
|
-
|
|
27043
|
-
|
|
27125
|
+
if (process) {
|
|
27126
|
+
process(form);
|
|
27127
|
+
}
|
|
27128
|
+
if (o.data && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isPlainObject)(o.data)) {
|
|
27129
|
+
Object.keys(o.data).forEach((key)=>{
|
|
27130
|
+
form.append(key, o.data[key]);
|
|
27131
|
+
});
|
|
27132
|
+
}
|
|
27133
|
+
if (extraData) {
|
|
27134
|
+
Object.keys(extraData).forEach((key)=>{
|
|
27135
|
+
form.append(key, extraData[key]);
|
|
27136
|
+
});
|
|
27137
|
+
}
|
|
27138
|
+
o.prepareData.call(uploader, form);
|
|
27139
|
+
promises.push((0,jodit_modules_uploader_helpers_send__WEBPACK_IMPORTED_MODULE_6__.send)(uploader, form).then((resp)=>{
|
|
27140
|
+
if (o.isSuccess.call(uploader, resp)) {
|
|
27141
|
+
const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
|
|
27142
|
+
handler.call(uploader, o.process.call(uploader, resp));
|
|
27143
|
+
return resp;
|
|
27144
|
+
}
|
|
27145
|
+
const err = new jodit_modules_uploader_helpers_upload_error__WEBPACK_IMPORTED_MODULE_7__.UploadError(o.getMessage.call(uploader, resp), resp, fileList, (plan)=>{
|
|
27146
|
+
var _ref;
|
|
27147
|
+
return sendFiles(uploader, (_ref = plan === null || plan === void 0 ? void 0 : plan.files) !== null && _ref !== void 0 ? _ref : fileList, handlerSuccess, handlerError, process, {
|
|
27148
|
+
data: (0,_swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_1__._)({}, extraData, plan === null || plan === void 0 ? void 0 : plan.data)
|
|
27149
|
+
});
|
|
27150
|
+
});
|
|
27151
|
+
// A taken name is part of the upload, not a failure: ask for another one first
|
|
27152
|
+
if (err.code === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.ERROR_CODE_CONFLICT && o.promptOnExists) {
|
|
27153
|
+
return askAnotherName(uploader, err);
|
|
27154
|
+
}
|
|
27155
|
+
const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
|
|
27156
|
+
handler.call(uploader, err);
|
|
27044
27157
|
return resp;
|
|
27158
|
+
}).then(()=>{
|
|
27159
|
+
uploader.j.events && uploader.j.e.fire('filesWereUploaded');
|
|
27160
|
+
}));
|
|
27161
|
+
}
|
|
27162
|
+
return Promise.all(promises);
|
|
27163
|
+
})();
|
|
27164
|
+
}
|
|
27165
|
+
function askAnotherName(uploader, err) {
|
|
27166
|
+
const { files } = err;
|
|
27167
|
+
// A batch is refused as a whole (the connector saved nothing) and the answer does not say which name is taken,
|
|
27168
|
+
// so the files go again one by one: the free ones are simply stored, the taken one answers 409 alone and gets its prompt
|
|
27169
|
+
if (files.length > 1) {
|
|
27170
|
+
return files.reduce((chain, file)=>chain.then(()=>err.retry({
|
|
27171
|
+
files: [
|
|
27172
|
+
file
|
|
27173
|
+
]
|
|
27174
|
+
})), Promise.resolve());
|
|
27175
|
+
}
|
|
27176
|
+
const [file] = files;
|
|
27177
|
+
const { j, o } = uploader;
|
|
27178
|
+
return new Promise((resolve)=>{
|
|
27179
|
+
let answered = false;
|
|
27180
|
+
// `Dlgs.prototype.dlg`: the uploader's view does not always carry the Dlgs trait
|
|
27181
|
+
const dialog = jodit_modules_dialog_prompt__WEBPACK_IMPORTED_MODULE_5__.Prompt.call(jodit_core_traits_dlgs__WEBPACK_IMPORTED_MODULE_4__.Dlgs.prototype.dlg.call(j, {
|
|
27182
|
+
closeOnClickOverlay: true
|
|
27183
|
+
}), j.i18n(err.message), j.i18n('Rename'), (newName)=>{
|
|
27184
|
+
newName = newName.trim();
|
|
27185
|
+
if (!newName) {
|
|
27186
|
+
return false;
|
|
27045
27187
|
}
|
|
27046
|
-
|
|
27047
|
-
|
|
27048
|
-
|
|
27049
|
-
|
|
27050
|
-
|
|
27051
|
-
|
|
27052
|
-
|
|
27053
|
-
|
|
27188
|
+
answered = true;
|
|
27189
|
+
resolve(err.retry({
|
|
27190
|
+
files: [
|
|
27191
|
+
new File([
|
|
27192
|
+
file
|
|
27193
|
+
], newName, {
|
|
27194
|
+
type: file.type
|
|
27195
|
+
})
|
|
27196
|
+
]
|
|
27197
|
+
}));
|
|
27198
|
+
}, j.i18n('Enter new name'), o.promptOnExistsSuggestName.call(uploader, file.name));
|
|
27199
|
+
dialog.e.on(dialog, 'afterClose', ()=>{
|
|
27200
|
+
!answered && resolve(undefined);
|
|
27201
|
+
});
|
|
27202
|
+
});
|
|
27054
27203
|
}
|
|
27055
27204
|
function readImagesWithReader(fileList, imagesExtensions, promises, uploader, handlerSuccess, defaultHandlerSuccess) {
|
|
27056
27205
|
const readerPromises = [];
|
|
@@ -27080,7 +27229,7 @@ function readImagesWithReader(fileList, imagesExtensions, promises, uploader, ha
|
|
|
27080
27229
|
name
|
|
27081
27230
|
]
|
|
27082
27231
|
};
|
|
27083
|
-
const handler = (0,
|
|
27232
|
+
const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_3__.isFunction)(handlerSuccess) ? handlerSuccess : defaultHandlerSuccess;
|
|
27084
27233
|
handler.call(uploader, resp);
|
|
27085
27234
|
resolve(resp);
|
|
27086
27235
|
};
|
|
@@ -27196,6 +27345,35 @@ function send(uploader, data) {
|
|
|
27196
27345
|
/* harmony export */ ]);
|
|
27197
27346
|
|
|
27198
27347
|
|
|
27348
|
+
/***/ }),
|
|
27349
|
+
|
|
27350
|
+
/***/ 55083:
|
|
27351
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
27352
|
+
|
|
27353
|
+
"use strict";
|
|
27354
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
27355
|
+
/* harmony export */ UploadError: function() { return /* binding */ UploadError; }
|
|
27356
|
+
/* harmony export */ });
|
|
27357
|
+
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
27358
|
+
/* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(33201);
|
|
27359
|
+
/*!
|
|
27360
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
27361
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
27362
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
27363
|
+
*/ /**
|
|
27364
|
+
* @module modules/uploader
|
|
27365
|
+
*/
|
|
27366
|
+
|
|
27367
|
+
// The connector refused these files: the handler can change the request and send it again
|
|
27368
|
+
class UploadError extends jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_1__.AnswerError {
|
|
27369
|
+
constructor(message, answer, files, retry){
|
|
27370
|
+
var _answer_data;
|
|
27371
|
+
super(message, answer, (_answer_data = answer.data) === null || _answer_data === void 0 ? void 0 : _answer_data.code), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "files", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "retry", void 0), this.files = files, this.retry = retry;
|
|
27372
|
+
Object.setPrototypeOf(this, UploadError.prototype);
|
|
27373
|
+
}
|
|
27374
|
+
}
|
|
27375
|
+
|
|
27376
|
+
|
|
27199
27377
|
/***/ }),
|
|
27200
27378
|
|
|
27201
27379
|
/***/ 94925:
|
|
@@ -27210,9 +27388,10 @@ function send(uploader, data) {
|
|
|
27210
27388
|
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
27211
27389
|
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23211);
|
|
27212
27390
|
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65946);
|
|
27213
|
-
/* harmony import */ var
|
|
27214
|
-
/* harmony import */ var
|
|
27215
|
-
/* harmony import */ var
|
|
27391
|
+
/* harmony import */ var jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(33201);
|
|
27392
|
+
/* harmony import */ var jodit_config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5266);
|
|
27393
|
+
/* harmony import */ var jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11981);
|
|
27394
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(40013);
|
|
27216
27395
|
/*!
|
|
27217
27396
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
27218
27397
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -27230,6 +27409,7 @@ function send(uploader, data) {
|
|
|
27230
27409
|
|
|
27231
27410
|
|
|
27232
27411
|
|
|
27412
|
+
|
|
27233
27413
|
class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewComponent {
|
|
27234
27414
|
get j() {
|
|
27235
27415
|
return this.jodit;
|
|
@@ -27285,14 +27465,14 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
27285
27465
|
}
|
|
27286
27466
|
};
|
|
27287
27467
|
// send data on server
|
|
27288
|
-
if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,
|
|
27289
|
-
(0,
|
|
27468
|
+
if (!jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(cData)) {
|
|
27469
|
+
(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, cData.files, handlerSuccess, handlerError).finally(onFinally);
|
|
27290
27470
|
return false;
|
|
27291
27471
|
}
|
|
27292
27472
|
if (jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_IE && !jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.IS_ES_NEXT) {
|
|
27293
|
-
return (0,
|
|
27473
|
+
return (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.processOldBrowserDrag)(self, cData, handlerSuccess, handlerError, onFinally);
|
|
27294
27474
|
}
|
|
27295
|
-
if ((0,
|
|
27475
|
+
if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasItems)(cData)) {
|
|
27296
27476
|
const { items } = cData;
|
|
27297
27477
|
for(i = 0; i < items.length; i += 1){
|
|
27298
27478
|
if (items[i].kind === 'file' && items[i].type === 'image/png') {
|
|
@@ -27300,7 +27480,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
27300
27480
|
if (file) {
|
|
27301
27481
|
const mime = file.type.match(/\/([a-z0-9]+)/i);
|
|
27302
27482
|
extension = mime[1] ? mime[1].toLowerCase() : '';
|
|
27303
|
-
(0,
|
|
27483
|
+
(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, [
|
|
27304
27484
|
file
|
|
27305
27485
|
], handlerSuccess, handlerError, processData).finally(onFinally);
|
|
27306
27486
|
}
|
|
@@ -27322,21 +27502,21 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
27322
27502
|
self.j.e.on(form, 'dragend dragover dragenter dragleave drop', (e)=>{
|
|
27323
27503
|
e.preventDefault();
|
|
27324
27504
|
}).on(form, 'dragover', (event)=>{
|
|
27325
|
-
if ((0,
|
|
27505
|
+
if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer) || (0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasItems)(event.dataTransfer)) {
|
|
27326
27506
|
form.classList.add('jodit_drag_hover');
|
|
27327
27507
|
event.preventDefault();
|
|
27328
27508
|
}
|
|
27329
27509
|
}).on(form, 'dragend dragleave', (event)=>{
|
|
27330
27510
|
form.classList.remove('jodit_drag_hover');
|
|
27331
|
-
if ((0,
|
|
27511
|
+
if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
|
|
27332
27512
|
event.preventDefault();
|
|
27333
27513
|
}
|
|
27334
27514
|
}).on(form, 'drop', (event)=>{
|
|
27335
27515
|
form.classList.remove('jodit_drag_hover');
|
|
27336
|
-
if ((0,
|
|
27516
|
+
if ((0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.hasFiles)(event.dataTransfer)) {
|
|
27337
27517
|
event.preventDefault();
|
|
27338
27518
|
event.stopImmediatePropagation();
|
|
27339
|
-
(0,
|
|
27519
|
+
(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, event.dataTransfer.files, handlerSuccess, handlerError).finally(onFinally);
|
|
27340
27520
|
}
|
|
27341
27521
|
});
|
|
27342
27522
|
const inputFile = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.first(form, (node)=>{
|
|
@@ -27345,7 +27525,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
27345
27525
|
});
|
|
27346
27526
|
if (inputFile) {
|
|
27347
27527
|
self.j.e.on(inputFile, 'change', ()=>{
|
|
27348
|
-
(0,
|
|
27528
|
+
(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(self, inputFile.files, handlerSuccess, handlerError).then(()=>{
|
|
27349
27529
|
inputFile.value = '';
|
|
27350
27530
|
if (!/safari/i.test(navigator.userAgent)) {
|
|
27351
27531
|
inputFile.type = '';
|
|
@@ -27360,26 +27540,41 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
27360
27540
|
*/ uploadRemoteImage(url, handlerSuccess, handlerError) {
|
|
27361
27541
|
const uploader = this, { o } = uploader;
|
|
27362
27542
|
const handlerE = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isFunction)(handlerError) ? handlerError : o.defaultHandlerError;
|
|
27363
|
-
(0,
|
|
27543
|
+
(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.send)(uploader, {
|
|
27364
27544
|
action: 'fileUploadRemote',
|
|
27365
27545
|
url
|
|
27366
27546
|
}).then((resp)=>{
|
|
27547
|
+
var _resp_data;
|
|
27367
27548
|
if (o.isSuccess.call(uploader, resp)) {
|
|
27368
27549
|
const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isFunction)(handlerSuccess) ? handlerSuccess : o.defaultHandlerSuccess;
|
|
27369
27550
|
handler.call(uploader, o.process.call(uploader, resp));
|
|
27370
27551
|
return;
|
|
27371
27552
|
}
|
|
27372
|
-
handlerE.call(uploader, (0,
|
|
27553
|
+
handlerE.call(uploader, (0,jodit_core_helpers_utils_error__WEBPACK_IMPORTED_MODULE_5__.answer)(o.getMessage.call(uploader, resp), resp, (_resp_data = resp.data) === null || _resp_data === void 0 ? void 0 : _resp_data.code));
|
|
27373
27554
|
}).catch((e)=>handlerE.call(uploader, e));
|
|
27374
27555
|
}
|
|
27375
27556
|
upload(files) {
|
|
27376
27557
|
return this.async.promise((resolve, reject)=>{
|
|
27377
|
-
|
|
27558
|
+
let settled = false;
|
|
27559
|
+
const settle = (end)=>(value)=>{
|
|
27560
|
+
settled = true;
|
|
27561
|
+
end(value);
|
|
27562
|
+
};
|
|
27563
|
+
(0,jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.sendFiles)(this, files, settle(resolve), settle(reject)).then(()=>{
|
|
27564
|
+
// `beforeUpload` kept no file, so no handler ran
|
|
27565
|
+
if (!settled) {
|
|
27566
|
+
resolve({
|
|
27567
|
+
baseurl: '',
|
|
27568
|
+
files: [],
|
|
27569
|
+
isImages: []
|
|
27570
|
+
});
|
|
27571
|
+
}
|
|
27572
|
+
}, settle(reject));
|
|
27378
27573
|
});
|
|
27379
27574
|
}
|
|
27380
27575
|
destruct() {
|
|
27381
27576
|
this.setStatus(jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.STATUSES.beforeDestruct);
|
|
27382
|
-
const instances =
|
|
27577
|
+
const instances = jodit_modules_uploader_helpers__WEBPACK_IMPORTED_MODULE_7__.ajaxInstances.get(this);
|
|
27383
27578
|
if (instances) {
|
|
27384
27579
|
instances.forEach((ajax)=>{
|
|
27385
27580
|
try {
|
|
@@ -27392,7 +27587,7 @@ class Uploader extends jodit_core_component___WEBPACK_IMPORTED_MODULE_1__.ViewCo
|
|
|
27392
27587
|
}
|
|
27393
27588
|
constructor(editor, options){
|
|
27394
27589
|
super(editor), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "path", ''), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "source", 'default'), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "options", void 0);
|
|
27395
|
-
this.options = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.ConfigProto)(options || {}, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.ConfigProto)(
|
|
27590
|
+
this.options = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.ConfigProto)(options || {}, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.ConfigProto)(jodit_config__WEBPACK_IMPORTED_MODULE_6__.Config.defaultOptions.uploader, (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_4__.isJoditObject)(editor) ? editor.o.uploader : {}));
|
|
27396
27591
|
}
|
|
27397
27592
|
}
|
|
27398
27593
|
|