@ckeditor/ckeditor5-autosave 41.2.0 → 41.3.0-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
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
+ */
@@ -0,0 +1,4 @@
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
+ */
package/dist/index.css ADDED
@@ -0,0 +1,4 @@
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
+ */
package/dist/index.js ADDED
@@ -0,0 +1,236 @@
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
+ import { Plugin, PendingActions } from '@ckeditor/ckeditor5-core/dist/index.js';
6
+ import { DomEmitterMixin } from '@ckeditor/ckeditor5-utils/dist/index.js';
7
+ import { debounce } from 'lodash-es';
8
+
9
+ /**
10
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
11
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
12
+ */
13
+ /**
14
+ * @module autosave/autosave
15
+ */
16
+ /* globals window */
17
+ /**
18
+ * The {@link module:autosave/autosave~Autosave} plugin allows you to automatically save the data (e.g. send it to the server)
19
+ * when needed (when the user changed the content).
20
+ *
21
+ * It listens to the {@link module:engine/model/document~Document#event:change:data `editor.model.document#change:data`}
22
+ * and `window#beforeunload` events and calls the
23
+ * {@link module:autosave/autosave~AutosaveAdapter#save `config.autosave.save()`} function.
24
+ *
25
+ * ```ts
26
+ * ClassicEditor
27
+ * .create( document.querySelector( '#editor' ), {
28
+ * plugins: [ ArticlePluginSet, Autosave ],
29
+ * toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ],
30
+ * image: {
31
+ * toolbar: [ 'imageStyle:block', 'imageStyle:side', '|', 'toggleImageCaption', 'imageTextAlternative' ],
32
+ * },
33
+ * autosave: {
34
+ * save( editor: Editor ) {
35
+ * // The saveData() function must return a promise
36
+ * // which should be resolved when the data is successfully saved.
37
+ * return saveData( editor.getData() );
38
+ * }
39
+ * }
40
+ * } );
41
+ * ```
42
+ *
43
+ * Read more about this feature in the {@glink features/autosave Autosave} feature guide.
44
+ */
45
+ class Autosave extends Plugin {
46
+ /**
47
+ * @inheritDoc
48
+ */
49
+ static get pluginName() {
50
+ return 'Autosave';
51
+ }
52
+ /**
53
+ * @inheritDoc
54
+ */
55
+ static get requires() {
56
+ return [PendingActions];
57
+ }
58
+ /**
59
+ * @inheritDoc
60
+ */
61
+ constructor(editor) {
62
+ super(editor);
63
+ /**
64
+ * An action that will be added to the pending action manager for actions happening in that plugin.
65
+ */
66
+ this._action = null;
67
+ const config = editor.config.get('autosave') || {};
68
+ // A minimum amount of time that needs to pass after the last action.
69
+ // After that time the provided save callbacks are being called.
70
+ const waitingTime = config.waitingTime || 1000;
71
+ this.set('state', 'synchronized');
72
+ this._debouncedSave = debounce(this._save.bind(this), waitingTime);
73
+ this._lastDocumentVersion = editor.model.document.version;
74
+ this._savePromise = null;
75
+ this._domEmitter = new (DomEmitterMixin())();
76
+ this._config = config;
77
+ this._pendingActions = editor.plugins.get(PendingActions);
78
+ this._makeImmediateSave = false;
79
+ }
80
+ /**
81
+ * @inheritDoc
82
+ */
83
+ init() {
84
+ const editor = this.editor;
85
+ const doc = editor.model.document;
86
+ // Add the listener only after the editor is initialized to prevent firing save callback on data init.
87
+ this.listenTo(editor, 'ready', () => {
88
+ this.listenTo(doc, 'change:data', (evt, batch) => {
89
+ if (!this._saveCallbacks.length) {
90
+ return;
91
+ }
92
+ if (!batch.isLocal) {
93
+ return;
94
+ }
95
+ if (this.state === 'synchronized') {
96
+ this.state = 'waiting';
97
+ // Set pending action already when we are waiting for the autosave callback.
98
+ this._setPendingAction();
99
+ }
100
+ if (this.state === 'waiting') {
101
+ this._debouncedSave();
102
+ }
103
+ // If the plugin is in `saving` state, it will change its state later basing on the `document.version`.
104
+ // If the `document.version` will be higher than stored `#_lastDocumentVersion`, then it means, that some `change:data`
105
+ // event has fired in the meantime.
106
+ });
107
+ });
108
+ // Flush on the editor's destroy listener with the highest priority to ensure that
109
+ // `editor.getData()` will be called before plugins are destroyed.
110
+ this.listenTo(editor, 'destroy', () => this._flush(), { priority: 'highest' });
111
+ // It's not possible to easy test it because karma uses `beforeunload` event
112
+ // to warn before full page reload and this event cannot be dispatched manually.
113
+ /* istanbul ignore next -- @preserve */
114
+ this._domEmitter.listenTo(window, 'beforeunload', (evtInfo, domEvt) => {
115
+ if (this._pendingActions.hasAny) {
116
+ domEvt.returnValue = this._pendingActions.first.message;
117
+ }
118
+ });
119
+ }
120
+ /**
121
+ * @inheritDoc
122
+ */
123
+ destroy() {
124
+ // There's no need for canceling or flushing the throttled save, as
125
+ // it's done on the editor's destroy event with the highest priority.
126
+ this._domEmitter.stopListening();
127
+ super.destroy();
128
+ }
129
+ /**
130
+ * Immediately calls autosave callback. All previously queued (debounced) callbacks are cleared. If there is already an autosave
131
+ * callback in progress, then the requested save will be performed immediately after the current callback finishes.
132
+ *
133
+ * @returns A promise that will be resolved when the autosave callback is finished.
134
+ */
135
+ save() {
136
+ this._debouncedSave.cancel();
137
+ return this._save();
138
+ }
139
+ /**
140
+ * Invokes the remaining `_save()` method call.
141
+ */
142
+ _flush() {
143
+ this._debouncedSave.flush();
144
+ }
145
+ /**
146
+ * If the adapter is set and a new document version exists,
147
+ * the `_save()` method creates a pending action and calls the `adapter.save()` method.
148
+ * It waits for the result and then removes the created pending action.
149
+ *
150
+ * @returns A promise that will be resolved when the autosave callback is finished.
151
+ */
152
+ _save() {
153
+ if (this._savePromise) {
154
+ this._makeImmediateSave = this.editor.model.document.version > this._lastDocumentVersion;
155
+ return this._savePromise;
156
+ }
157
+ // Make sure there is a pending action (in case if `_save()` was called through manual `save()` call).
158
+ this._setPendingAction();
159
+ this.state = 'saving';
160
+ this._lastDocumentVersion = this.editor.model.document.version;
161
+ // Wait one promise cycle to be sure that save callbacks are not called inside a conversion or when the editor's state changes.
162
+ this._savePromise = Promise.resolve()
163
+ // Make autosave callback.
164
+ .then(() => Promise.all(this._saveCallbacks.map(cb => cb(this.editor))))
165
+ // When the autosave callback is finished, always clear `this._savePromise`, no matter if it was successful or not.
166
+ .finally(() => {
167
+ this._savePromise = null;
168
+ })
169
+ // If the save was successful, we have three scenarios:
170
+ //
171
+ // 1. If a save was requested when an autosave callback was already processed, we need to immediately call
172
+ // another autosave callback. In this case, `this._savePromise` will not be resolved until the next callback is done.
173
+ // 2. Otherwise, if changes happened to the model, make a delayed autosave callback (like the change just happened).
174
+ // 3. If no changes happened to the model, return to the `synchronized` state.
175
+ .then(() => {
176
+ if (this._makeImmediateSave) {
177
+ this._makeImmediateSave = false;
178
+ // Start another autosave callback. Return a promise that will be resolved after the new autosave callback.
179
+ // This way promises returned by `_save()` will not be resolved until all changes are saved.
180
+ //
181
+ // If `save()` was called when another (most often automatic) autosave callback was already processed,
182
+ // the promise returned by `save()` call will be resolved only after new changes have been saved.
183
+ //
184
+ // Note that it would not work correctly if `this._savePromise` is not cleared.
185
+ return this._save();
186
+ }
187
+ else {
188
+ if (this.editor.model.document.version > this._lastDocumentVersion) {
189
+ this.state = 'waiting';
190
+ this._debouncedSave();
191
+ }
192
+ else {
193
+ this.state = 'synchronized';
194
+ this._pendingActions.remove(this._action);
195
+ this._action = null;
196
+ }
197
+ }
198
+ })
199
+ // In case of an error, retry the autosave callback after a delay (and also throw the original error).
200
+ .catch(err => {
201
+ // Change state to `error` so that listeners handling autosave error can be called.
202
+ this.state = 'error';
203
+ // Then, immediately change to the `saving` state as described above.
204
+ // Being in the `saving` state ensures that the autosave callback won't be delayed further by the `change:data` listener.
205
+ this.state = 'saving';
206
+ this._debouncedSave();
207
+ throw err;
208
+ });
209
+ return this._savePromise;
210
+ }
211
+ /**
212
+ * Creates a pending action if it is not set already.
213
+ */
214
+ _setPendingAction() {
215
+ const t = this.editor.t;
216
+ if (!this._action) {
217
+ this._action = this._pendingActions.add(t('Saving changes'));
218
+ }
219
+ }
220
+ /**
221
+ * Saves callbacks.
222
+ */
223
+ get _saveCallbacks() {
224
+ const saveCallbacks = [];
225
+ if (this.adapter && this.adapter.save) {
226
+ saveCallbacks.push(this.adapter.save);
227
+ }
228
+ if (this._config.save) {
229
+ saveCallbacks.push(this._config.save);
230
+ }
231
+ return saveCallbacks;
232
+ }
233
+ }
234
+
235
+ export { Autosave };
236
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.js","../src/autosave.ts"],"names":[],"mappings":";;;;AAAA,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAChF,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC1E,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACrC;ACHA,CAAA,CAAA,CAAA;ADKA,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CA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AAA,CAAA,CAAA,CAAA,aAAa,CAAC,IAAI,CAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAE,CAAC;AACxC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAED,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAG,CAAA,CAAA;ADjH3B,CCkHG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,aAAa,CAAC,IAAI,CAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAE,CAAC;AACxC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAED,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAO,aAAa,CAAC;ADlHvB,CCmHE,CAAA,CAAA,CAAA,CAAA;AACD,CAAA;ADlHD;AACA,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG","file":"index.js.map","sourcesContent":["import { Plugin, PendingActions } from '@ckeditor/ckeditor5-core/dist/index.js';\nimport { DomEmitterMixin } from '@ckeditor/ckeditor5-utils/dist/index.js';\nimport { debounce } from 'lodash-es';\n\n/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n/**\n * @module autosave/autosave\n */\n/* globals window */\n/**\n * The {@link module:autosave/autosave~Autosave} plugin allows you to automatically save the data (e.g. send it to the server)\n * when needed (when the user changed the content).\n *\n * It listens to the {@link module:engine/model/document~Document#event:change:data `editor.model.document#change:data`}\n * and `window#beforeunload` events and calls the\n * {@link module:autosave/autosave~AutosaveAdapter#save `config.autosave.save()`} function.\n *\n * ```ts\n * ClassicEditor\n * \t.create( document.querySelector( '#editor' ), {\n * \t\tplugins: [ ArticlePluginSet, Autosave ],\n * \t\ttoolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ],\n * \t\timage: {\n * \t\t\ttoolbar: [ 'imageStyle:block', 'imageStyle:side', '|', 'toggleImageCaption', 'imageTextAlternative' ],\n * \t\t},\n * \t\tautosave: {\n * \t\t\tsave( editor: Editor ) {\n * \t\t\t\t// The saveData() function must return a promise\n * \t\t\t\t// which should be resolved when the data is successfully saved.\n * \t\t\t\treturn saveData( editor.getData() );\n * \t\t\t}\n * \t\t}\n * \t} );\n * ```\n *\n * Read more about this feature in the {@glink features/autosave Autosave} feature guide.\n */\nclass Autosave extends Plugin {\n /**\n * @inheritDoc\n */\n static get pluginName() {\n return 'Autosave';\n }\n /**\n * @inheritDoc\n */\n static get requires() {\n return [PendingActions];\n }\n /**\n * @inheritDoc\n */\n constructor(editor) {\n super(editor);\n /**\n * An action that will be added to the pending action manager for actions happening in that plugin.\n */\n this._action = null;\n const config = editor.config.get('autosave') || {};\n // A minimum amount of time that needs to pass after the last action.\n // After that time the provided save callbacks are being called.\n const waitingTime = config.waitingTime || 1000;\n this.set('state', 'synchronized');\n this._debouncedSave = debounce(this._save.bind(this), waitingTime);\n this._lastDocumentVersion = editor.model.document.version;\n this._savePromise = null;\n this._domEmitter = new (DomEmitterMixin())();\n this._config = config;\n this._pendingActions = editor.plugins.get(PendingActions);\n this._makeImmediateSave = false;\n }\n /**\n * @inheritDoc\n */\n init() {\n const editor = this.editor;\n const doc = editor.model.document;\n // Add the listener only after the editor is initialized to prevent firing save callback on data init.\n this.listenTo(editor, 'ready', () => {\n this.listenTo(doc, 'change:data', (evt, batch) => {\n if (!this._saveCallbacks.length) {\n return;\n }\n if (!batch.isLocal) {\n return;\n }\n if (this.state === 'synchronized') {\n this.state = 'waiting';\n // Set pending action already when we are waiting for the autosave callback.\n this._setPendingAction();\n }\n if (this.state === 'waiting') {\n this._debouncedSave();\n }\n // If the plugin is in `saving` state, it will change its state later basing on the `document.version`.\n // If the `document.version` will be higher than stored `#_lastDocumentVersion`, then it means, that some `change:data`\n // event has fired in the meantime.\n });\n });\n // Flush on the editor's destroy listener with the highest priority to ensure that\n // `editor.getData()` will be called before plugins are destroyed.\n this.listenTo(editor, 'destroy', () => this._flush(), { priority: 'highest' });\n // It's not possible to easy test it because karma uses `beforeunload` event\n // to warn before full page reload and this event cannot be dispatched manually.\n /* istanbul ignore next -- @preserve */\n this._domEmitter.listenTo(window, 'beforeunload', (evtInfo, domEvt) => {\n if (this._pendingActions.hasAny) {\n domEvt.returnValue = this._pendingActions.first.message;\n }\n });\n }\n /**\n * @inheritDoc\n */\n destroy() {\n // There's no need for canceling or flushing the throttled save, as\n // it's done on the editor's destroy event with the highest priority.\n this._domEmitter.stopListening();\n super.destroy();\n }\n /**\n * Immediately calls autosave callback. All previously queued (debounced) callbacks are cleared. If there is already an autosave\n * callback in progress, then the requested save will be performed immediately after the current callback finishes.\n *\n * @returns A promise that will be resolved when the autosave callback is finished.\n */\n save() {\n this._debouncedSave.cancel();\n return this._save();\n }\n /**\n * Invokes the remaining `_save()` method call.\n */\n _flush() {\n this._debouncedSave.flush();\n }\n /**\n * If the adapter is set and a new document version exists,\n * the `_save()` method creates a pending action and calls the `adapter.save()` method.\n * It waits for the result and then removes the created pending action.\n *\n * @returns A promise that will be resolved when the autosave callback is finished.\n */\n _save() {\n if (this._savePromise) {\n this._makeImmediateSave = this.editor.model.document.version > this._lastDocumentVersion;\n return this._savePromise;\n }\n // Make sure there is a pending action (in case if `_save()` was called through manual `save()` call).\n this._setPendingAction();\n this.state = 'saving';\n this._lastDocumentVersion = this.editor.model.document.version;\n // Wait one promise cycle to be sure that save callbacks are not called inside a conversion or when the editor's state changes.\n this._savePromise = Promise.resolve()\n // Make autosave callback.\n .then(() => Promise.all(this._saveCallbacks.map(cb => cb(this.editor))))\n // When the autosave callback is finished, always clear `this._savePromise`, no matter if it was successful or not.\n .finally(() => {\n this._savePromise = null;\n })\n // If the save was successful, we have three scenarios:\n //\n // 1. If a save was requested when an autosave callback was already processed, we need to immediately call\n // another autosave callback. In this case, `this._savePromise` will not be resolved until the next callback is done.\n // 2. Otherwise, if changes happened to the model, make a delayed autosave callback (like the change just happened).\n // 3. If no changes happened to the model, return to the `synchronized` state.\n .then(() => {\n if (this._makeImmediateSave) {\n this._makeImmediateSave = false;\n // Start another autosave callback. Return a promise that will be resolved after the new autosave callback.\n // This way promises returned by `_save()` will not be resolved until all changes are saved.\n //\n // If `save()` was called when another (most often automatic) autosave callback was already processed,\n // the promise returned by `save()` call will be resolved only after new changes have been saved.\n //\n // Note that it would not work correctly if `this._savePromise` is not cleared.\n return this._save();\n }\n else {\n if (this.editor.model.document.version > this._lastDocumentVersion) {\n this.state = 'waiting';\n this._debouncedSave();\n }\n else {\n this.state = 'synchronized';\n this._pendingActions.remove(this._action);\n this._action = null;\n }\n }\n })\n // In case of an error, retry the autosave callback after a delay (and also throw the original error).\n .catch(err => {\n // Change state to `error` so that listeners handling autosave error can be called.\n this.state = 'error';\n // Then, immediately change to the `saving` state as described above.\n // Being in the `saving` state ensures that the autosave callback won't be delayed further by the `change:data` listener.\n this.state = 'saving';\n this._debouncedSave();\n throw err;\n });\n return this._savePromise;\n }\n /**\n * Creates a pending action if it is not set already.\n */\n _setPendingAction() {\n const t = this.editor.t;\n if (!this._action) {\n this._action = this._pendingActions.add(t('Saving changes'));\n }\n }\n /**\n * Saves callbacks.\n */\n get _saveCallbacks() {\n const saveCallbacks = [];\n if (this.adapter && this.adapter.save) {\n saveCallbacks.push(this.adapter.save);\n }\n if (this._config.save) {\n saveCallbacks.push(this._config.save);\n }\n return saveCallbacks;\n }\n}\n\nexport { Autosave };\n//# sourceMappingURL=index.js.map\n","/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module autosave/autosave\n */\n\nimport {\n\tPlugin,\n\tPendingActions,\n\ttype Editor,\n\ttype PendingAction,\n\ttype EditorDestroyEvent,\n\ttype EditorReadyEvent\n} from 'ckeditor5/src/core.js';\n\nimport { DomEmitterMixin, type DomEmitter } from 'ckeditor5/src/utils.js';\n\nimport type { DocumentChangeEvent } from 'ckeditor5/src/engine.js';\n\nimport { debounce, type DebouncedFunc } from 'lodash-es';\n\n/* globals window */\n\n/**\n * The {@link module:autosave/autosave~Autosave} plugin allows you to automatically save the data (e.g. send it to the server)\n * when needed (when the user changed the content).\n *\n * It listens to the {@link module:engine/model/document~Document#event:change:data `editor.model.document#change:data`}\n * and `window#beforeunload` events and calls the\n * {@link module:autosave/autosave~AutosaveAdapter#save `config.autosave.save()`} function.\n *\n * ```ts\n * ClassicEditor\n * \t.create( document.querySelector( '#editor' ), {\n * \t\tplugins: [ ArticlePluginSet, Autosave ],\n * \t\ttoolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ],\n * \t\timage: {\n * \t\t\ttoolbar: [ 'imageStyle:block', 'imageStyle:side', '|', 'toggleImageCaption', 'imageTextAlternative' ],\n * \t\t},\n * \t\tautosave: {\n * \t\t\tsave( editor: Editor ) {\n * \t\t\t\t// The saveData() function must return a promise\n * \t\t\t\t// which should be resolved when the data is successfully saved.\n * \t\t\t\treturn saveData( editor.getData() );\n * \t\t\t}\n * \t\t}\n * \t} );\n * ```\n *\n * Read more about this feature in the {@glink features/autosave Autosave} feature guide.\n */\nexport default class Autosave extends Plugin {\n\t/**\n\t * The adapter is an object with a `save()` method. That method will be called whenever\n\t * the data changes. It might be called some time after the change,\n\t * since the event is throttled for performance reasons.\n\t */\n\n\tpublic adapter?: AutosaveAdapter;\n\n\t/**\n\t * The state of this plugin.\n\t *\n\t * The plugin can be in the following states:\n\t *\n\t * * synchronized &ndash; When all changes are saved.\n\t * * waiting &ndash; When the plugin is waiting for other changes before calling `adapter#save()` and `config.autosave.save()`.\n\t * * saving &ndash; When the provided save method is called and the plugin waits for the response.\n\t * * error &ndash When the provided save method will throw an error. This state immediately changes to the `saving` state and\n\t * the save method will be called again in the short period of time.\n\t *\n\t * @observable\n\t * @readonly\n\t */\n\tdeclare public state: 'synchronized' | 'waiting' | 'saving' | 'error';\n\n\t/**\n\t * Debounced save method. The `save()` method is called the specified `waitingTime` after `debouncedSave()` is called,\n\t * unless a new action happens in the meantime.\n\t */\n\tprivate _debouncedSave: DebouncedFunc<( () => void )>;\n\n\t/**\n\t * The last saved document version.\n\t */\n\tprivate _lastDocumentVersion: number;\n\n\t/**\n\t * Promise used for asynchronous save calls.\n\t *\n\t * Created to handle the autosave call to an external data source. It resolves when that call is finished. It is re-used if\n\t * save is called before the promise has been resolved. It is set to `null` if there is no call in progress.\n\t */\n\tprivate _savePromise: Promise<void> | null;\n\n\t/**\n\t * DOM emitter.\n\t */\n\tprivate _domEmitter: DomEmitter;\n\n\t/**\n\t * The configuration of this plugins.\n\t */\n\tprivate _config: AutosaveConfig;\n\n\t/**\n\t * Editor's pending actions manager.\n\t */\n\tprivate _pendingActions: PendingActions;\n\n\t/**\n\t * Informs whether there should be another autosave callback performed, immediately after current autosave callback finishes.\n\t *\n\t * This is set to `true` when there is a save request while autosave callback is already being processed\n\t * and the model has changed since the last save.\n\t */\n\tprivate _makeImmediateSave: boolean;\n\n\t/**\n\t * An action that will be added to the pending action manager for actions happening in that plugin.\n\t */\n\tprivate _action: PendingAction | null = null;\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic static get pluginName() {\n\t\treturn 'Autosave' as const;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic static get requires() {\n\t\treturn [ PendingActions ] as const;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tconstructor( editor: Editor ) {\n\t\tsuper( editor );\n\n\t\tconst config: AutosaveConfig = editor.config.get( 'autosave' ) || {};\n\n\t\t// A minimum amount of time that needs to pass after the last action.\n\t\t// After that time the provided save callbacks are being called.\n\t\tconst waitingTime = config.waitingTime || 1000;\n\n\t\tthis.set( 'state', 'synchronized' );\n\n\t\tthis._debouncedSave = debounce( this._save.bind( this ), waitingTime );\n\t\tthis._lastDocumentVersion = editor.model.document.version;\n\t\tthis._savePromise = null;\n\t\tthis._domEmitter = new ( DomEmitterMixin() )();\n\t\tthis._config = config;\n\t\tthis._pendingActions = editor.plugins.get( PendingActions );\n\t\tthis._makeImmediateSave = false;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic init(): void {\n\t\tconst editor = this.editor;\n\t\tconst doc = editor.model.document;\n\n\t\t// Add the listener only after the editor is initialized to prevent firing save callback on data init.\n\t\tthis.listenTo<EditorReadyEvent>( editor, 'ready', () => {\n\t\t\tthis.listenTo<DocumentChangeEvent>( doc, 'change:data', ( evt, batch ) => {\n\t\t\t\tif ( !this._saveCallbacks.length ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( !batch.isLocal ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( this.state === 'synchronized' ) {\n\t\t\t\t\tthis.state = 'waiting';\n\t\t\t\t\t// Set pending action already when we are waiting for the autosave callback.\n\t\t\t\t\tthis._setPendingAction();\n\t\t\t\t}\n\n\t\t\t\tif ( this.state === 'waiting' ) {\n\t\t\t\t\tthis._debouncedSave();\n\t\t\t\t}\n\n\t\t\t\t// If the plugin is in `saving` state, it will change its state later basing on the `document.version`.\n\t\t\t\t// If the `document.version` will be higher than stored `#_lastDocumentVersion`, then it means, that some `change:data`\n\t\t\t\t// event has fired in the meantime.\n\t\t\t} );\n\t\t} );\n\n\t\t// Flush on the editor's destroy listener with the highest priority to ensure that\n\t\t// `editor.getData()` will be called before plugins are destroyed.\n\t\tthis.listenTo<EditorDestroyEvent>( editor, 'destroy', () => this._flush(), { priority: 'highest' } );\n\n\t\t// It's not possible to easy test it because karma uses `beforeunload` event\n\t\t// to warn before full page reload and this event cannot be dispatched manually.\n\t\t/* istanbul ignore next -- @preserve */\n\t\tthis._domEmitter.listenTo( window, 'beforeunload', ( evtInfo, domEvt ) => {\n\t\t\tif ( this._pendingActions.hasAny ) {\n\t\t\t\tdomEvt.returnValue = this._pendingActions.first!.message;\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic override destroy(): void {\n\t\t// There's no need for canceling or flushing the throttled save, as\n\t\t// it's done on the editor's destroy event with the highest priority.\n\n\t\tthis._domEmitter.stopListening();\n\t\tsuper.destroy();\n\t}\n\n\t/**\n\t * Immediately calls autosave callback. All previously queued (debounced) callbacks are cleared. If there is already an autosave\n\t * callback in progress, then the requested save will be performed immediately after the current callback finishes.\n\t *\n\t * @returns A promise that will be resolved when the autosave callback is finished.\n\t */\n\tpublic save(): Promise<void> {\n\t\tthis._debouncedSave.cancel();\n\n\t\treturn this._save();\n\t}\n\n\t/**\n\t * Invokes the remaining `_save()` method call.\n\t */\n\tprivate _flush(): void {\n\t\tthis._debouncedSave.flush();\n\t}\n\n\t/**\n\t * If the adapter is set and a new document version exists,\n\t * the `_save()` method creates a pending action and calls the `adapter.save()` method.\n\t * It waits for the result and then removes the created pending action.\n\t *\n\t * @returns A promise that will be resolved when the autosave callback is finished.\n\t */\n\tprivate _save(): Promise<void> {\n\t\tif ( this._savePromise ) {\n\t\t\tthis._makeImmediateSave = this.editor.model.document.version > this._lastDocumentVersion;\n\n\t\t\treturn this._savePromise;\n\t\t}\n\n\t\t// Make sure there is a pending action (in case if `_save()` was called through manual `save()` call).\n\t\tthis._setPendingAction();\n\n\t\tthis.state = 'saving';\n\t\tthis._lastDocumentVersion = this.editor.model.document.version;\n\n\t\t// Wait one promise cycle to be sure that save callbacks are not called inside a conversion or when the editor's state changes.\n\t\tthis._savePromise = Promise.resolve()\n\t\t\t// Make autosave callback.\n\t\t\t.then( () => Promise.all(\n\t\t\t\tthis._saveCallbacks.map( cb => cb( this.editor ) )\n\t\t\t) )\n\t\t\t// When the autosave callback is finished, always clear `this._savePromise`, no matter if it was successful or not.\n\t\t\t.finally( () => {\n\t\t\t\tthis._savePromise = null;\n\t\t\t} )\n\t\t\t// If the save was successful, we have three scenarios:\n\t\t\t//\n\t\t\t// 1. If a save was requested when an autosave callback was already processed, we need to immediately call\n\t\t\t// another autosave callback. In this case, `this._savePromise` will not be resolved until the next callback is done.\n\t\t\t// 2. Otherwise, if changes happened to the model, make a delayed autosave callback (like the change just happened).\n\t\t\t// 3. If no changes happened to the model, return to the `synchronized` state.\n\t\t\t.then( () => {\n\t\t\t\tif ( this._makeImmediateSave ) {\n\t\t\t\t\tthis._makeImmediateSave = false;\n\n\t\t\t\t\t// Start another autosave callback. Return a promise that will be resolved after the new autosave callback.\n\t\t\t\t\t// This way promises returned by `_save()` will not be resolved until all changes are saved.\n\t\t\t\t\t//\n\t\t\t\t\t// If `save()` was called when another (most often automatic) autosave callback was already processed,\n\t\t\t\t\t// the promise returned by `save()` call will be resolved only after new changes have been saved.\n\t\t\t\t\t//\n\t\t\t\t\t// Note that it would not work correctly if `this._savePromise` is not cleared.\n\t\t\t\t\treturn this._save();\n\t\t\t\t} else {\n\t\t\t\t\tif ( this.editor.model.document.version > this._lastDocumentVersion ) {\n\t\t\t\t\t\tthis.state = 'waiting';\n\t\t\t\t\t\tthis._debouncedSave();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.state = 'synchronized';\n\t\t\t\t\t\tthis._pendingActions.remove( this._action! );\n\t\t\t\t\t\tthis._action = null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} )\n\t\t\t// In case of an error, retry the autosave callback after a delay (and also throw the original error).\n\t\t\t.catch( err => {\n\t\t\t\t// Change state to `error` so that listeners handling autosave error can be called.\n\t\t\t\tthis.state = 'error';\n\t\t\t\t// Then, immediately change to the `saving` state as described above.\n\t\t\t\t// Being in the `saving` state ensures that the autosave callback won't be delayed further by the `change:data` listener.\n\t\t\t\tthis.state = 'saving';\n\n\t\t\t\tthis._debouncedSave();\n\n\t\t\t\tthrow err;\n\t\t\t} );\n\n\t\treturn this._savePromise;\n\t}\n\n\t/**\n\t * Creates a pending action if it is not set already.\n\t */\n\tprivate _setPendingAction(): void {\n\t\tconst t = this.editor.t;\n\n\t\tif ( !this._action ) {\n\t\t\tthis._action = this._pendingActions.add( t( 'Saving changes' ) );\n\t\t}\n\t}\n\n\t/**\n\t * Saves callbacks.\n\t */\n\tprivate get _saveCallbacks(): Array<( editor: Editor ) => Promise<unknown>> {\n\t\tconst saveCallbacks: Array<( editor: Editor ) => Promise<unknown>> = [];\n\n\t\tif ( this.adapter && this.adapter.save ) {\n\t\t\tsaveCallbacks.push( this.adapter.save );\n\t\t}\n\n\t\tif ( this._config.save ) {\n\t\t\tsaveCallbacks.push( this._config.save );\n\t\t}\n\n\t\treturn saveCallbacks;\n\t}\n}\n\n/**\n * An interface that requires the `save()` method.\n *\n * Used by {@link module:autosave/autosave~Autosave#adapter}.\n */\nexport interface AutosaveAdapter {\n\n\t/**\n\t * 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),\n\t * so the autosave plugin will wait for that action before removing it from pending actions.\n\t */\n\tsave( editor: Editor ): Promise<unknown>;\n}\n\n/**\n * The configuration of the {@link module:autosave/autosave~Autosave autosave feature}.\n *\n * ```ts\n * ClassicEditor\n * \t.create( editorElement, {\n * \t\tautosave: {\n * \t\t\tsave( editor: Editor ) {\n * \t\t\t\t// The saveData() function must return a promise\n * \t\t\t\t// which should be resolved when the data is successfully saved.\n * \t\t\t\treturn saveData( editor.getData() );\n * \t\t\t}\n * \t\t}\n * \t} );\n * \t.then( ... )\n * \t.catch( ... );\n * ```\n *\n * See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.\n *\n * See also the demo of the {@glink features/autosave autosave feature}.\n */\nexport interface AutosaveConfig {\n\n\t/**\n\t * The callback to be executed when the data needs to be saved.\n\t *\n\t * This function must return a promise which should be resolved when the data is successfully saved.\n\t *\n\t * ```ts\n\t * ClassicEditor\n\t * \t.create( editorElement, {\n\t * \t\tautosave: {\n\t * \t\t\tsave( editor: Editor ) {\n\t * \t\t\t\treturn saveData( editor.getData() );\n\t * \t\t\t}\n\t * \t\t}\n\t * \t} );\n\t * \t.then( ... )\n\t * \t.catch( ... );\n\t * ```\n\t */\n\tsave?: ( editor: Editor ) => Promise<unknown>;\n\n\t/**\n\t * The minimum amount of time that needs to pass after the last action to call the provided callback.\n\t * By default it is 1000 ms.\n\t *\n\t * ```ts\n\t * ClassicEditor\n\t * \t.create( editorElement, {\n\t * \t\tautosave: {\n\t * \t\t\tsave( editor: Editor ) {\n\t * \t\t\t\treturn saveData( editor.getData() );\n\t * \t\t\t},\n\t * \t\t\twaitingTime: 2000\n\t * \t\t}\n\t * \t} );\n\t * \t.then( ... )\n\t * \t.catch( ... );\n\t * ```\n\t */\n\twaitingTime?: number;\n}\n"]}
@@ -0,0 +1,18 @@
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
+ import type { Autosave, AutosaveConfig } from './index.js';
6
+ declare module '@ckeditor/ckeditor5-core' {
7
+ interface PluginsMap {
8
+ [Autosave.pluginName]: Autosave;
9
+ }
10
+ interface EditorConfig {
11
+ /**
12
+ * The configuration of the {@link module:autosave/autosave~Autosave autosave feature}.
13
+ *
14
+ * Read more in {@link module:autosave/autosave~AutosaveConfig}.
15
+ */
16
+ autosave?: AutosaveConfig;
17
+ }
18
+ }
@@ -0,0 +1,219 @@
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
+ * @module autosave/autosave
7
+ */
8
+ import { Plugin, PendingActions, type Editor } from 'ckeditor5/src/core.js';
9
+ /**
10
+ * The {@link module:autosave/autosave~Autosave} plugin allows you to automatically save the data (e.g. send it to the server)
11
+ * when needed (when the user changed the content).
12
+ *
13
+ * It listens to the {@link module:engine/model/document~Document#event:change:data `editor.model.document#change:data`}
14
+ * and `window#beforeunload` events and calls the
15
+ * {@link module:autosave/autosave~AutosaveAdapter#save `config.autosave.save()`} function.
16
+ *
17
+ * ```ts
18
+ * ClassicEditor
19
+ * .create( document.querySelector( '#editor' ), {
20
+ * plugins: [ ArticlePluginSet, Autosave ],
21
+ * toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ],
22
+ * image: {
23
+ * toolbar: [ 'imageStyle:block', 'imageStyle:side', '|', 'toggleImageCaption', 'imageTextAlternative' ],
24
+ * },
25
+ * autosave: {
26
+ * save( editor: Editor ) {
27
+ * // The saveData() function must return a promise
28
+ * // which should be resolved when the data is successfully saved.
29
+ * return saveData( editor.getData() );
30
+ * }
31
+ * }
32
+ * } );
33
+ * ```
34
+ *
35
+ * Read more about this feature in the {@glink features/autosave Autosave} feature guide.
36
+ */
37
+ export default class Autosave extends Plugin {
38
+ /**
39
+ * The adapter is an object with a `save()` method. That method will be called whenever
40
+ * the data changes. It might be called some time after the change,
41
+ * since the event is throttled for performance reasons.
42
+ */
43
+ adapter?: AutosaveAdapter;
44
+ /**
45
+ * The state of this plugin.
46
+ *
47
+ * The plugin can be in the following states:
48
+ *
49
+ * * synchronized &ndash; When all changes are saved.
50
+ * * waiting &ndash; When the plugin is waiting for other changes before calling `adapter#save()` and `config.autosave.save()`.
51
+ * * saving &ndash; When the provided save method is called and the plugin waits for the response.
52
+ * * error &ndash When the provided save method will throw an error. This state immediately changes to the `saving` state and
53
+ * the save method will be called again in the short period of time.
54
+ *
55
+ * @observable
56
+ * @readonly
57
+ */
58
+ state: 'synchronized' | 'waiting' | 'saving' | 'error';
59
+ /**
60
+ * Debounced save method. The `save()` method is called the specified `waitingTime` after `debouncedSave()` is called,
61
+ * unless a new action happens in the meantime.
62
+ */
63
+ private _debouncedSave;
64
+ /**
65
+ * The last saved document version.
66
+ */
67
+ private _lastDocumentVersion;
68
+ /**
69
+ * Promise used for asynchronous save calls.
70
+ *
71
+ * Created to handle the autosave call to an external data source. It resolves when that call is finished. It is re-used if
72
+ * save is called before the promise has been resolved. It is set to `null` if there is no call in progress.
73
+ */
74
+ private _savePromise;
75
+ /**
76
+ * DOM emitter.
77
+ */
78
+ private _domEmitter;
79
+ /**
80
+ * The configuration of this plugins.
81
+ */
82
+ private _config;
83
+ /**
84
+ * Editor's pending actions manager.
85
+ */
86
+ private _pendingActions;
87
+ /**
88
+ * Informs whether there should be another autosave callback performed, immediately after current autosave callback finishes.
89
+ *
90
+ * This is set to `true` when there is a save request while autosave callback is already being processed
91
+ * and the model has changed since the last save.
92
+ */
93
+ private _makeImmediateSave;
94
+ /**
95
+ * An action that will be added to the pending action manager for actions happening in that plugin.
96
+ */
97
+ private _action;
98
+ /**
99
+ * @inheritDoc
100
+ */
101
+ static get pluginName(): "Autosave";
102
+ /**
103
+ * @inheritDoc
104
+ */
105
+ static get requires(): readonly [typeof PendingActions];
106
+ /**
107
+ * @inheritDoc
108
+ */
109
+ constructor(editor: Editor);
110
+ /**
111
+ * @inheritDoc
112
+ */
113
+ init(): void;
114
+ /**
115
+ * @inheritDoc
116
+ */
117
+ destroy(): void;
118
+ /**
119
+ * Immediately calls autosave callback. All previously queued (debounced) callbacks are cleared. If there is already an autosave
120
+ * callback in progress, then the requested save will be performed immediately after the current callback finishes.
121
+ *
122
+ * @returns A promise that will be resolved when the autosave callback is finished.
123
+ */
124
+ save(): Promise<void>;
125
+ /**
126
+ * Invokes the remaining `_save()` method call.
127
+ */
128
+ private _flush;
129
+ /**
130
+ * If the adapter is set and a new document version exists,
131
+ * the `_save()` method creates a pending action and calls the `adapter.save()` method.
132
+ * It waits for the result and then removes the created pending action.
133
+ *
134
+ * @returns A promise that will be resolved when the autosave callback is finished.
135
+ */
136
+ private _save;
137
+ /**
138
+ * Creates a pending action if it is not set already.
139
+ */
140
+ private _setPendingAction;
141
+ /**
142
+ * Saves callbacks.
143
+ */
144
+ private get _saveCallbacks();
145
+ }
146
+ /**
147
+ * An interface that requires the `save()` method.
148
+ *
149
+ * Used by {@link module:autosave/autosave~Autosave#adapter}.
150
+ */
151
+ export interface AutosaveAdapter {
152
+ /**
153
+ * 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),
154
+ * so the autosave plugin will wait for that action before removing it from pending actions.
155
+ */
156
+ save(editor: Editor): Promise<unknown>;
157
+ }
158
+ /**
159
+ * The configuration of the {@link module:autosave/autosave~Autosave autosave feature}.
160
+ *
161
+ * ```ts
162
+ * ClassicEditor
163
+ * .create( editorElement, {
164
+ * autosave: {
165
+ * save( editor: Editor ) {
166
+ * // The saveData() function must return a promise
167
+ * // which should be resolved when the data is successfully saved.
168
+ * return saveData( editor.getData() );
169
+ * }
170
+ * }
171
+ * } );
172
+ * .then( ... )
173
+ * .catch( ... );
174
+ * ```
175
+ *
176
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
177
+ *
178
+ * See also the demo of the {@glink features/autosave autosave feature}.
179
+ */
180
+ export interface AutosaveConfig {
181
+ /**
182
+ * The callback to be executed when the data needs to be saved.
183
+ *
184
+ * This function must return a promise which should be resolved when the data is successfully saved.
185
+ *
186
+ * ```ts
187
+ * ClassicEditor
188
+ * .create( editorElement, {
189
+ * autosave: {
190
+ * save( editor: Editor ) {
191
+ * return saveData( editor.getData() );
192
+ * }
193
+ * }
194
+ * } );
195
+ * .then( ... )
196
+ * .catch( ... );
197
+ * ```
198
+ */
199
+ save?: (editor: Editor) => Promise<unknown>;
200
+ /**
201
+ * The minimum amount of time that needs to pass after the last action to call the provided callback.
202
+ * By default it is 1000 ms.
203
+ *
204
+ * ```ts
205
+ * ClassicEditor
206
+ * .create( editorElement, {
207
+ * autosave: {
208
+ * save( editor: Editor ) {
209
+ * return saveData( editor.getData() );
210
+ * },
211
+ * waitingTime: 2000
212
+ * }
213
+ * } );
214
+ * .then( ... )
215
+ * .catch( ... );
216
+ * ```
217
+ */
218
+ waitingTime?: number;
219
+ }
@@ -0,0 +1,9 @@
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
+ * @module autosave
7
+ */
8
+ export { default as Autosave, type AutosaveConfig } from './autosave.js';
9
+ import './augmentation.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-autosave",
3
- "version": "41.2.0",
3
+ "version": "41.3.0-alpha.1",
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.2.0",
16
+ "ckeditor5": "41.3.0-alpha.1",
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",