8
0
فهرست منبع

Update to view changes.

Szymon Kupś 7 سال پیش
والد
کامیت
620edcf616

+ 2 - 2
packages/ckeditor5-ui/src/toolbar/contextual/contextualtoolbar.js

@@ -170,7 +170,7 @@ export default class ContextualToolbar extends Plugin {
 
 		// Update the toolbar position upon change (e.g. external document changes)
 		// while it's visible.
-		this.listenTo( this.editor.editing.view.document, 'change', () => {
+		this.listenTo( this.editor.editing.view, 'render', () => {
 			this._balloon.updatePosition( this._getBalloonPositionData() );
 		} );
 
@@ -187,7 +187,7 @@ export default class ContextualToolbar extends Plugin {
 	 */
 	hide() {
 		if ( this._balloon.hasView( this.toolbarView ) ) {
-			this.stopListening( this.editor.editing.view.document, 'change' );
+			this.stopListening( this.editor.editing.view, 'render' );
 			this._balloon.remove( this.toolbarView );
 		}
 	}

+ 3 - 3
packages/ckeditor5-ui/tests/toolbar/contextual/contextualtoolbar.js

@@ -248,12 +248,12 @@ describe( 'ContextualToolbar', () => {
 
 			const spy = sandbox.spy( balloon, 'updatePosition' );
 
-			editingView.document.fire( 'change' );
+			editingView.fire( 'render' );
 
 			contextualToolbar.show();
 			sinon.assert.notCalled( spy );
 
-			editingView.document.fire( 'change' );
+			editingView.fire( 'render' );
 			sinon.assert.calledOnce( spy );
 		} );
 
@@ -345,7 +345,7 @@ describe( 'ContextualToolbar', () => {
 			contextualToolbar.show();
 			contextualToolbar.hide();
 
-			editingView.fire( 'change' );
+			editingView.fire( 'render' );
 			sinon.assert.notCalled( spy );
 		} );