jodit 4.12.41 → 4.12.44
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 +16 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +4 -4
- package/es2015/jodit.js +99 -6
- 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 +6 -6
- package/es2021/jodit.js +99 -6
- package/es2021/jodit.min.js +6 -6
- 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 +6 -6
- package/es2021.en/jodit.js +99 -6
- package/es2021.en/jodit.min.js +7 -7
- 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 +99 -6
- 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/config.d.ts +22 -0
- package/esm/config.js +21 -0
- package/esm/core/constants.js +1 -1
- package/esm/core/storage/async-storage.d.ts +2 -2
- package/esm/core/storage/async-storage.js +19 -1
- package/esm/core/storage/engines/local-storage-provider.js +6 -1
- package/esm/core/view/view.js +1 -1
- package/esm/plugins/clean-html/helpers/index.d.ts +1 -0
- package/esm/plugins/clean-html/helpers/index.js +1 -0
- package/esm/plugins/clean-html/helpers/is-allowed-media-embed.d.ts +15 -0
- package/esm/plugins/clean-html/helpers/is-allowed-media-embed.js +28 -0
- package/esm/plugins/clean-html/helpers/visitor/filters/sandbox-iframes-in-content.js +7 -0
- package/esm/plugins/clean-html/helpers/visitor/filters/try-remove-node.js +9 -1
- package/esm/types/storage.d.ts +15 -0
- package/esm/types/view.d.ts +8 -1
- package/package.json +1 -1
- package/types/config.d.ts +22 -0
- package/types/core/storage/async-storage.d.ts +2 -2
- package/types/plugins/clean-html/helpers/index.d.ts +1 -0
- package/types/plugins/clean-html/helpers/is-allowed-media-embed.d.ts +15 -0
- package/types/types/storage.d.ts +15 -0
- package/types/types/view.d.ts +8 -1
package/es5/polyfills.fat.min.js
CHANGED
package/es5/polyfills.js
CHANGED
package/es5/polyfills.min.js
CHANGED
package/esm/config.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import type { ISourceEditor } from "./types/index";
|
|
|
21
21
|
import type { ISpeechRecognizeConstructor } from "./plugins/speech-recognize/interface";
|
|
22
22
|
import type { Attributes } from "./types/index";
|
|
23
23
|
import type { Controls } from "./types/index";
|
|
24
|
+
import type { IAsyncStorageOptions } from "./types/index";
|
|
24
25
|
import type { IExtraPlugin } from "./types/index";
|
|
25
26
|
import type { IUIButtonState } from "./types/index";
|
|
26
27
|
import type { IViewOptions } from "./types/index";
|
|
@@ -345,6 +346,27 @@ declare class Config implements IViewOptions {
|
|
|
345
346
|
* if set true, then the current mode is saved in a cookie, and is restored after a reload of the page
|
|
346
347
|
*/
|
|
347
348
|
saveModeInStorage: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Configure the provider that backs {@link IViewBased.asyncStorage}.
|
|
351
|
+
*
|
|
352
|
+
* By default the editor's `asyncStorage` uses persistent `IndexedDB` (with an
|
|
353
|
+
* in-memory fallback when it is unavailable). Set `defaultProvider` to override it:
|
|
354
|
+
* - `'local'` — persist in `localStorage`;
|
|
355
|
+
* - `'memory'` — keep everything in memory (nothing survives a reload);
|
|
356
|
+
* - a custom {@link IAsyncStorage} implementation — plug in your own backend.
|
|
357
|
+
*
|
|
358
|
+
* ```javascript
|
|
359
|
+
* Jodit.make('#editor', {
|
|
360
|
+
* asyncStorage: { defaultProvider: 'local' }
|
|
361
|
+
* });
|
|
362
|
+
*
|
|
363
|
+
* // or a fully custom backend
|
|
364
|
+
* Jodit.make('#editor', {
|
|
365
|
+
* asyncStorage: { defaultProvider: myAsyncStorage }
|
|
366
|
+
* });
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
asyncStorage: IAsyncStorageOptions;
|
|
348
370
|
/**
|
|
349
371
|
* Class name that can be appended to the editable area
|
|
350
372
|
*
|
package/esm/config.js
CHANGED
|
@@ -363,6 +363,27 @@ class Config {
|
|
|
363
363
|
* if set true, then the current mode is saved in a cookie, and is restored after a reload of the page
|
|
364
364
|
*/
|
|
365
365
|
this.saveModeInStorage = false;
|
|
366
|
+
/**
|
|
367
|
+
* Configure the provider that backs {@link IViewBased.asyncStorage}.
|
|
368
|
+
*
|
|
369
|
+
* By default the editor's `asyncStorage` uses persistent `IndexedDB` (with an
|
|
370
|
+
* in-memory fallback when it is unavailable). Set `defaultProvider` to override it:
|
|
371
|
+
* - `'local'` — persist in `localStorage`;
|
|
372
|
+
* - `'memory'` — keep everything in memory (nothing survives a reload);
|
|
373
|
+
* - a custom {@link IAsyncStorage} implementation — plug in your own backend.
|
|
374
|
+
*
|
|
375
|
+
* ```javascript
|
|
376
|
+
* Jodit.make('#editor', {
|
|
377
|
+
* asyncStorage: { defaultProvider: 'local' }
|
|
378
|
+
* });
|
|
379
|
+
*
|
|
380
|
+
* // or a fully custom backend
|
|
381
|
+
* Jodit.make('#editor', {
|
|
382
|
+
* asyncStorage: { defaultProvider: myAsyncStorage }
|
|
383
|
+
* });
|
|
384
|
+
* ```
|
|
385
|
+
*/
|
|
386
|
+
this.asyncStorage = {};
|
|
366
387
|
/**
|
|
367
388
|
* Class name that can be appended to the editable area
|
|
368
389
|
*
|
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-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.12.
|
|
6
|
+
export const APP_VERSION = "4.12.44";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module storage
|
|
8
8
|
*/
|
|
9
|
-
import type { IAsyncStorage, IStorage, StorageValueType } from "../../types/index";
|
|
9
|
+
import type { IAsyncStorage, IAsyncStorageOptions, IStorage, StorageValueType } from "../../types/index";
|
|
10
10
|
import { type WebStorageStrategy } from "./engines/local-storage-provider";
|
|
11
11
|
export declare class AsyncStorage<T = StorageValueType> implements IAsyncStorage<T> {
|
|
12
12
|
private provider;
|
|
@@ -18,5 +18,5 @@ export declare class AsyncStorage<T = StorageValueType> implements IAsyncStorage
|
|
|
18
18
|
exists(key: string): Promise<boolean>;
|
|
19
19
|
clear(): Promise<this>;
|
|
20
20
|
close(): Promise<void>;
|
|
21
|
-
static makeStorage(persistentOrStrategy?: boolean | WebStorageStrategy | 'memoryStorage' | 'indexedDB', suffix?: string): IAsyncStorage;
|
|
21
|
+
static makeStorage(persistentOrStrategy?: boolean | WebStorageStrategy | 'memoryStorage' | 'indexedDB', suffix?: string, options?: IAsyncStorageOptions): IAsyncStorage;
|
|
22
22
|
}
|
|
@@ -45,9 +45,27 @@ export class AsyncStorage {
|
|
|
45
45
|
await provider.close();
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
static makeStorage(persistentOrStrategy = false, suffix) {
|
|
48
|
+
static makeStorage(persistentOrStrategy = false, suffix, options) {
|
|
49
49
|
let provider = undefined;
|
|
50
50
|
let storage = null;
|
|
51
|
+
// An explicit `defaultProvider` overrides the strategy-based selection
|
|
52
|
+
// below and decides which provider backs the storage.
|
|
53
|
+
const defaultProvider = options === null || options === void 0 ? void 0 : options.defaultProvider;
|
|
54
|
+
if (defaultProvider != null) {
|
|
55
|
+
if (defaultProvider === 'local') {
|
|
56
|
+
provider = canUsePersistentStorage('localStorage')
|
|
57
|
+
? new LocalStorageProvider(StorageKey + (suffix || ''))
|
|
58
|
+
: new MemoryStorageProvider();
|
|
59
|
+
}
|
|
60
|
+
else if (defaultProvider === 'memory') {
|
|
61
|
+
provider = new MemoryStorageProvider();
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// A custom IAsyncStorage implementation, used as-is.
|
|
65
|
+
provider = defaultProvider;
|
|
66
|
+
}
|
|
67
|
+
return new AsyncStorage(Promise.resolve(provider), suffix);
|
|
68
|
+
}
|
|
51
69
|
if (persistentOrStrategy === 'localStorage' ||
|
|
52
70
|
persistentOrStrategy === 'sessionStorage') {
|
|
53
71
|
if (canUsePersistentStorage(persistentOrStrategy)) {
|
|
@@ -47,7 +47,12 @@ export class LocalStorageProvider {
|
|
|
47
47
|
}
|
|
48
48
|
delete(key) {
|
|
49
49
|
try {
|
|
50
|
-
this.storage.
|
|
50
|
+
const buffer = this.storage.getItem(this.rootKey);
|
|
51
|
+
if (buffer) {
|
|
52
|
+
const json = JSON.parse(buffer);
|
|
53
|
+
delete json[key];
|
|
54
|
+
this.storage.setItem(this.rootKey, JSON.stringify(json));
|
|
55
|
+
}
|
|
51
56
|
}
|
|
52
57
|
catch (_a) { }
|
|
53
58
|
return this;
|
package/esm/core/view/view.js
CHANGED
|
@@ -105,7 +105,7 @@ let View = View_1 = class View extends Component {
|
|
|
105
105
|
* Container for persistent set/get value
|
|
106
106
|
*/
|
|
107
107
|
get asyncStorage() {
|
|
108
|
-
return AsyncStorage.makeStorage(true, this.id);
|
|
108
|
+
return AsyncStorage.makeStorage(true, this.id, this.o.asyncStorage);
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* Short alias for `create`
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @module plugins/clean-html
|
|
8
8
|
*/
|
|
9
9
|
export * from "./get-hash";
|
|
10
|
+
export * from "./is-allowed-media-embed";
|
|
10
11
|
export * from "./remove-format/remove-format-for-collapsed-selection";
|
|
11
12
|
export * from "./remove-format/remove-format-for-selection";
|
|
12
13
|
export * from "./visitor/visit-node-walker";
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @module plugins/clean-html
|
|
8
8
|
*/
|
|
9
9
|
export * from "./get-hash.js";
|
|
10
|
+
export * from "./is-allowed-media-embed.js";
|
|
10
11
|
export * from "./remove-format/remove-format-for-collapsed-selection.js";
|
|
11
12
|
export * from "./remove-format/remove-format-for-selection.js";
|
|
12
13
|
export * from "./visitor/visit-node-walker.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
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-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Whether an `<iframe>` `src` points at a recognized YouTube/Vimeo video
|
|
8
|
+
* player. Such iframes are inserted intentionally through the Video button, so
|
|
9
|
+
* clean-html must not strip them (`denyTags` includes `iframe` by default) or
|
|
10
|
+
* neutralize them with an empty `sandbox=""` (#1381). Arbitrary/bare iframes
|
|
11
|
+
* are still removed.
|
|
12
|
+
*
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
export declare function isAllowedMediaEmbed(src: string): boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
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-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @module plugins/clean-html
|
|
8
|
+
*/
|
|
9
|
+
// The embed URLs produced by the built-in Video button (see
|
|
10
|
+
// `convertMediaUrlToVideoEmbed`): `//www.youtube.com/embed/<id>` and
|
|
11
|
+
// `//player.vimeo.com/video/<id>`. `youtube-nocookie.com` is the privacy
|
|
12
|
+
// variant YouTube offers for the same `/embed/` player. The `/embed/` and
|
|
13
|
+
// `/video/` path prefixes are required so a bare provider link
|
|
14
|
+
// (`youtube.com/@somebody`) is not treated as a player.
|
|
15
|
+
const YOUTUBE_EMBED = /^(https?:)?\/\/(www\.|m\.|music\.)?youtube(-nocookie)?\.com\/embed\//i;
|
|
16
|
+
const VIMEO_EMBED = /^(https?:)?\/\/player\.vimeo\.com\/video\//i;
|
|
17
|
+
/**
|
|
18
|
+
* Whether an `<iframe>` `src` points at a recognized YouTube/Vimeo video
|
|
19
|
+
* player. Such iframes are inserted intentionally through the Video button, so
|
|
20
|
+
* clean-html must not strip them (`denyTags` includes `iframe` by default) or
|
|
21
|
+
* neutralize them with an empty `sandbox=""` (#1381). Arbitrary/bare iframes
|
|
22
|
+
* are still removed.
|
|
23
|
+
*
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
export function isAllowedMediaEmbed(src) {
|
|
27
|
+
return YOUTUBE_EMBED.test(src) || VIMEO_EMBED.test(src);
|
|
28
|
+
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Dom } from "../../../../../core/dom/dom.js";
|
|
7
7
|
import { attr } from "../../../../../core/helpers/utils/attr.js";
|
|
8
|
+
import { isAllowedMediaEmbed } from "../../is-allowed-media-embed.js";
|
|
8
9
|
/**
|
|
9
10
|
* Add `sandbox=""` attribute to all `<iframe>` elements in the editor content
|
|
10
11
|
* @private
|
|
@@ -16,6 +17,12 @@ export function sandboxIframesInContent(jodit, nodeElm, hadEffect) {
|
|
|
16
17
|
return hadEffect;
|
|
17
18
|
}
|
|
18
19
|
const elm = nodeElm;
|
|
20
|
+
// A trusted YouTube/Vimeo player (inserted via the Video button) must not
|
|
21
|
+
// get an empty `sandbox=""` — that blocks scripts and stops playback. It
|
|
22
|
+
// is served in its own third-party origin, so leave it as-is (#1381).
|
|
23
|
+
if (isAllowedMediaEmbed(attr(elm, 'src') || '')) {
|
|
24
|
+
return hadEffect;
|
|
25
|
+
}
|
|
19
26
|
if (!elm.hasAttribute('sandbox')) {
|
|
20
27
|
attr(elm, 'sandbox', '');
|
|
21
28
|
return true;
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
import { IS_INLINE } from "../../../../../core/constants.js";
|
|
7
7
|
import { Dom } from "../../../../../core/dom/dom.js";
|
|
8
8
|
import { trimInv } from "../../../../../core/helpers/string/trim.js";
|
|
9
|
+
import { attr } from "../../../../../core/helpers/utils/attr.js";
|
|
10
|
+
import { isAllowedMediaEmbed } from "../../is-allowed-media-embed.js";
|
|
9
11
|
/**
|
|
10
12
|
* @private
|
|
11
13
|
*/
|
|
@@ -24,7 +26,13 @@ function isRemovableNode(jodit, node, current, allow, deny) {
|
|
|
24
26
|
if (allow && !allow[node.nodeName]) {
|
|
25
27
|
return true;
|
|
26
28
|
}
|
|
27
|
-
|
|
29
|
+
// A YouTube/Vimeo player inserted through the Video button is trusted
|
|
30
|
+
// editor content, so keep it even though `iframe` is denied by default
|
|
31
|
+
// — otherwise the embed is stripped ~300ms after insertion (#1381).
|
|
32
|
+
// Arbitrary/bare iframes stay denied.
|
|
33
|
+
const isTrustedEmbed = node.nodeName === 'IFRAME' &&
|
|
34
|
+
isAllowedMediaEmbed(attr(node, 'src') || '');
|
|
35
|
+
if (!allow && deny && deny[node.nodeName] && !isTrustedEmbed) {
|
|
28
36
|
return true;
|
|
29
37
|
}
|
|
30
38
|
}
|
package/esm/types/storage.d.ts
CHANGED
|
@@ -22,3 +22,18 @@ export interface IAsyncStorage<T = StorageValueType> {
|
|
|
22
22
|
clear(): Promise<this>;
|
|
23
23
|
close(): Promise<void>;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Which provider should back an {@link IAsyncStorage} created by
|
|
27
|
+
* `AsyncStorage.makeStorage`:
|
|
28
|
+
* - `'local'` — use `localStorage` (falls back to memory if it is blocked);
|
|
29
|
+
* - `'memory'` — use an in-memory store (nothing survives a page reload);
|
|
30
|
+
* - a custom {@link IAsyncStorage} implementation — use it as-is.
|
|
31
|
+
*/
|
|
32
|
+
export type AsyncStorageDefaultProvider = 'local' | 'memory' | IAsyncStorage;
|
|
33
|
+
export interface IAsyncStorageOptions {
|
|
34
|
+
/**
|
|
35
|
+
* Overrides the provider that backs the storage. When omitted the storage
|
|
36
|
+
* behaves as before — persistent `IndexedDB` with an in-memory fallback.
|
|
37
|
+
*/
|
|
38
|
+
defaultProvider?: AsyncStorageDefaultProvider;
|
|
39
|
+
}
|
package/esm/types/view.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import type { Buttons, ButtonsGroup, ButtonsOption, Controls, IControlType, IProgressBar, IToolbarCollection } from "./toolbar";
|
|
10
10
|
import type { CanUndef, IComponent, IContainer, IDictionary, Nullable } from "./types";
|
|
11
11
|
import type { Attributes, ICreate } from "./create";
|
|
12
|
-
import type { IAsyncStorage, IStorage } from "./storage";
|
|
12
|
+
import type { IAsyncStorage, IAsyncStorageOptions, IStorage } from "./storage";
|
|
13
13
|
import type { IUIButtonState } from "./ui";
|
|
14
14
|
import type { IEventEmitter } from "./events";
|
|
15
15
|
import type { IPluginButton } from "./plugin";
|
|
@@ -40,6 +40,13 @@ interface IViewOptions extends ILanguageOptions, IToolbarOptions {
|
|
|
40
40
|
* Use cache for heavy methods
|
|
41
41
|
*/
|
|
42
42
|
cache?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Configure the provider that backs {@link IViewBased.asyncStorage}.
|
|
45
|
+
* By default it uses persistent `IndexedDB` (with an in-memory fallback);
|
|
46
|
+
* set `defaultProvider` to `'local'`, `'memory'` or a custom
|
|
47
|
+
* {@link IAsyncStorage} implementation to override it.
|
|
48
|
+
*/
|
|
49
|
+
asyncStorage?: IAsyncStorageOptions;
|
|
43
50
|
getIcon?: (name: string, clearName: string) => CanUndef<string>;
|
|
44
51
|
headerButtons?: string | Array<IControlType | string | ButtonsGroup>;
|
|
45
52
|
readonly basePath?: string;
|
package/package.json
CHANGED
package/types/config.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import type { ISourceEditor } from "./types/index";
|
|
|
21
21
|
import type { ISpeechRecognizeConstructor } from "./plugins/speech-recognize/interface";
|
|
22
22
|
import type { Attributes } from "./types/index";
|
|
23
23
|
import type { Controls } from "./types/index";
|
|
24
|
+
import type { IAsyncStorageOptions } from "./types/index";
|
|
24
25
|
import type { IExtraPlugin } from "./types/index";
|
|
25
26
|
import type { IUIButtonState } from "./types/index";
|
|
26
27
|
import type { IViewOptions } from "./types/index";
|
|
@@ -345,6 +346,27 @@ declare class Config implements IViewOptions {
|
|
|
345
346
|
* if set true, then the current mode is saved in a cookie, and is restored after a reload of the page
|
|
346
347
|
*/
|
|
347
348
|
saveModeInStorage: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Configure the provider that backs {@link IViewBased.asyncStorage}.
|
|
351
|
+
*
|
|
352
|
+
* By default the editor's `asyncStorage` uses persistent `IndexedDB` (with an
|
|
353
|
+
* in-memory fallback when it is unavailable). Set `defaultProvider` to override it:
|
|
354
|
+
* - `'local'` — persist in `localStorage`;
|
|
355
|
+
* - `'memory'` — keep everything in memory (nothing survives a reload);
|
|
356
|
+
* - a custom {@link IAsyncStorage} implementation — plug in your own backend.
|
|
357
|
+
*
|
|
358
|
+
* ```javascript
|
|
359
|
+
* Jodit.make('#editor', {
|
|
360
|
+
* asyncStorage: { defaultProvider: 'local' }
|
|
361
|
+
* });
|
|
362
|
+
*
|
|
363
|
+
* // or a fully custom backend
|
|
364
|
+
* Jodit.make('#editor', {
|
|
365
|
+
* asyncStorage: { defaultProvider: myAsyncStorage }
|
|
366
|
+
* });
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
asyncStorage: IAsyncStorageOptions;
|
|
348
370
|
/**
|
|
349
371
|
* Class name that can be appended to the editable area
|
|
350
372
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module storage
|
|
8
8
|
*/
|
|
9
|
-
import type { IAsyncStorage, IStorage, StorageValueType } from "../../types/index";
|
|
9
|
+
import type { IAsyncStorage, IAsyncStorageOptions, IStorage, StorageValueType } from "../../types/index";
|
|
10
10
|
import { type WebStorageStrategy } from "./engines/local-storage-provider";
|
|
11
11
|
export declare class AsyncStorage<T = StorageValueType> implements IAsyncStorage<T> {
|
|
12
12
|
private provider;
|
|
@@ -18,5 +18,5 @@ export declare class AsyncStorage<T = StorageValueType> implements IAsyncStorage
|
|
|
18
18
|
exists(key: string): Promise<boolean>;
|
|
19
19
|
clear(): Promise<this>;
|
|
20
20
|
close(): Promise<void>;
|
|
21
|
-
static makeStorage(persistentOrStrategy?: boolean | WebStorageStrategy | 'memoryStorage' | 'indexedDB', suffix?: string): IAsyncStorage;
|
|
21
|
+
static makeStorage(persistentOrStrategy?: boolean | WebStorageStrategy | 'memoryStorage' | 'indexedDB', suffix?: string, options?: IAsyncStorageOptions): IAsyncStorage;
|
|
22
22
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @module plugins/clean-html
|
|
8
8
|
*/
|
|
9
9
|
export * from "./get-hash";
|
|
10
|
+
export * from "./is-allowed-media-embed";
|
|
10
11
|
export * from "./remove-format/remove-format-for-collapsed-selection";
|
|
11
12
|
export * from "./remove-format/remove-format-for-selection";
|
|
12
13
|
export * from "./visitor/visit-node-walker";
|
|
@@ -0,0 +1,15 @@
|
|
|
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-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Whether an `<iframe>` `src` points at a recognized YouTube/Vimeo video
|
|
8
|
+
* player. Such iframes are inserted intentionally through the Video button, so
|
|
9
|
+
* clean-html must not strip them (`denyTags` includes `iframe` by default) or
|
|
10
|
+
* neutralize them with an empty `sandbox=""` (#1381). Arbitrary/bare iframes
|
|
11
|
+
* are still removed.
|
|
12
|
+
*
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
export declare function isAllowedMediaEmbed(src: string): boolean;
|
package/types/types/storage.d.ts
CHANGED
|
@@ -22,3 +22,18 @@ export interface IAsyncStorage<T = StorageValueType> {
|
|
|
22
22
|
clear(): Promise<this>;
|
|
23
23
|
close(): Promise<void>;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Which provider should back an {@link IAsyncStorage} created by
|
|
27
|
+
* `AsyncStorage.makeStorage`:
|
|
28
|
+
* - `'local'` — use `localStorage` (falls back to memory if it is blocked);
|
|
29
|
+
* - `'memory'` — use an in-memory store (nothing survives a page reload);
|
|
30
|
+
* - a custom {@link IAsyncStorage} implementation — use it as-is.
|
|
31
|
+
*/
|
|
32
|
+
export type AsyncStorageDefaultProvider = 'local' | 'memory' | IAsyncStorage;
|
|
33
|
+
export interface IAsyncStorageOptions {
|
|
34
|
+
/**
|
|
35
|
+
* Overrides the provider that backs the storage. When omitted the storage
|
|
36
|
+
* behaves as before — persistent `IndexedDB` with an in-memory fallback.
|
|
37
|
+
*/
|
|
38
|
+
defaultProvider?: AsyncStorageDefaultProvider;
|
|
39
|
+
}
|
package/types/types/view.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import type { Buttons, ButtonsGroup, ButtonsOption, Controls, IControlType, IProgressBar, IToolbarCollection } from "./toolbar";
|
|
10
10
|
import type { CanUndef, IComponent, IContainer, IDictionary, Nullable } from "./types";
|
|
11
11
|
import type { Attributes, ICreate } from "./create";
|
|
12
|
-
import type { IAsyncStorage, IStorage } from "./storage";
|
|
12
|
+
import type { IAsyncStorage, IAsyncStorageOptions, IStorage } from "./storage";
|
|
13
13
|
import type { IUIButtonState } from "./ui";
|
|
14
14
|
import type { IEventEmitter } from "./events";
|
|
15
15
|
import type { IPluginButton } from "./plugin";
|
|
@@ -40,6 +40,13 @@ interface IViewOptions extends ILanguageOptions, IToolbarOptions {
|
|
|
40
40
|
* Use cache for heavy methods
|
|
41
41
|
*/
|
|
42
42
|
cache?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Configure the provider that backs {@link IViewBased.asyncStorage}.
|
|
45
|
+
* By default it uses persistent `IndexedDB` (with an in-memory fallback);
|
|
46
|
+
* set `defaultProvider` to `'local'`, `'memory'` or a custom
|
|
47
|
+
* {@link IAsyncStorage} implementation to override it.
|
|
48
|
+
*/
|
|
49
|
+
asyncStorage?: IAsyncStorageOptions;
|
|
43
50
|
getIcon?: (name: string, clearName: string) => CanUndef<string>;
|
|
44
51
|
headerButtons?: string | Array<IControlType | string | ButtonsGroup>;
|
|
45
52
|
readonly basePath?: string;
|