Przeglądaj źródła

Internal: Ensure that commit is executed in a single view change batch.

Marek Lewandowski 5 lat temu
rodzic
commit
f8430b8c39

+ 5 - 2
packages/ckeditor5-widget/src/widgetresize/resizer.js

@@ -197,8 +197,11 @@ export default class Resizer {
 		const unit = this._options.unit || '%';
 		const newValue = ( unit === '%' ? this.state.proposedWidthPercents : this.state.proposedWidth ) + unit;
 
-		this._cleanup();
-		this._options.onCommit( newValue );
+		// Both cleanup and onCommit callback are very likely to make view changes. Ensure that it is made in a single step.
+		this._options.editor.editing.view.change( () => {
+			this._cleanup();
+			this._options.onCommit( newValue );
+		} );
 	}
 
 	/**