Browse Source

Added: Bind model `isOn` to highlight command value.

Maciej Gołaszewski 7 years ago
parent
commit
0be08a8ab7
1 changed files with 4 additions and 3 deletions
  1. 4 3
      packages/ckeditor5-highlight/src/highlightui.js

+ 4 - 3
packages/ckeditor5-highlight/src/highlightui.js

@@ -163,12 +163,13 @@ export default class HighlightUI extends Plugin {
 				commandValue: startingHighlighter.model
 			} );
 
-			// Dropdown button changes to selection (command.value).
-			// If selection is in highlight it get active highlight appearance (icon, color).
-			// Otherwise it gets appearance (icon, color) of last executed highlight.
+			// Dropdown button changes to selection (command.value):
+			// - If selection is in highlight it get active highlight appearance (icon, color) and is activated.
+			// - Otherwise it gets appearance (icon, color) of last executed highlight.
 			model.bind( 'icon' ).to( command, 'value', value => getIconForType( getActiveOption( value, 'type' ) ) );
 			model.bind( 'color' ).to( command, 'value', value => getActiveOption( value, 'color' ) );
 			model.bind( 'commandValue' ).to( command, 'value', value => getActiveOption( value, 'model' ) );
+			model.bind( 'isOn' ).to( command, 'value', value => !!value );
 
 			// Create buttons array.
 			const buttons = options.map( option => {