@ckeditor/ckeditor5-autosave 41.3.1 → 41.4.0-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index-content.css +4 -0
- package/dist/index-editor.css +4 -0
- package/dist/index.css +4 -0
- package/dist/index.js +186 -0
- package/dist/index.js.map +1 -0
- package/dist/translations/af.d.ts +8 -0
- package/dist/translations/af.js +5 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +5 -0
- package/dist/translations/az.d.ts +8 -0
- package/dist/translations/az.js +5 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +5 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +5 -0
- package/dist/translations/bs.d.ts +8 -0
- package/dist/translations/bs.js +5 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +5 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +5 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +5 -0
- package/dist/translations/de-ch.d.ts +8 -0
- package/dist/translations/de-ch.js +5 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +5 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +5 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +5 -0
- package/dist/translations/en-gb.d.ts +8 -0
- package/dist/translations/en-gb.js +5 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +5 -0
- package/dist/translations/es-co.d.ts +8 -0
- package/dist/translations/es-co.js +5 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +5 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +5 -0
- package/dist/translations/fa.d.ts +8 -0
- package/dist/translations/fa.js +5 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +5 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +5 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +5 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +5 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +5 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +5 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +5 -0
- package/dist/translations/hy.d.ts +8 -0
- package/dist/translations/hy.js +5 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +5 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +5 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +5 -0
- package/dist/translations/jv.d.ts +8 -0
- package/dist/translations/jv.js +5 -0
- package/dist/translations/km.d.ts +8 -0
- package/dist/translations/km.js +5 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +5 -0
- package/dist/translations/ku.d.ts +8 -0
- package/dist/translations/ku.js +5 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +5 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +5 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +5 -0
- package/dist/translations/ne.d.ts +8 -0
- package/dist/translations/ne.js +5 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +5 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +5 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +5 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +5 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +5 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +5 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +5 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +5 -0
- package/dist/translations/sl.d.ts +8 -0
- package/dist/translations/sl.js +5 -0
- package/dist/translations/sq.d.ts +8 -0
- package/dist/translations/sq.js +5 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +5 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +5 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +5 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +5 -0
- package/dist/translations/tk.d.ts +8 -0
- package/dist/translations/tk.js +5 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +5 -0
- package/dist/translations/tt.d.ts +8 -0
- package/dist/translations/tt.js +5 -0
- package/dist/translations/ug.d.ts +8 -0
- package/dist/translations/ug.js +5 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +5 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +5 -0
- package/dist/translations/uz.d.ts +8 -0
- package/dist/translations/uz.js +5 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +5 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +5 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +5 -0
- package/dist/types/augmentation.d.ts +22 -0
- package/dist/types/autosave.d.ts +223 -0
- package/dist/types/index.d.ts +13 -0
- package/package.json +3 -2
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
|
6
|
+
import type { Translations } from 'ckeditor5';
|
7
|
+
declare const translations: Translations;
|
8
|
+
export default translations;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
export default {"tt":{"dictionary":{"Saving changes":"Үзгәрешләрне саклау"},getPluralForm(n){return 0;}}}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
|
6
|
+
import type { Translations } from 'ckeditor5';
|
7
|
+
declare const translations: Translations;
|
8
|
+
export default translations;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
export default {"ug":{"dictionary":{"Saving changes":"ئۆزگەرتىشلەرنى ساقلاش"},getPluralForm(n){return (n != 1);}}}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
|
6
|
+
import type { Translations } from 'ckeditor5';
|
7
|
+
declare const translations: Translations;
|
8
|
+
export default translations;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
export default {"uk":{"dictionary":{"Saving changes":"Збереження змін"},getPluralForm(n){return (n % 1 == 0 && n % 10 == 1 && n % 100 != 11 ? 0 : n % 1 == 0 && n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14) ? 1 : n % 1 == 0 && (n % 10 ==0 || (n % 10 >=5 && n % 10 <=9) || (n % 100 >=11 && n % 100 <=14 )) ? 2: 3);}}}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
|
6
|
+
import type { Translations } from 'ckeditor5';
|
7
|
+
declare const translations: Translations;
|
8
|
+
export default translations;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
export default {"ur":{"dictionary":{"Saving changes":"خودکار محفوظ"},getPluralForm(n){return (n != 1);}}}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
|
6
|
+
import type { Translations } from 'ckeditor5';
|
7
|
+
declare const translations: Translations;
|
8
|
+
export default translations;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
export default {"uz":{"dictionary":{"Saving changes":"O'zgarishlarni saqlash"},getPluralForm(n){return 0;}}}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
|
6
|
+
import type { Translations } from 'ckeditor5';
|
7
|
+
declare const translations: Translations;
|
8
|
+
export default translations;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
export default {"vi":{"dictionary":{"Saving changes":"Đang lưu"},getPluralForm(n){return 0;}}}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
|
6
|
+
import type { Translations } from 'ckeditor5';
|
7
|
+
declare const translations: Translations;
|
8
|
+
export default translations;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
export default {"zh-cn":{"dictionary":{"Saving changes":"正在保存更改"},getPluralForm(n){return 0;}}}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
|
6
|
+
import type { Translations } from 'ckeditor5';
|
7
|
+
declare const translations: Translations;
|
8
|
+
export default translations;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
export default {"zh":{"dictionary":{"Saving changes":"正在儲存變更"},getPluralForm(n){return 0;}}}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
import type { Autosave, AutosaveConfig } from './index.js';
|
10
|
+
declare module '@ckeditor/ckeditor5-core' {
|
11
|
+
interface PluginsMap {
|
12
|
+
[Autosave.pluginName]: Autosave;
|
13
|
+
}
|
14
|
+
interface EditorConfig {
|
15
|
+
/**
|
16
|
+
* The configuration of the {@link module:autosave/autosave~Autosave autosave feature}.
|
17
|
+
*
|
18
|
+
* Read more in {@link module:autosave/autosave~AutosaveConfig}.
|
19
|
+
*/
|
20
|
+
autosave?: AutosaveConfig;
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,223 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module autosave/autosave
|
11
|
+
*/
|
12
|
+
import { Plugin, PendingActions, type Editor } from 'ckeditor5/src/core.js';
|
13
|
+
/**
|
14
|
+
* The {@link module:autosave/autosave~Autosave} plugin allows you to automatically save the data (e.g. send it to the server)
|
15
|
+
* when needed (when the user changed the content).
|
16
|
+
*
|
17
|
+
* It listens to the {@link module:engine/model/document~Document#event:change:data `editor.model.document#change:data`}
|
18
|
+
* and `window#beforeunload` events and calls the
|
19
|
+
* {@link module:autosave/autosave~AutosaveAdapter#save `config.autosave.save()`} function.
|
20
|
+
*
|
21
|
+
* ```ts
|
22
|
+
* ClassicEditor
|
23
|
+
* .create( document.querySelector( '#editor' ), {
|
24
|
+
* plugins: [ ArticlePluginSet, Autosave ],
|
25
|
+
* toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ],
|
26
|
+
* image: {
|
27
|
+
* toolbar: [ 'imageStyle:block', 'imageStyle:side', '|', 'toggleImageCaption', 'imageTextAlternative' ],
|
28
|
+
* },
|
29
|
+
* autosave: {
|
30
|
+
* save( editor: Editor ) {
|
31
|
+
* // The saveData() function must return a promise
|
32
|
+
* // which should be resolved when the data is successfully saved.
|
33
|
+
* return saveData( editor.getData() );
|
34
|
+
* }
|
35
|
+
* }
|
36
|
+
* } );
|
37
|
+
* ```
|
38
|
+
*
|
39
|
+
* Read more about this feature in the {@glink features/autosave Autosave} feature guide.
|
40
|
+
*/
|
41
|
+
export default class Autosave extends Plugin {
|
42
|
+
/**
|
43
|
+
* The adapter is an object with a `save()` method. That method will be called whenever
|
44
|
+
* the data changes. It might be called some time after the change,
|
45
|
+
* since the event is throttled for performance reasons.
|
46
|
+
*/
|
47
|
+
adapter?: AutosaveAdapter;
|
48
|
+
/**
|
49
|
+
* The state of this plugin.
|
50
|
+
*
|
51
|
+
* The plugin can be in the following states:
|
52
|
+
*
|
53
|
+
* * synchronized – When all changes are saved.
|
54
|
+
* * waiting – When the plugin is waiting for other changes before calling `adapter#save()` and `config.autosave.save()`.
|
55
|
+
* * saving – When the provided save method is called and the plugin waits for the response.
|
56
|
+
* * error &ndash When the provided save method will throw an error. This state immediately changes to the `saving` state and
|
57
|
+
* the save method will be called again in the short period of time.
|
58
|
+
*
|
59
|
+
* @observable
|
60
|
+
* @readonly
|
61
|
+
*/
|
62
|
+
state: 'synchronized' | 'waiting' | 'saving' | 'error';
|
63
|
+
/**
|
64
|
+
* Debounced save method. The `save()` method is called the specified `waitingTime` after `debouncedSave()` is called,
|
65
|
+
* unless a new action happens in the meantime.
|
66
|
+
*/
|
67
|
+
private _debouncedSave;
|
68
|
+
/**
|
69
|
+
* The last saved document version.
|
70
|
+
*/
|
71
|
+
private _lastDocumentVersion;
|
72
|
+
/**
|
73
|
+
* Promise used for asynchronous save calls.
|
74
|
+
*
|
75
|
+
* Created to handle the autosave call to an external data source. It resolves when that call is finished. It is re-used if
|
76
|
+
* save is called before the promise has been resolved. It is set to `null` if there is no call in progress.
|
77
|
+
*/
|
78
|
+
private _savePromise;
|
79
|
+
/**
|
80
|
+
* DOM emitter.
|
81
|
+
*/
|
82
|
+
private _domEmitter;
|
83
|
+
/**
|
84
|
+
* The configuration of this plugins.
|
85
|
+
*/
|
86
|
+
private _config;
|
87
|
+
/**
|
88
|
+
* Editor's pending actions manager.
|
89
|
+
*/
|
90
|
+
private _pendingActions;
|
91
|
+
/**
|
92
|
+
* Informs whether there should be another autosave callback performed, immediately after current autosave callback finishes.
|
93
|
+
*
|
94
|
+
* This is set to `true` when there is a save request while autosave callback is already being processed
|
95
|
+
* and the model has changed since the last save.
|
96
|
+
*/
|
97
|
+
private _makeImmediateSave;
|
98
|
+
/**
|
99
|
+
* An action that will be added to the pending action manager for actions happening in that plugin.
|
100
|
+
*/
|
101
|
+
private _action;
|
102
|
+
/**
|
103
|
+
* @inheritDoc
|
104
|
+
*/
|
105
|
+
static get pluginName(): "Autosave";
|
106
|
+
/**
|
107
|
+
* @inheritDoc
|
108
|
+
*/
|
109
|
+
static get requires(): readonly [typeof PendingActions];
|
110
|
+
/**
|
111
|
+
* @inheritDoc
|
112
|
+
*/
|
113
|
+
constructor(editor: Editor);
|
114
|
+
/**
|
115
|
+
* @inheritDoc
|
116
|
+
*/
|
117
|
+
init(): void;
|
118
|
+
/**
|
119
|
+
* @inheritDoc
|
120
|
+
*/
|
121
|
+
destroy(): void;
|
122
|
+
/**
|
123
|
+
* Immediately calls autosave callback. All previously queued (debounced) callbacks are cleared. If there is already an autosave
|
124
|
+
* callback in progress, then the requested save will be performed immediately after the current callback finishes.
|
125
|
+
*
|
126
|
+
* @returns A promise that will be resolved when the autosave callback is finished.
|
127
|
+
*/
|
128
|
+
save(): Promise<void>;
|
129
|
+
/**
|
130
|
+
* Invokes the remaining `_save()` method call.
|
131
|
+
*/
|
132
|
+
private _flush;
|
133
|
+
/**
|
134
|
+
* If the adapter is set and a new document version exists,
|
135
|
+
* the `_save()` method creates a pending action and calls the `adapter.save()` method.
|
136
|
+
* It waits for the result and then removes the created pending action.
|
137
|
+
*
|
138
|
+
* @returns A promise that will be resolved when the autosave callback is finished.
|
139
|
+
*/
|
140
|
+
private _save;
|
141
|
+
/**
|
142
|
+
* Creates a pending action if it is not set already.
|
143
|
+
*/
|
144
|
+
private _setPendingAction;
|
145
|
+
/**
|
146
|
+
* Saves callbacks.
|
147
|
+
*/
|
148
|
+
private get _saveCallbacks();
|
149
|
+
}
|
150
|
+
/**
|
151
|
+
* An interface that requires the `save()` method.
|
152
|
+
*
|
153
|
+
* Used by {@link module:autosave/autosave~Autosave#adapter}.
|
154
|
+
*/
|
155
|
+
export interface AutosaveAdapter {
|
156
|
+
/**
|
157
|
+
* The method that will be called when the data changes. It should return a promise (e.g. in case of saving content to the database),
|
158
|
+
* so the autosave plugin will wait for that action before removing it from pending actions.
|
159
|
+
*/
|
160
|
+
save(editor: Editor): Promise<unknown>;
|
161
|
+
}
|
162
|
+
/**
|
163
|
+
* The configuration of the {@link module:autosave/autosave~Autosave autosave feature}.
|
164
|
+
*
|
165
|
+
* ```ts
|
166
|
+
* ClassicEditor
|
167
|
+
* .create( editorElement, {
|
168
|
+
* autosave: {
|
169
|
+
* save( editor: Editor ) {
|
170
|
+
* // The saveData() function must return a promise
|
171
|
+
* // which should be resolved when the data is successfully saved.
|
172
|
+
* return saveData( editor.getData() );
|
173
|
+
* }
|
174
|
+
* }
|
175
|
+
* } );
|
176
|
+
* .then( ... )
|
177
|
+
* .catch( ... );
|
178
|
+
* ```
|
179
|
+
*
|
180
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
|
181
|
+
*
|
182
|
+
* See also the demo of the {@glink features/autosave autosave feature}.
|
183
|
+
*/
|
184
|
+
export interface AutosaveConfig {
|
185
|
+
/**
|
186
|
+
* The callback to be executed when the data needs to be saved.
|
187
|
+
*
|
188
|
+
* This function must return a promise which should be resolved when the data is successfully saved.
|
189
|
+
*
|
190
|
+
* ```ts
|
191
|
+
* ClassicEditor
|
192
|
+
* .create( editorElement, {
|
193
|
+
* autosave: {
|
194
|
+
* save( editor: Editor ) {
|
195
|
+
* return saveData( editor.getData() );
|
196
|
+
* }
|
197
|
+
* }
|
198
|
+
* } );
|
199
|
+
* .then( ... )
|
200
|
+
* .catch( ... );
|
201
|
+
* ```
|
202
|
+
*/
|
203
|
+
save?: (editor: Editor) => Promise<unknown>;
|
204
|
+
/**
|
205
|
+
* The minimum amount of time that needs to pass after the last action to call the provided callback.
|
206
|
+
* By default it is 1000 ms.
|
207
|
+
*
|
208
|
+
* ```ts
|
209
|
+
* ClassicEditor
|
210
|
+
* .create( editorElement, {
|
211
|
+
* autosave: {
|
212
|
+
* save( editor: Editor ) {
|
213
|
+
* return saveData( editor.getData() );
|
214
|
+
* },
|
215
|
+
* waitingTime: 2000
|
216
|
+
* }
|
217
|
+
* } );
|
218
|
+
* .then( ... )
|
219
|
+
* .catch( ... );
|
220
|
+
* ```
|
221
|
+
*/
|
222
|
+
waitingTime?: number;
|
223
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module autosave
|
11
|
+
*/
|
12
|
+
export { default as Autosave, type AutosaveConfig } from './autosave.js';
|
13
|
+
import './augmentation.js';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-autosave",
|
3
|
-
"version": "41.
|
3
|
+
"version": "41.4.0-alpha.0",
|
4
4
|
"description": "Autosave feature for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -13,7 +13,7 @@
|
|
13
13
|
"type": "module",
|
14
14
|
"main": "src/index.js",
|
15
15
|
"dependencies": {
|
16
|
-
"ckeditor5": "41.
|
16
|
+
"ckeditor5": "41.4.0-alpha.0",
|
17
17
|
"lodash-es": "4.17.21"
|
18
18
|
},
|
19
19
|
"author": "CKSource (http://cksource.com/)",
|
@@ -26,6 +26,7 @@
|
|
26
26
|
"directory": "packages/ckeditor5-autosave"
|
27
27
|
},
|
28
28
|
"files": [
|
29
|
+
"dist",
|
29
30
|
"lang",
|
30
31
|
"src/**/*.js",
|
31
32
|
"src/**/*.d.ts",
|