Przeglądaj źródła

Make sure that link's button#isOn property has boolean value.

Mateusz Samsel 6 lat temu
rodzic
commit
53874214f5

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

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

+ 2 - 2
packages/ckeditor5-link/tests/linkui.js

@@ -93,13 +93,13 @@ describe( 'LinkUI', () => {
 				const command = editor.commands.get( 'link' );
 
 				command.isEnabled = true;
-				command.value = true;
+				command.value = 'http://ckeditor.com';
 
 				expect( linkButton.isOn ).to.be.true;
 				expect( linkButton.isEnabled ).to.be.true;
 
 				command.isEnabled = false;
-				command.value = false;
+				command.value = undefined;
 
 				expect( linkButton.isOn ).to.be.false;
 				expect( linkButton.isEnabled ).to.be.false;