Răsfoiți Sursa

Internal: Combined common conditions that results with hiding a toolbar.

Marek Lewandowski 6 ani în urmă
părinte
comite
67ea18c0fd

+ 1 - 5
packages/ckeditor5-widget/src/widgettoolbarrepository.js

@@ -245,7 +245,7 @@ export default class WidgetToolbarRepository extends Plugin {
 		for ( const definition of this._toolbarDefinitions.values() ) {
 			const relatedElement = definition.getRelatedElement( this.editor.editing.view.document.selection );
 
-			if ( !this.isEnabled ) {
+			if ( !this.isEnabled || !relatedElement ) {
 				if ( this._isToolbarInBalloon( definition ) ) {
 					this._hideToolbar( definition );
 				}
@@ -253,10 +253,6 @@ export default class WidgetToolbarRepository extends Plugin {
 				if ( this._isToolbarVisible( definition ) ) {
 					this._hideToolbar( definition );
 				}
-			} else if ( !relatedElement ) {
-				if ( this._isToolbarInBalloon( definition ) ) {
-					this._hideToolbar( definition );
-				}
 			} else {
 				const relatedElementDepth = relatedElement.getAncestors().length;