jodit 4.1.8 → 4.1.11
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 +25 -5
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +135 -103
- package/es2015/jodit.min.js +2 -2
- 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.css +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +138 -106
- package/es2018/jodit.min.js +2 -2
- package/es2018/plugins/debug/debug.js +1 -1
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.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 +2 -2
- package/es2021/jodit.js +138 -106
- package/es2021/jodit.min.js +2 -2
- 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 +2 -2
- package/es2021.en/jodit.js +138 -106
- package/es2021.en/jodit.min.js +2 -2
- 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 +138 -111
- package/es5/jodit.min.css +2 -2
- package/es5/jodit.min.js +2 -2
- 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/esm/core/async/async.js +4 -3
- package/esm/core/constants.js +1 -1
- package/esm/core/helpers/checker/index.d.ts +1 -0
- package/esm/core/helpers/checker/index.js +1 -0
- package/esm/core/helpers/checker/is-abort-error.d.ts +10 -0
- package/esm/core/helpers/checker/is-abort-error.js +10 -0
- package/esm/core/helpers/utils/error/error.d.ts +0 -2
- package/esm/core/helpers/utils/error/error.js +1 -7
- package/esm/core/helpers/utils/error/errors/abort-error.d.ts +13 -3
- package/esm/core/helpers/utils/error/errors/abort-error.js +7 -5
- package/esm/modules/file-browser/config.d.ts +1 -0
- package/esm/modules/file-browser/config.js +1 -0
- package/esm/modules/file-browser/data-provider.d.ts +1 -1
- package/esm/modules/file-browser/data-provider.js +9 -9
- package/esm/modules/file-browser/file-browser.js +3 -3
- package/esm/modules/messages/messages.js +3 -0
- package/esm/plugins/ai-assistant/ai-assistant.js +4 -0
- package/esm/plugins/ai-assistant/ui/ui-ai-assistant.js +1 -1
- package/package.json +1 -1
- package/types/core/helpers/checker/index.d.ts +1 -0
- package/types/core/helpers/checker/is-abort-error.d.ts +10 -0
- package/types/core/helpers/utils/error/error.d.ts +0 -2
- package/types/core/helpers/utils/error/errors/abort-error.d.ts +13 -3
- package/types/modules/file-browser/config.d.ts +1 -0
- package/types/modules/file-browser/data-provider.d.ts +1 -1
package/esm/core/async/async.js
CHANGED
|
@@ -12,6 +12,7 @@ import { isPromise } from "jodit/esm/core/helpers/checker/is-promise.js";
|
|
|
12
12
|
import { isString } from "jodit/esm/core/helpers/checker/is-string.js";
|
|
13
13
|
import { isVoid } from "jodit/esm/core/helpers/checker/is-void.js";
|
|
14
14
|
import { assert } from "jodit/esm/core/helpers/utils/assert.js";
|
|
15
|
+
import { abort } from "jodit/esm/core/helpers/utils/error/errors/abort-error.js";
|
|
15
16
|
export class Async {
|
|
16
17
|
constructor() {
|
|
17
18
|
this.timers = new Map();
|
|
@@ -202,9 +203,9 @@ export class Async {
|
|
|
202
203
|
promise(executor) {
|
|
203
204
|
let rejectCallback = () => { };
|
|
204
205
|
const promise = new Promise((resolve, reject) => {
|
|
205
|
-
|
|
206
|
-
rejectCallback
|
|
207
|
-
|
|
206
|
+
rejectCallback = () => reject(abort());
|
|
207
|
+
this.promisesRejections.add(rejectCallback);
|
|
208
|
+
executor(resolve, reject);
|
|
208
209
|
});
|
|
209
210
|
if (!promise.finally && typeof process !== 'undefined' && !IS_ES_NEXT) {
|
|
210
211
|
promise.finally = (onfinally) => {
|
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-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.1.
|
|
6
|
+
export const APP_VERSION = "4.1.11";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
+
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @module helpers/checker
|
|
8
|
+
*/
|
|
9
|
+
import type { AbortError } from "../utils/error/errors/abort-error";
|
|
10
|
+
export declare function isAbortError(error: unknown): error is AbortError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
+
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
export function isAbortError(error) {
|
|
7
|
+
return (Boolean(error) &&
|
|
8
|
+
error instanceof DOMException &&
|
|
9
|
+
error.name === 'AbortError');
|
|
10
|
+
}
|
|
@@ -9,5 +9,3 @@
|
|
|
9
9
|
export declare function error(message: string): Error;
|
|
10
10
|
export declare function connection(message: string): Error;
|
|
11
11
|
export declare function options(message: string): Error;
|
|
12
|
-
export declare function abort(message: string): Error;
|
|
13
|
-
export declare function isAbort(error: unknown): boolean;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module helpers/utils
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { ConnectionError, OptionsError } from "./errors";
|
|
10
10
|
/**
|
|
11
11
|
* Helper for create Error object
|
|
12
12
|
*/
|
|
@@ -19,9 +19,3 @@ export function connection(message) {
|
|
|
19
19
|
export function options(message) {
|
|
20
20
|
return new OptionsError(message);
|
|
21
21
|
}
|
|
22
|
-
export function abort(message) {
|
|
23
|
-
return new AbortError(message);
|
|
24
|
-
}
|
|
25
|
-
export function isAbort(error) {
|
|
26
|
-
return error instanceof AbortError;
|
|
27
|
-
}
|
|
@@ -6,6 +6,16 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module helpers/utils
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
9
|
+
import { isAbortError } from "jodit/esm/core/helpers/checker/is-abort-error";
|
|
10
|
+
/**
|
|
11
|
+
* `AbortError` is not a separate exception, but rather a {@link DOMException} with a special `name`.
|
|
12
|
+
* https://webidl.spec.whatwg.org/#aborterror
|
|
13
|
+
*/
|
|
14
|
+
export type AbortError = DOMException & {
|
|
15
|
+
name: 'AbortError';
|
|
16
|
+
};
|
|
17
|
+
export declare function abort(message?: string): Error;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated use `isAbortError` instead
|
|
20
|
+
*/
|
|
21
|
+
export declare const isAbort: typeof isAbortError;
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module helpers/utils
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Object.setPrototypeOf(this, AbortError.prototype);
|
|
13
|
-
}
|
|
9
|
+
import { isAbortError } from "jodit/esm/core/helpers/checker/is-abort-error.js";
|
|
10
|
+
export function abort(message = 'Aborted') {
|
|
11
|
+
return new DOMException(message, 'AbortError');
|
|
14
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated use `isAbortError` instead
|
|
15
|
+
*/
|
|
16
|
+
export const isAbort = isAbortError;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
+
import "jodit/esm/core/request/config.js";
|
|
6
7
|
import { isArray, isString } from "jodit/esm/core/helpers/checker/index.js";
|
|
7
8
|
import { humanSizeToBytes } from "jodit/esm/core/helpers/utils/human-size-to-bytes.js";
|
|
8
9
|
import { UIFileInput } from "jodit/esm/core/ui/form/inputs/file/file.js";
|
|
@@ -17,7 +17,7 @@ export default class DataProvider implements IFileBrowserDataProvider {
|
|
|
17
17
|
* Alias for options
|
|
18
18
|
*/
|
|
19
19
|
get o(): this['options'];
|
|
20
|
-
private
|
|
20
|
+
private __ajaxInstances;
|
|
21
21
|
protected get<T extends IFileBrowserAnswer = IFileBrowserAnswer>(name: keyof IFileBrowserOptions): Promise<T>;
|
|
22
22
|
private progressHandler;
|
|
23
23
|
onProgress(callback: (percentage: number) => void): void;
|
|
@@ -39,7 +39,7 @@ let DataProvider = class DataProvider {
|
|
|
39
39
|
this.parent = parent;
|
|
40
40
|
this.options = options;
|
|
41
41
|
this.__currentPermissions = null;
|
|
42
|
-
this.
|
|
42
|
+
this.__ajaxInstances = new Map();
|
|
43
43
|
this.progressHandler = (ignore) => { };
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
@@ -49,11 +49,11 @@ let DataProvider = class DataProvider {
|
|
|
49
49
|
return this.options;
|
|
50
50
|
}
|
|
51
51
|
get(name) {
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
const ajax =
|
|
52
|
+
const instances = this.__ajaxInstances;
|
|
53
|
+
if (instances.has(name)) {
|
|
54
|
+
const ajax = instances.get(name);
|
|
55
55
|
ajax?.abort();
|
|
56
|
-
|
|
56
|
+
instances.delete(name);
|
|
57
57
|
}
|
|
58
58
|
const opts = ConfigProto(this.options[name] !== undefined
|
|
59
59
|
? this.options[name]
|
|
@@ -64,12 +64,12 @@ let DataProvider = class DataProvider {
|
|
|
64
64
|
opts.data = opts.prepareData.call(this, opts.data);
|
|
65
65
|
}
|
|
66
66
|
const ajax = new Ajax(opts);
|
|
67
|
-
|
|
67
|
+
instances.set(name, ajax);
|
|
68
68
|
const promise = ajax.send();
|
|
69
69
|
promise
|
|
70
70
|
.finally(() => {
|
|
71
71
|
ajax.destruct();
|
|
72
|
-
|
|
72
|
+
instances.delete(name);
|
|
73
73
|
this.progressHandler(100);
|
|
74
74
|
})
|
|
75
75
|
.catch(() => null);
|
|
@@ -387,8 +387,8 @@ let DataProvider = class DataProvider {
|
|
|
387
387
|
return this.options.isSuccess(resp);
|
|
388
388
|
}
|
|
389
389
|
destruct() {
|
|
390
|
-
this.
|
|
391
|
-
this.
|
|
390
|
+
this.__ajaxInstances.forEach(a => a.destruct());
|
|
391
|
+
this.__ajaxInstances.clear();
|
|
392
392
|
}
|
|
393
393
|
};
|
|
394
394
|
DataProvider = __decorate([
|
|
@@ -18,7 +18,7 @@ import * as consts from "jodit/esm/core/constants.js";
|
|
|
18
18
|
import { IS_PROD } from "jodit/esm/core/constants.js";
|
|
19
19
|
import { autobind, cache, derive } from "jodit/esm/core/decorators/index.js";
|
|
20
20
|
import { observable } from "jodit/esm/core/event-emitter/index.js";
|
|
21
|
-
import { ConfigProto, error,
|
|
21
|
+
import { ConfigProto, error, isAbortError, isFunction, isString, trim } from "jodit/esm/core/helpers/index.js";
|
|
22
22
|
import { Storage } from "jodit/esm/core/storage/index.js";
|
|
23
23
|
import { Dlgs } from "jodit/esm/core/traits/dlgs.js";
|
|
24
24
|
import { ViewWithToolbar } from "jodit/esm/core/view/view-with-toolbar.js";
|
|
@@ -97,7 +97,7 @@ let FileBrowser = class FileBrowser extends ViewWithToolbar {
|
|
|
97
97
|
* ```
|
|
98
98
|
*/
|
|
99
99
|
status(message, success) {
|
|
100
|
-
if (!message ||
|
|
100
|
+
if (!message || isAbortError(message)) {
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
if (!isString(message)) {
|
|
@@ -212,7 +212,7 @@ let FileBrowser = class FileBrowser extends ViewWithToolbar {
|
|
|
212
212
|
onlyImages: false
|
|
213
213
|
});
|
|
214
214
|
this.errorHandler = (resp) => {
|
|
215
|
-
if (
|
|
215
|
+
if (isAbortError(resp)) {
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
218
|
if (resp instanceof Error) {
|
|
@@ -79,6 +79,9 @@ let UIMessages = class UIMessages extends UIGroup {
|
|
|
79
79
|
this.async.updateTimeout(key, timeout || this.options.defaultTimeout);
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
+
if (!this.__box) {
|
|
83
|
+
throw new Error('Container is not defined: ' + key);
|
|
84
|
+
}
|
|
82
85
|
this.__box.appendChild(this.container);
|
|
83
86
|
const msg = new UIMessage(this.j, { text, variant });
|
|
84
87
|
this.append(msg);
|
|
@@ -15,6 +15,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
15
15
|
};
|
|
16
16
|
import watch from "jodit/esm/core/decorators/watch/watch.js";
|
|
17
17
|
import { extendLang, pluginSystem } from "jodit/esm/core/global.js";
|
|
18
|
+
import { isAbortError } from "jodit/esm/core/helpers/checker/is-abort-error.js";
|
|
18
19
|
import { Plugin } from "jodit/esm/core/plugin/plugin.js";
|
|
19
20
|
import "./config";
|
|
20
21
|
import { UiAiAssistant } from "./ui/ui-ai-assistant";
|
|
@@ -88,6 +89,9 @@ export class aiAssistant extends Plugin {
|
|
|
88
89
|
jodit.e.fire('ai-assistant-response', htmlFragment);
|
|
89
90
|
})
|
|
90
91
|
.catch(error => {
|
|
92
|
+
if (isAbortError(error)) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
91
95
|
jodit.message.error(error.message);
|
|
92
96
|
jodit.e.fire('ai-assistant-error', error.message);
|
|
93
97
|
});
|
|
@@ -144,7 +144,7 @@ __decorate([
|
|
|
144
144
|
watch(':ai-assistant-error')
|
|
145
145
|
], UiAiAssistant.prototype, "onAiAssistentError", null);
|
|
146
146
|
__decorate([
|
|
147
|
-
watch('promptInput
|
|
147
|
+
watch('promptInput:change')
|
|
148
148
|
], UiAiAssistant.prototype, "onChangePromptValue", null);
|
|
149
149
|
UiAiAssistant = __decorate([
|
|
150
150
|
component
|
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
+
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @module helpers/checker
|
|
8
|
+
*/
|
|
9
|
+
import type { AbortError } from "../utils/error/errors/abort-error";
|
|
10
|
+
export declare function isAbortError(error: unknown): error is AbortError;
|
|
@@ -9,5 +9,3 @@
|
|
|
9
9
|
export declare function error(message: string): Error;
|
|
10
10
|
export declare function connection(message: string): Error;
|
|
11
11
|
export declare function options(message: string): Error;
|
|
12
|
-
export declare function abort(message: string): Error;
|
|
13
|
-
export declare function isAbort(error: unknown): boolean;
|
|
@@ -6,6 +6,16 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module helpers/utils
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
9
|
+
import { isAbortError } from "jodit/esm/core/helpers/checker/is-abort-error";
|
|
10
|
+
/**
|
|
11
|
+
* `AbortError` is not a separate exception, but rather a {@link DOMException} with a special `name`.
|
|
12
|
+
* https://webidl.spec.whatwg.org/#aborterror
|
|
13
|
+
*/
|
|
14
|
+
export type AbortError = DOMException & {
|
|
15
|
+
name: 'AbortError';
|
|
16
|
+
};
|
|
17
|
+
export declare function abort(message?: string): Error;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated use `isAbortError` instead
|
|
20
|
+
*/
|
|
21
|
+
export declare const isAbort: typeof isAbortError;
|
|
@@ -17,7 +17,7 @@ export default class DataProvider implements IFileBrowserDataProvider {
|
|
|
17
17
|
* Alias for options
|
|
18
18
|
*/
|
|
19
19
|
get o(): this['options'];
|
|
20
|
-
private
|
|
20
|
+
private __ajaxInstances;
|
|
21
21
|
protected get<T extends IFileBrowserAnswer = IFileBrowserAnswer>(name: keyof IFileBrowserOptions): Promise<T>;
|
|
22
22
|
private progressHandler;
|
|
23
23
|
onProgress(callback: (percentage: number) => void): void;
|