@ckeditor/ckeditor5-autosave 41.3.0-alpha.4 → 41.3.1
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +2 -3
- package/dist/content-index.css +0 -4
- package/dist/editor-index.css +0 -4
- package/dist/index.css +0 -4
- package/dist/translations/af.d.ts +0 -8
- package/dist/translations/af.js +0 -5
- package/dist/translations/ar.d.ts +0 -8
- package/dist/translations/ar.js +0 -5
- package/dist/translations/az.d.ts +0 -8
- package/dist/translations/az.js +0 -5
- package/dist/translations/bg.d.ts +0 -8
- package/dist/translations/bg.js +0 -5
- package/dist/translations/bn.d.ts +0 -8
- package/dist/translations/bn.js +0 -5
- package/dist/translations/bs.d.ts +0 -8
- package/dist/translations/bs.js +0 -5
- package/dist/translations/ca.d.ts +0 -8
- package/dist/translations/ca.js +0 -5
- package/dist/translations/cs.d.ts +0 -8
- package/dist/translations/cs.js +0 -5
- package/dist/translations/da.d.ts +0 -8
- package/dist/translations/da.js +0 -5
- package/dist/translations/de-ch.d.ts +0 -8
- package/dist/translations/de-ch.js +0 -5
- package/dist/translations/de.d.ts +0 -8
- package/dist/translations/de.js +0 -5
- package/dist/translations/el.d.ts +0 -8
- package/dist/translations/el.js +0 -5
- package/dist/translations/en-au.d.ts +0 -8
- package/dist/translations/en-au.js +0 -5
- package/dist/translations/en-gb.d.ts +0 -8
- package/dist/translations/en-gb.js +0 -5
- package/dist/translations/en.d.ts +0 -8
- package/dist/translations/en.js +0 -5
- package/dist/translations/es-co.d.ts +0 -8
- package/dist/translations/es-co.js +0 -5
- package/dist/translations/es.d.ts +0 -8
- package/dist/translations/es.js +0 -5
- package/dist/translations/et.d.ts +0 -8
- package/dist/translations/et.js +0 -5
- package/dist/translations/fa.d.ts +0 -8
- package/dist/translations/fa.js +0 -5
- package/dist/translations/fi.d.ts +0 -8
- package/dist/translations/fi.js +0 -5
- package/dist/translations/fr.d.ts +0 -8
- package/dist/translations/fr.js +0 -5
- package/dist/translations/gl.d.ts +0 -8
- package/dist/translations/gl.js +0 -5
- package/dist/translations/he.d.ts +0 -8
- package/dist/translations/he.js +0 -5
- package/dist/translations/hi.d.ts +0 -8
- package/dist/translations/hi.js +0 -5
- package/dist/translations/hr.d.ts +0 -8
- package/dist/translations/hr.js +0 -5
- package/dist/translations/hu.d.ts +0 -8
- package/dist/translations/hu.js +0 -5
- package/dist/translations/hy.d.ts +0 -8
- package/dist/translations/hy.js +0 -5
- package/dist/translations/id.d.ts +0 -8
- package/dist/translations/id.js +0 -5
- package/dist/translations/it.d.ts +0 -8
- package/dist/translations/it.js +0 -5
- package/dist/translations/ja.d.ts +0 -8
- package/dist/translations/ja.js +0 -5
- package/dist/translations/jv.d.ts +0 -8
- package/dist/translations/jv.js +0 -5
- package/dist/translations/km.d.ts +0 -8
- package/dist/translations/km.js +0 -5
- package/dist/translations/ko.d.ts +0 -8
- package/dist/translations/ko.js +0 -5
- package/dist/translations/ku.d.ts +0 -8
- package/dist/translations/ku.js +0 -5
- package/dist/translations/lt.d.ts +0 -8
- package/dist/translations/lt.js +0 -5
- package/dist/translations/lv.d.ts +0 -8
- package/dist/translations/lv.js +0 -5
- package/dist/translations/ms.d.ts +0 -8
- package/dist/translations/ms.js +0 -5
- package/dist/translations/ne.d.ts +0 -8
- package/dist/translations/ne.js +0 -5
- package/dist/translations/nl.d.ts +0 -8
- package/dist/translations/nl.js +0 -5
- package/dist/translations/no.d.ts +0 -8
- package/dist/translations/no.js +0 -5
- package/dist/translations/pl.d.ts +0 -8
- package/dist/translations/pl.js +0 -5
- package/dist/translations/pt-br.d.ts +0 -8
- package/dist/translations/pt-br.js +0 -5
- package/dist/translations/pt.d.ts +0 -8
- package/dist/translations/pt.js +0 -5
- package/dist/translations/ro.d.ts +0 -8
- package/dist/translations/ro.js +0 -5
- package/dist/translations/ru.d.ts +0 -8
- package/dist/translations/ru.js +0 -5
- package/dist/translations/sk.d.ts +0 -8
- package/dist/translations/sk.js +0 -5
- package/dist/translations/sl.d.ts +0 -8
- package/dist/translations/sl.js +0 -5
- package/dist/translations/sq.d.ts +0 -8
- package/dist/translations/sq.js +0 -5
- package/dist/translations/sr-latn.d.ts +0 -8
- package/dist/translations/sr-latn.js +0 -5
- package/dist/translations/sr.d.ts +0 -8
- package/dist/translations/sr.js +0 -5
- package/dist/translations/sv.d.ts +0 -8
- package/dist/translations/sv.js +0 -5
- package/dist/translations/th.d.ts +0 -8
- package/dist/translations/th.js +0 -5
- package/dist/translations/tk.d.ts +0 -8
- package/dist/translations/tk.js +0 -5
- package/dist/translations/tr.d.ts +0 -8
- package/dist/translations/tr.js +0 -5
- package/dist/translations/tt.d.ts +0 -8
- package/dist/translations/tt.js +0 -5
- package/dist/translations/ug.d.ts +0 -8
- package/dist/translations/ug.js +0 -5
- package/dist/translations/uk.d.ts +0 -8
- package/dist/translations/uk.js +0 -5
- package/dist/translations/ur.d.ts +0 -8
- package/dist/translations/ur.js +0 -5
- package/dist/translations/uz.d.ts +0 -8
- package/dist/translations/uz.js +0 -5
- package/dist/translations/vi.d.ts +0 -8
- package/dist/translations/vi.js +0 -5
- package/dist/translations/zh-cn.d.ts +0 -8
- package/dist/translations/zh-cn.js +0 -5
- package/dist/translations/zh.d.ts +0 -8
- package/dist/translations/zh.js +0 -5
- package/dist/types/augmentation.d.ts +0 -22
- package/dist/types/autosave.d.ts +0 -223
- package/dist/types/index.d.ts +0 -13
package/dist/types/autosave.d.ts
DELETED
@@ -1,223 +0,0 @@
|
|
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
|
-
}
|
package/dist/types/index.d.ts
DELETED
@@ -1,13 +0,0 @@
|
|
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';
|