Преглед на файлове

Removed condition blocking toolbar actions when editor was not focused.

Oskar Wrobel преди 9 години
родител
ревизия
4e10927402
променени са 2 файла, в които са добавени 1 реда и са изтрити 21 реда
  1. 0 10
      packages/ckeditor5-link/src/link.js
  2. 1 11
      packages/ckeditor5-link/tests/link.js

+ 0 - 10
packages/ckeditor5-link/src/link.js

@@ -58,7 +58,6 @@ export default class Link extends Feature {
 	 */
 	_createToolbarLinkButton() {
 		const editor = this.editor;
-		const viewDocument = editor.editing.view;
 		const linkCommand = editor.commands.get( 'link' );
 		const t = editor.t;
 
@@ -76,10 +75,6 @@ export default class Link extends Feature {
 
 		// Show the panel on button click only when editor is focused.
 		this.listenTo( linkButtonModel, 'execute', () => {
-			if ( !viewDocument.isFocused ) {
-				return;
-			}
-
 			this._attachPanelToElement();
 			this.balloonPanel.urlInput.view.select();
 		} );
@@ -184,11 +179,6 @@ export default class Link extends Feature {
 
 					// When click was out of the panel then hide it.
 					balloonPanel.view.hide();
-
-					// When editor was clicked then restore editor focus.
-					if ( editor.ui.view.element.contains( domEvt.target ) ) {
-						viewDocument.focus();
-					}
 				} );
 			} else {
 				balloonPanel.view.stopListening( document );

+ 1 - 11
packages/ckeditor5-link/tests/link.js

@@ -73,22 +73,12 @@ describe( 'Link', () => {
 			expect( model.isEnabled ).to.be.false;
 		} );
 
-		it( 'should open panel on linkButton#model execute event, when editor is focused', () => {
-			editor.editing.view.isFocused = true;
-
+		it( 'should open panel on linkButton#model execute event', () => {
 			linkButton.model.fire( 'execute' );
 
 			expect( linkFeature.balloonPanel.view.isVisible ).to.true;
 		} );
 
-		it( 'should not open panel on linkButton#model execute event, when editor is not focused', () => {
-			editor.editing.view.isFocused = false;
-
-			linkButton.model.fire( 'execute' );
-
-			expect( linkFeature.balloonPanel.view.isVisible ).to.false;
-		} );
-
 		it( 'should open panel attached to the link element, when collapsed selection is inside link element', () => {
 			const attachToSpy = testUtils.sinon.spy( balloonPanel.view, 'attachTo' );