瀏覽代碼

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

Kamil Piechaczek 7 年之前
父節點
當前提交
7f0eedc593
共有 2 個文件被更改,包括 7 次插入1 次删除
  1. 1 1
      packages/ckeditor5-link/src/linkui.js
  2. 6 0
      packages/ckeditor5-link/tests/linkui.js

+ 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;
 			} );