Explorar o código

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

Marek Lewandowski %!s(int64=5) %!d(string=hai) anos
pai
achega
f8430b8c39
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  1. 5 2
      packages/ckeditor5-widget/src/widgetresize/resizer.js

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

@@ -197,8 +197,11 @@ export default class Resizer {
 		const unit = this._options.unit || '%';
 		const unit = this._options.unit || '%';
 		const newValue = ( unit === '%' ? this.state.proposedWidthPercents : this.state.proposedWidth ) + 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 );
+		} );
 	}
 	}
 
 
 	/**
 	/**