8
0
Просмотр исходного кода

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

Marek Lewandowski 6 лет назад
Родитель
Сommit
67ea18c0fd
1 измененных файлов с 1 добавлено и 5 удалено
  1. 1 5
      packages/ckeditor5-widget/src/widgettoolbarrepository.js

+ 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;