@ckeditor/ckeditor5-autosave 41.4.1 → 42.0.0-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +1 -1
- package/README.md +6 -0
- package/ckeditor5-metadata.json +1 -1
- package/dist/index.js +106 -46
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -104,4 +104,4 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
104
104
|
|
105
105
|
### Other changes
|
106
106
|
|
107
|
-
* The first implementation of the autosave plugin. Check out the [demo](https://ckeditor.com/docs/ckeditor5/latest/
|
107
|
+
* The first implementation of the autosave plugin. Check out the [demo](https://ckeditor.com/docs/ckeditor5/latest/getting-started/setup/getting-and-setting-data.html#autosave-feature).
|
package/README.md
CHANGED
@@ -11,6 +11,12 @@ This package implements the autosave feature for CKEditor 5.
|
|
11
11
|
|
12
12
|
See the [`@ckeditor/ckeditor5-autosave` package](https://ckeditor.com/docs/ckeditor5/latest/api/autosave.html) page in [CKEditor 5 documentation](https://ckeditor.com/docs/ckeditor5/latest/).
|
13
13
|
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
```bash
|
17
|
+
npm install ckeditor5
|
18
|
+
```
|
19
|
+
|
14
20
|
## License
|
15
21
|
|
16
22
|
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html). For full details about the license, please check the `LICENSE.md` file or [https://ckeditor.com/legal/ckeditor-oss-license](https://ckeditor.com/legal/ckeditor-oss-license).
|
package/ckeditor5-metadata.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"name": "Autosave",
|
5
5
|
"className": "Autosave",
|
6
6
|
"description": "Allows you to automatically save the data (e.g. send it to the server) when needed, for example, when the user changed the content.",
|
7
|
-
"docs": "
|
7
|
+
"docs": "getting-started/setup/getting-and-setting-data.html#autosave-feature",
|
8
8
|
"path": "src/autosave.js"
|
9
9
|
}
|
10
10
|
]
|
package/dist/index.js
CHANGED
@@ -6,22 +6,102 @@ import { Plugin, PendingActions } from '@ckeditor/ckeditor5-core/dist/index.js';
|
|
6
6
|
import { DomEmitterMixin } from '@ckeditor/ckeditor5-utils/dist/index.js';
|
7
7
|
import { debounce } from 'lodash-es';
|
8
8
|
|
9
|
-
|
9
|
+
/* globals window */ /**
|
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
|
+
*/ class Autosave extends Plugin {
|
10
37
|
/**
|
11
|
-
|
12
|
-
|
38
|
+
* The adapter is an object with a `save()` method. That method will be called whenever
|
39
|
+
* the data changes. It might be called some time after the change,
|
40
|
+
* since the event is throttled for performance reasons.
|
41
|
+
*/ adapter;
|
42
|
+
/**
|
43
|
+
* Debounced save method. The `save()` method is called the specified `waitingTime` after `debouncedSave()` is called,
|
44
|
+
* unless a new action happens in the meantime.
|
45
|
+
*/ _debouncedSave;
|
46
|
+
/**
|
47
|
+
* The last saved document version.
|
48
|
+
*/ _lastDocumentVersion;
|
49
|
+
/**
|
50
|
+
* Promise used for asynchronous save calls.
|
51
|
+
*
|
52
|
+
* Created to handle the autosave call to an external data source. It resolves when that call is finished. It is re-used if
|
53
|
+
* save is called before the promise has been resolved. It is set to `null` if there is no call in progress.
|
54
|
+
*/ _savePromise;
|
55
|
+
/**
|
56
|
+
* DOM emitter.
|
57
|
+
*/ _domEmitter;
|
58
|
+
/**
|
59
|
+
* The configuration of this plugins.
|
60
|
+
*/ _config;
|
61
|
+
/**
|
62
|
+
* Editor's pending actions manager.
|
63
|
+
*/ _pendingActions;
|
64
|
+
/**
|
65
|
+
* Informs whether there should be another autosave callback performed, immediately after current autosave callback finishes.
|
66
|
+
*
|
67
|
+
* This is set to `true` when there is a save request while autosave callback is already being processed
|
68
|
+
* and the model has changed since the last save.
|
69
|
+
*/ _makeImmediateSave;
|
70
|
+
/**
|
71
|
+
* An action that will be added to the pending action manager for actions happening in that plugin.
|
72
|
+
*/ _action = null;
|
73
|
+
/**
|
74
|
+
* @inheritDoc
|
75
|
+
*/ static get pluginName() {
|
13
76
|
return 'Autosave';
|
14
77
|
}
|
15
78
|
/**
|
16
|
-
|
17
|
-
|
79
|
+
* @inheritDoc
|
80
|
+
*/ static get requires() {
|
18
81
|
return [
|
19
82
|
PendingActions
|
20
83
|
];
|
21
84
|
}
|
22
85
|
/**
|
23
|
-
|
24
|
-
|
86
|
+
* @inheritDoc
|
87
|
+
*/ constructor(editor){
|
88
|
+
super(editor);
|
89
|
+
const config = editor.config.get('autosave') || {};
|
90
|
+
// A minimum amount of time that needs to pass after the last action.
|
91
|
+
// After that time the provided save callbacks are being called.
|
92
|
+
const waitingTime = config.waitingTime || 1000;
|
93
|
+
this.set('state', 'synchronized');
|
94
|
+
this._debouncedSave = debounce(this._save.bind(this), waitingTime);
|
95
|
+
this._lastDocumentVersion = editor.model.document.version;
|
96
|
+
this._savePromise = null;
|
97
|
+
this._domEmitter = new (DomEmitterMixin())();
|
98
|
+
this._config = config;
|
99
|
+
this._pendingActions = editor.plugins.get(PendingActions);
|
100
|
+
this._makeImmediateSave = false;
|
101
|
+
}
|
102
|
+
/**
|
103
|
+
* @inheritDoc
|
104
|
+
*/ init() {
|
25
105
|
const editor = this.editor;
|
26
106
|
const doc = editor.model.document;
|
27
107
|
// Add the listener only after the editor is initialized to prevent firing save callback on data init.
|
@@ -60,34 +140,34 @@ class Autosave extends Plugin {
|
|
60
140
|
});
|
61
141
|
}
|
62
142
|
/**
|
63
|
-
|
64
|
-
|
143
|
+
* @inheritDoc
|
144
|
+
*/ destroy() {
|
65
145
|
// There's no need for canceling or flushing the throttled save, as
|
66
146
|
// it's done on the editor's destroy event with the highest priority.
|
67
147
|
this._domEmitter.stopListening();
|
68
148
|
super.destroy();
|
69
149
|
}
|
70
150
|
/**
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
151
|
+
* Immediately calls autosave callback. All previously queued (debounced) callbacks are cleared. If there is already an autosave
|
152
|
+
* callback in progress, then the requested save will be performed immediately after the current callback finishes.
|
153
|
+
*
|
154
|
+
* @returns A promise that will be resolved when the autosave callback is finished.
|
155
|
+
*/ save() {
|
76
156
|
this._debouncedSave.cancel();
|
77
157
|
return this._save();
|
78
158
|
}
|
79
159
|
/**
|
80
|
-
|
81
|
-
|
160
|
+
* Invokes the remaining `_save()` method call.
|
161
|
+
*/ _flush() {
|
82
162
|
this._debouncedSave.flush();
|
83
163
|
}
|
84
164
|
/**
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
165
|
+
* If the adapter is set and a new document version exists,
|
166
|
+
* the `_save()` method creates a pending action and calls the `adapter.save()` method.
|
167
|
+
* It waits for the result and then removes the created pending action.
|
168
|
+
*
|
169
|
+
* @returns A promise that will be resolved when the autosave callback is finished.
|
170
|
+
*/ _save() {
|
91
171
|
if (this._savePromise) {
|
92
172
|
this._makeImmediateSave = this.editor.model.document.version > this._lastDocumentVersion;
|
93
173
|
return this._savePromise;
|
@@ -141,16 +221,16 @@ class Autosave extends Plugin {
|
|
141
221
|
return this._savePromise;
|
142
222
|
}
|
143
223
|
/**
|
144
|
-
|
145
|
-
|
224
|
+
* Creates a pending action if it is not set already.
|
225
|
+
*/ _setPendingAction() {
|
146
226
|
const t = this.editor.t;
|
147
227
|
if (!this._action) {
|
148
228
|
this._action = this._pendingActions.add(t('Saving changes'));
|
149
229
|
}
|
150
230
|
}
|
151
231
|
/**
|
152
|
-
|
153
|
-
|
232
|
+
* Saves callbacks.
|
233
|
+
*/ get _saveCallbacks() {
|
154
234
|
const saveCallbacks = [];
|
155
235
|
if (this.adapter && this.adapter.save) {
|
156
236
|
saveCallbacks.push(this.adapter.save);
|
@@ -160,26 +240,6 @@ class Autosave extends Plugin {
|
|
160
240
|
}
|
161
241
|
return saveCallbacks;
|
162
242
|
}
|
163
|
-
/**
|
164
|
-
* @inheritDoc
|
165
|
-
*/ constructor(editor){
|
166
|
-
super(editor);
|
167
|
-
/**
|
168
|
-
* An action that will be added to the pending action manager for actions happening in that plugin.
|
169
|
-
*/ this._action = null;
|
170
|
-
const config = editor.config.get('autosave') || {};
|
171
|
-
// A minimum amount of time that needs to pass after the last action.
|
172
|
-
// After that time the provided save callbacks are being called.
|
173
|
-
const waitingTime = config.waitingTime || 1000;
|
174
|
-
this.set('state', 'synchronized');
|
175
|
-
this._debouncedSave = debounce(this._save.bind(this), waitingTime);
|
176
|
-
this._lastDocumentVersion = editor.model.document.version;
|
177
|
-
this._savePromise = null;
|
178
|
-
this._domEmitter = new (DomEmitterMixin())();
|
179
|
-
this._config = config;
|
180
|
-
this._pendingActions = editor.plugins.get(PendingActions);
|
181
|
-
this._makeImmediateSave = false;
|
182
|
-
}
|
183
243
|
}
|
184
244
|
|
185
245
|
export { Autosave };
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js","../src/autosave.ts"],"names":["Autosave","Plugin","pluginName","requires","PendingActions","init","editor","doc","model","document","listenTo","evt","batch","_saveCallbacks","length","isLocal","state","_setPendingAction","_debouncedSave","_flush","priority","_domEmitter","window","evtInfo","domEvt","_pendingActions","hasAny","returnValue","first","message","destroy","stopListening","save","cancel","_save","flush","_savePromise","_makeImmediateSave","version","_lastDocumentVersion","Promise","resolve","then","all","map","cb","finally","remove","_action","catch","err","t","add","saveCallbacks","adapter","push","_config","constructor","config","get","waitingTime","set","debounce","bind","DomEmitterMixin","plugins"],"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;ACmDqB,KAAAA,CAAAA,QAAiBC,CAAAA,OAAAA,CAAAA,MAAAA,CAAAA,CAAAA;AAwErC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;ADxHD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU;AC0Hd,CACI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA,GAAA,CAAWC,UAAU,CAAA,CAAA,CAAA,CAAA;ADzH7B,CC0HE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAO,CAAA,QAAA,CAAA,CAAA;AACR,CAAA,CAA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A,CAAAA;ADiB3D,CChBE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAI,CAACrB,oBAAoB,CAAGjC,CAAAA,CAAAA,MAAAA,CAAOE,KAAK,CAACC,QAAQ,CAAC6B,OAAO,CAAA;ADiB3D,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CChBL,IAAI,CAACF,YAAY,CAAA,CAAA,CAAG,IAAA,CAAA;AACpB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAI,CAACf,WAAW,CAAA,CAAA,CAAG,GAAA,CAAA,CAAM2C,eAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;ADiB1C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CChBL,IAAI,CAACR,OAAO,CAAA,CAAA,CAAGE,MAAAA,CAAAA;AACf,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAI,CAACjC,eAAe,CAAA,CAAA,CAAGnB,MAAAA,CAAO2D,OAAO,CAACN,GAAG,CAAEvD,cAAAA,CAAAA,CAAAA;ADiB7C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CChBL,IAAI,CAACiC,kBAAkB,CAAA,CAAA,CAAG,KAAA,CAAA;AAC3B,CAAA,CAAA,CAAA,CAAA,CAAA;AAsLA,CAAA;ADpKD;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\nclass Autosave extends Plugin {\n /**\n * @inheritDoc\n */ static get pluginName() {\n return 'Autosave';\n }\n /**\n * @inheritDoc\n */ static get requires() {\n return [\n PendingActions\n ];\n }\n /**\n * @inheritDoc\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(), {\n priority: 'highest'\n });\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 */ 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 */ 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 */ save() {\n this._debouncedSave.cancel();\n return this._save();\n }\n /**\n * Invokes the remaining `_save()` method call.\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 */ _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()// Make autosave callback.\n .then(()=>Promise.all(this._saveCallbacks.map((cb)=>cb(this.editor))))// 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 })// 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 } else {\n if (this.editor.model.document.version > this._lastDocumentVersion) {\n this.state = 'waiting';\n this._debouncedSave();\n } else {\n this.state = 'synchronized';\n this._pendingActions.remove(this._action);\n this._action = null;\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 */ _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 */ 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 * @inheritDoc\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 */ 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\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 – When all changes are saved.\n\t * * waiting – When the plugin is waiting for other changes before calling `adapter#save()` and `config.autosave.save()`.\n\t * * saving – 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"]}
|
1
|
+
{"version":3,"sources":["index.js","../src/autosave.ts"],"names":["Autosave","Plugin","_action","pluginName","requires","PendingActions","constructor","editor","config","get","waitingTime","set","_debouncedSave","debounce","_save","bind","_lastDocumentVersion","model","document","version","_savePromise","_domEmitter","DomEmitterMixin","_config","_pendingActions","plugins","_makeImmediateSave","doc","listenTo","evt","batch","_saveCallbacks","length","isLocal","state","_setPendingAction","_flush","priority","window","evtInfo","domEvt","hasAny","returnValue","first","message","stopListening","destroy","cancel","flush","Promise","resolve","then","all","map","cb","finally","remove","catch","err","t","add","saveCallbacks","adapter","save","push"],"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;ACqBA,CAAA,CAAA,CAAA,OAAA,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;ADnBA,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC;AAC9H,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CA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CAAA,CAAA,CAAA,CAAI,IAAI,CAACA,OAAO,CAACC,IAAI,CAAG,CAAA,CAAA;AACxCF,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,aAAAA,CAAcG,IAAI,CAAE,IAAI,CAACF,OAAO,CAACC,IAAI,CAAA,CAAA;AACtC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAK,IAAI,CAACxC,OAAO,CAACwC,IAAI,CAAG,CAAA,CAAA;AACxBF,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,aAAAA,CAAcG,IAAI,CAAE,IAAI,CAACzC,OAAO,CAACwC,IAAI,CAAA,CAAA;AACtC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;ADvGF,CCyGE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAOF,aAAAA,CAAAA;AACR,CAAA,CAAA,CAAA,CAAA,CAAA;AACD,CAAA;ADxGA;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/* globals window */ /**\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 */ class Autosave extends Plugin {\n /**\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 */ adapter;\n /**\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 */ _debouncedSave;\n /**\n\t * The last saved document version.\n\t */ _lastDocumentVersion;\n /**\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 */ _savePromise;\n /**\n\t * DOM emitter.\n\t */ _domEmitter;\n /**\n\t * The configuration of this plugins.\n\t */ _config;\n /**\n\t * Editor's pending actions manager.\n\t */ _pendingActions;\n /**\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 */ _makeImmediateSave;\n /**\n\t * An action that will be added to the pending action manager for actions happening in that plugin.\n\t */ _action = null;\n /**\n\t * @inheritDoc\n\t */ static get pluginName() {\n return 'Autosave';\n }\n /**\n\t * @inheritDoc\n\t */ static get requires() {\n return [\n PendingActions\n ];\n }\n /**\n\t * @inheritDoc\n\t */ constructor(editor){\n super(editor);\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\t * @inheritDoc\n\t */ 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(), {\n priority: 'highest'\n });\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 */ this._domEmitter.listenTo(window, 'beforeunload', (evtInfo, domEvt)=>{\n if (this._pendingActions.hasAny) {\n domEvt.returnValue = this._pendingActions.first.message;\n }\n });\n }\n /**\n\t * @inheritDoc\n\t */ 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\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 */ save() {\n this._debouncedSave.cancel();\n return this._save();\n }\n /**\n\t * Invokes the remaining `_save()` method call.\n\t */ _flush() {\n this._debouncedSave.flush();\n }\n /**\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 */ _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()// Make autosave callback.\n .then(()=>Promise.all(this._saveCallbacks.map((cb)=>cb(this.editor))))// 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 })// 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 } else {\n if (this.editor.model.document.version > this._lastDocumentVersion) {\n this.state = 'waiting';\n this._debouncedSave();\n } else {\n this.state = 'synchronized';\n this._pendingActions.remove(this._action);\n this._action = null;\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\t * Creates a pending action if it is not set already.\n\t */ _setPendingAction() {\n const t = this.editor.t;\n if (!this._action) {\n this._action = this._pendingActions.add(t('Saving changes'));\n }\n }\n /**\n\t * Saves callbacks.\n\t */ 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 – When all changes are saved.\n\t * * waiting – When the plugin is waiting for other changes before calling `adapter#save()` and `config.autosave.save()`.\n\t * * saving – 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"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-autosave",
|
3
|
-
"version": "
|
3
|
+
"version": "42.0.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": "
|
16
|
+
"ckeditor5": "42.0.0-alpha.0",
|
17
17
|
"lodash-es": "4.17.21"
|
18
18
|
},
|
19
19
|
"author": "CKSource (http://cksource.com/)",
|