瀏覽代碼

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

Maciej Bukowski 6 年之前
父節點
當前提交
535dcd2b6b
共有 1 個文件被更改,包括 3 次插入1 次删除
  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() )