jodit 4.7.3 → 4.7.5
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 +46 -31
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +4 -4
- package/es2015/jodit.js +22 -14
- 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 +4 -4
- 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 +5 -5
- package/es2021/jodit.js +22 -14
- package/es2021/jodit.min.js +5 -5
- 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 +22 -14
- 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 +24 -14
- 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.js +1 -1
- package/esm/core/view/view.d.ts +1 -1
- package/esm/jodit.js +2 -1
- package/esm/modules/uploader/helpers/send.js +17 -11
- package/esm/modules/widget/file-selector/file-selector.js +5 -3
- package/esm/types/uploader.d.ts +14 -0
- package/package.json +1 -1
- package/types/core/view/view.d.ts +1 -1
- package/types/types/uploader.d.ts +14 -0
package/es5/polyfills.fat.min.js
CHANGED
package/es5/polyfills.js
CHANGED
package/es5/polyfills.min.js
CHANGED
package/esm/core/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.7.
|
|
6
|
+
export const APP_VERSION = "4.7.5";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
package/esm/core/view/view.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export declare abstract class View extends Component implements IViewBased, Mods
|
|
|
60
60
|
* Short alias for `create`
|
|
61
61
|
*/
|
|
62
62
|
get c(): this['create'];
|
|
63
|
-
|
|
63
|
+
protected __container: HTMLDivElement;
|
|
64
64
|
get container(): HTMLDivElement;
|
|
65
65
|
set container(container: HTMLDivElement);
|
|
66
66
|
events: IEventEmitter;
|
package/esm/jodit.js
CHANGED
|
@@ -850,7 +850,8 @@ let Jodit = Jodit_1 = class Jodit extends ViewWithToolbar {
|
|
|
850
850
|
*/
|
|
851
851
|
this.__isSilentChange = false;
|
|
852
852
|
this.currentPlace = {
|
|
853
|
-
options: this.__options
|
|
853
|
+
options: this.__options,
|
|
854
|
+
container: this.__container
|
|
854
855
|
};
|
|
855
856
|
this.places = [];
|
|
856
857
|
this.__elementToPlace = new Map();
|
|
@@ -9,28 +9,29 @@ import { buildData } from "./build-data.js";
|
|
|
9
9
|
export const ajaxInstances = new WeakMap();
|
|
10
10
|
export function send(uploader, data) {
|
|
11
11
|
const requestData = buildData(uploader, data);
|
|
12
|
-
const
|
|
12
|
+
const showProgress = (progress) => {
|
|
13
|
+
uploader.j.progressbar.show().progress(progress);
|
|
14
|
+
if (progress >= 100) {
|
|
15
|
+
uploader.j.progressbar.hide();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
let sendData = (request, showProgress) => {
|
|
13
19
|
const ajax = new Ajax({
|
|
14
20
|
xhr: () => {
|
|
15
21
|
const xhr = new XMLHttpRequest();
|
|
16
22
|
if (uploader.j.ow.FormData !== undefined &&
|
|
17
23
|
xhr.upload) {
|
|
18
|
-
|
|
24
|
+
showProgress(10);
|
|
19
25
|
xhr.upload.addEventListener('progress', evt => {
|
|
20
26
|
if (evt.lengthComputable) {
|
|
21
27
|
let percentComplete = evt.loaded / evt.total;
|
|
22
28
|
percentComplete *= 100;
|
|
23
|
-
|
|
24
|
-
.show()
|
|
25
|
-
.progress(percentComplete);
|
|
26
|
-
if (percentComplete >= 100) {
|
|
27
|
-
uploader.j.progressbar.hide();
|
|
28
|
-
}
|
|
29
|
+
showProgress(percentComplete);
|
|
29
30
|
}
|
|
30
31
|
}, false);
|
|
31
32
|
}
|
|
32
33
|
else {
|
|
33
|
-
|
|
34
|
+
showProgress(100);
|
|
34
35
|
}
|
|
35
36
|
return xhr;
|
|
36
37
|
},
|
|
@@ -67,10 +68,15 @@ export function send(uploader, data) {
|
|
|
67
68
|
instances === null || instances === void 0 ? void 0 : instances.delete(ajax);
|
|
68
69
|
});
|
|
69
70
|
};
|
|
71
|
+
if (isFunction(uploader.o.customUploadFunction)) {
|
|
72
|
+
sendData = uploader.o.customUploadFunction;
|
|
73
|
+
}
|
|
70
74
|
if (isPromise(requestData)) {
|
|
71
|
-
return requestData
|
|
75
|
+
return requestData
|
|
76
|
+
.then(data => sendData(data, showProgress))
|
|
77
|
+
.catch(error => {
|
|
72
78
|
uploader.o.error.call(uploader, error);
|
|
73
79
|
});
|
|
74
80
|
}
|
|
75
|
-
return sendData(requestData);
|
|
81
|
+
return sendData(requestData, showProgress);
|
|
76
82
|
}
|
|
@@ -19,9 +19,11 @@ import { TabsWidget } from "../tabs/tabs.js";
|
|
|
19
19
|
export const FileSelectorWidget = (editor, callbacks, elm, close, isImage = true) => {
|
|
20
20
|
let currentImage;
|
|
21
21
|
const tabs = [];
|
|
22
|
+
const options = editor.o.uploader;
|
|
22
23
|
if (callbacks.upload &&
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
(options.url ||
|
|
25
|
+
options.insertImageAsBase64URI ||
|
|
26
|
+
options.customUploadFunction)) {
|
|
25
27
|
const dragBox = editor.c.fromHTML('<div class="jodit-drag-and-drop__file-box">' +
|
|
26
28
|
`<strong>${editor.i18n(isImage ? 'Drop image' : 'Drop file')}</strong>` +
|
|
27
29
|
`<span><br>${editor.i18n('or click')}</span>` +
|
|
@@ -30,7 +32,7 @@ export const FileSelectorWidget = (editor, callbacks, elm, close, isImage = true
|
|
|
30
32
|
editor.uploader.bind(dragBox, resp => {
|
|
31
33
|
const handler = isFunction(callbacks.upload)
|
|
32
34
|
? callbacks.upload
|
|
33
|
-
:
|
|
35
|
+
: options.defaultHandlerSuccess;
|
|
34
36
|
if (isFunction(handler)) {
|
|
35
37
|
handler.call(editor, resp);
|
|
36
38
|
}
|
package/esm/types/uploader.d.ts
CHANGED
|
@@ -90,6 +90,20 @@ export interface IUploaderOptions<T> {
|
|
|
90
90
|
defaultHandlerSuccess: HandlerSuccess;
|
|
91
91
|
defaultHandlerError: HandlerError;
|
|
92
92
|
contentType: (this: T, requestData: any) => string | false;
|
|
93
|
+
/**
|
|
94
|
+
* This method can be used to replace the function of uploading files
|
|
95
|
+
* ```javascript
|
|
96
|
+
* Jodit.make('#editor', {
|
|
97
|
+
* uploader: {
|
|
98
|
+
* customUploadFunction: (requestData, showProgress) => fetch(requestData).then((res)=>{
|
|
99
|
+
* showProgress(100)
|
|
100
|
+
* return res.json()
|
|
101
|
+
* })
|
|
102
|
+
* }
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
customUploadFunction?: (requestData: any, showProgress: (progress: number) => void) => Promise<IUploaderAnswer>;
|
|
93
107
|
}
|
|
94
108
|
export interface IUploader extends IViewComponent {
|
|
95
109
|
readonly jodit: IViewBased;
|
package/package.json
CHANGED
|
@@ -60,7 +60,7 @@ export declare abstract class View extends Component implements IViewBased, Mods
|
|
|
60
60
|
* Short alias for `create`
|
|
61
61
|
*/
|
|
62
62
|
get c(): this['create'];
|
|
63
|
-
|
|
63
|
+
protected __container: HTMLDivElement;
|
|
64
64
|
get container(): HTMLDivElement;
|
|
65
65
|
set container(container: HTMLDivElement);
|
|
66
66
|
events: IEventEmitter;
|
|
@@ -90,6 +90,20 @@ export interface IUploaderOptions<T> {
|
|
|
90
90
|
defaultHandlerSuccess: HandlerSuccess;
|
|
91
91
|
defaultHandlerError: HandlerError;
|
|
92
92
|
contentType: (this: T, requestData: any) => string | false;
|
|
93
|
+
/**
|
|
94
|
+
* This method can be used to replace the function of uploading files
|
|
95
|
+
* ```javascript
|
|
96
|
+
* Jodit.make('#editor', {
|
|
97
|
+
* uploader: {
|
|
98
|
+
* customUploadFunction: (requestData, showProgress) => fetch(requestData).then((res)=>{
|
|
99
|
+
* showProgress(100)
|
|
100
|
+
* return res.json()
|
|
101
|
+
* })
|
|
102
|
+
* }
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
customUploadFunction?: (requestData: any, showProgress: (progress: number) => void) => Promise<IUploaderAnswer>;
|
|
93
107
|
}
|
|
94
108
|
export interface IUploader extends IViewComponent {
|
|
95
109
|
readonly jodit: IViewBased;
|