8
0
Просмотр исходного кода

Changed: update dropdowns to match the new API.

Maciej Gołaszewski 8 лет назад
Родитель
Сommit
ed90618525
1 измененных файлов с 4 добавлено и 11 удалено
  1. 4 11
      packages/ckeditor5-highlight/src/highlightui.js

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

@@ -198,15 +198,10 @@ export default class HighlightUI extends Plugin {
 
 			const dropdownView = createSplitButtonDropdown( model, locale );
 
-			bindIconStyle( dropdownView, model );
-
-			dropdownView.buttonView.on( 'execute', () => {
-				editor.execute( 'highlight', { value: model.commandValue } );
-				// TODO: execute focus should be defined elsewhere
-				editor.editing.view.focus();
-			} );
-
 			addToolbarToDropdown( dropdownView, model );
+			addDefaultBehavior( dropdownView );
+
+			bindIconStyleToColor( dropdownView, model );
 
 			// TODO: fix classes in dropdown
 			dropdownView.extendTemplate( {
@@ -215,8 +210,6 @@ export default class HighlightUI extends Plugin {
 				}
 			} );
 
-			addDefaultBehavior( dropdownView );
-
 			// Returns active highlighter option depending on current command value.
 			// If current is not set or it is the same as last execute this method will return the option key (like icon or color)
 			// of last executed highlighter. Otherwise it will return option key for current one.
@@ -232,7 +225,7 @@ export default class HighlightUI extends Plugin {
 }
 
 // Extends split button icon style to reflect last used button style.
-function bindIconStyle( dropdownView, model ) {
+function bindIconStyleToColor( dropdownView, model ) {
 	const iconView = dropdownView.buttonView.actionView.iconView;
 
 	const bind = iconView.bindTemplate;