Sfoglia il codice sorgente

Link icon will be active if selection is inside the link.

Kamil Piechaczek 7 anni fa
parent
commit
7f0eedc593

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

@@ -186,7 +186,7 @@ export default class LinkUI extends Plugin {
 			button.tooltip = true;
 
 			// Bind button to the command.
-			button.bind( 'isEnabled' ).to( linkCommand, 'isEnabled' );
+			button.bind( 'isOn', 'isEnabled' ).to( linkCommand, 'value', 'isEnabled' );
 
 			// Show the panel on button click.
 			this.listenTo( button, 'execute', () => this._showUI() );

+ 6 - 0
packages/ckeditor5-link/tests/linkui.js

@@ -84,9 +84,15 @@ describe( 'LinkUI', () => {
 				const command = editor.commands.get( 'link' );
 
 				command.isEnabled = true;
+				command.value = true;
+
+				expect( linkButton.isOn ).to.be.true;
 				expect( linkButton.isEnabled ).to.be.true;
 
 				command.isEnabled = false;
+				command.value = false;
+
+				expect( linkButton.isOn ).to.be.false;
 				expect( linkButton.isEnabled ).to.be.false;
 			} );