Parcourir la source

Moved throttled data saving to the `destory()` method.

Maciej Bukowski il y a 6 ans
Parent
commit
535dcd2b6b
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      packages/ckeditor5-watchdog/src/watchdog.js

+ 3 - 1
packages/ckeditor5-watchdog/src/watchdog.js

@@ -266,6 +266,9 @@ export default class Watchdog {
 		window.removeEventListener( 'error', this._boundErrorHandler );
 		this.stopListening( this._editor.model.document, 'change:data', this._throttledSave );
 
+		// Save data if there are remaining changes.
+		this._throttledSave.flush();
+
 		return Promise.resolve()
 			.then( () => this._destructor( this._editor ) )
 			.then( () => {
@@ -382,7 +385,6 @@ export default class Watchdog {
 	 */
 	_restart() {
 		this.state = 'initializing';
-		this._throttledSave.flush();
 
 		return Promise.resolve()
 			.then( () => this._destroy() )