jodit 4.12.43 → 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.
Files changed (63) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/es2015/jodit.css +1 -1
  3. package/es2015/jodit.fat.min.js +3 -3
  4. package/es2015/jodit.js +44 -5
  5. package/es2015/jodit.min.js +3 -3
  6. package/es2015/plugins/debug/debug.css +1 -1
  7. package/es2015/plugins/debug/debug.js +1 -1
  8. package/es2015/plugins/debug/debug.min.js +1 -1
  9. package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
  10. package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
  11. package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
  12. package/es2018/jodit.fat.min.js +3 -3
  13. package/es2018/jodit.min.js +3 -3
  14. package/es2018/plugins/debug/debug.min.js +1 -1
  15. package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
  16. package/es2021/jodit.css +1 -1
  17. package/es2021/jodit.fat.min.js +5 -5
  18. package/es2021/jodit.js +44 -5
  19. package/es2021/jodit.min.js +5 -5
  20. package/es2021/plugins/debug/debug.css +1 -1
  21. package/es2021/plugins/debug/debug.js +1 -1
  22. package/es2021/plugins/debug/debug.min.js +1 -1
  23. package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
  24. package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
  25. package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
  26. package/es2021.en/jodit.css +1 -1
  27. package/es2021.en/jodit.fat.min.js +5 -5
  28. package/es2021.en/jodit.js +44 -5
  29. package/es2021.en/jodit.min.js +5 -5
  30. package/es2021.en/plugins/debug/debug.css +1 -1
  31. package/es2021.en/plugins/debug/debug.js +1 -1
  32. package/es2021.en/plugins/debug/debug.min.js +1 -1
  33. package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
  34. package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
  35. package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
  36. package/es5/jodit.css +2 -2
  37. package/es5/jodit.fat.min.js +2 -2
  38. package/es5/jodit.js +44 -5
  39. package/es5/jodit.min.css +2 -2
  40. package/es5/jodit.min.js +2 -2
  41. package/es5/plugins/debug/debug.css +1 -1
  42. package/es5/plugins/debug/debug.js +1 -1
  43. package/es5/plugins/debug/debug.min.js +1 -1
  44. package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
  45. package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
  46. package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
  47. package/es5/polyfills.fat.min.js +1 -1
  48. package/es5/polyfills.js +1 -1
  49. package/es5/polyfills.min.js +1 -1
  50. package/esm/config.d.ts +22 -0
  51. package/esm/config.js +21 -0
  52. package/esm/core/constants.js +1 -1
  53. package/esm/core/storage/async-storage.d.ts +2 -2
  54. package/esm/core/storage/async-storage.js +19 -1
  55. package/esm/core/storage/engines/local-storage-provider.js +6 -1
  56. package/esm/core/view/view.js +1 -1
  57. package/esm/types/storage.d.ts +15 -0
  58. package/esm/types/view.d.ts +8 -1
  59. package/package.json +1 -1
  60. package/types/config.d.ts +22 -0
  61. package/types/core/storage/async-storage.d.ts +2 -2
  62. package/types/types/storage.d.ts +15 -0
  63. package/types/types/view.d.ts +8 -1
@@ -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.12.43
4
+ * Version: v4.12.44
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.12.43
4
+ * Version: v4.12.44
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.12.43
4
+ * Version: v4.12.44
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.12.43
4
+ * Version: v4.12.44
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.12.43
4
+ * Version: v4.12.44
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.12.43
4
+ * Version: v4.12.44
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.12.43
4
+ * Version: v4.12.44
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
package/es5/polyfills.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.12.43
4
+ * Version: v4.12.44
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
@@ -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.12.43
4
+ * Version: v4.12.44
5
5
  * Url: https://xdsoft.net/jodit/
6
6
  * License(s): MIT
7
7
  */
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
  *
@@ -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.43";
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.removeItem(this.rootKey);
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;
@@ -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`
@@ -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
+ }
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "4.12.43",
3
+ "version": "4.12.44",
4
4
  "description": "Jodit is an awesome and useful wysiwyg editor with filebrowser",
5
5
  "main": "esm/index.js",
6
6
  "types": "types/index.d.ts",
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
  }
@@ -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
+ }
@@ -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;