瀏覽代碼

Prevent showing panel when editor is not focused.

Oskar Wrobel 9 年之前
父節點
當前提交
b46fcea0b3
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      packages/ckeditor5-link/src/link.js

+ 5 - 1
packages/ckeditor5-link/src/link.js

@@ -48,6 +48,10 @@ export default class Link extends Feature {
 
 		// Show Balloon Panel on button click.
 		this.listenTo( buttonModel, 'execute', () => {
+			if ( !this.editor.editing.view.isFocused ) {
+				return;
+			}
+
 			if ( !this.balloonPanel ) {
 				this._createBalloonPanel();
 			}
@@ -58,7 +62,7 @@ export default class Link extends Feature {
 		// Add link button to feature components.
 		editor.ui.featureComponents.add( 'link', ButtonController, ButtonView, buttonModel );
 
-		// Show Balloon Panel on click directly in some link element.
+		// Show Balloon Panel on click directly on some link element.
 		// @TODO: Get click event from editor instead of DOM.
 		this.editor.ui.editable.view.element.addEventListener( 'click', () => {
 			if ( editor.document.selection.isCollapsed && command.value !== undefined ) {