From 44e0eac41a20b247f68bad7d9f2386ffa2f14ff9 Mon Sep 17 00:00:00 2001 From: Kamil Piechaczek Date: Fri, 7 Sep 2018 11:27:59 +0200 Subject: [PATCH] Link icon will be active if selection is inside the link. --- src/linkui.js | 2 +- tests/linkui.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/linkui.js b/src/linkui.js index 3be24b2..4e62f1a 100644 --- a/src/linkui.js +++ b/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() ); diff --git a/tests/linkui.js b/tests/linkui.js index 11d4f15..3cbc1b0 100644 --- a/tests/linkui.js +++ b/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; } );