Browse Source

Switch split button to dropdown

Mateusz Samsel 6 years ago
parent
commit
702ffde9ce
1 changed files with 1 additions and 11 deletions
  1. 1 11
      packages/ckeditor5-font/src/fontcolor/fontcolorui.js

+ 1 - 11
packages/ckeditor5-font/src/fontcolor/fontcolorui.js

@@ -8,7 +8,6 @@
  */
  */
 
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import SplitButtonView from '@ckeditor/ckeditor5-ui/src/dropdown/button/splitbuttonview';
 
 
 import fontColorIcon from '../../theme/icons/font-family.svg';
 import fontColorIcon from '../../theme/icons/font-family.svg';
 import { createDropdown } from '@ckeditor/ckeditor5-ui/src/dropdown/utils';
 import { createDropdown } from '@ckeditor/ckeditor5-ui/src/dropdown/utils';
@@ -26,8 +25,7 @@ export default class FontColorUI extends Plugin {
 
 
 		// Register UI component.
 		// Register UI component.
 		editor.ui.componentFactory.add( FONT_COLOR, locale => {
 		editor.ui.componentFactory.add( FONT_COLOR, locale => {
-			const dropdownView = createDropdown( locale, SplitButtonView );
-			const splitButtonView = dropdownView.buttonView;
+			const dropdownView = createDropdown( locale );
 			const colorTableView = colorUI.addColorsToDropdown(
 			const colorTableView = colorUI.addColorsToDropdown(
 				dropdownView,
 				dropdownView,
 				options.map( element => ( {
 				options.map( element => ( {
@@ -42,9 +40,6 @@ export default class FontColorUI extends Plugin {
 
 
 			colorTableView.bind( 'selectedColor' ).to( command, 'value' );
 			colorTableView.bind( 'selectedColor' ).to( command, 'value' );
 
 
-			// Preselect first element on color list.
-			dropdownView.set( 'lastlySelectedColor', { value: options[ 0 ].model } );
-
 			dropdownView.buttonView.set( {
 			dropdownView.buttonView.set( {
 				label: t( 'Font Color' ),
 				label: t( 'Font Color' ),
 				icon: fontColorIcon,
 				icon: fontColorIcon,
@@ -60,17 +55,12 @@ export default class FontColorUI extends Plugin {
 			dropdownView.bind( 'isEnabled' ).to( command );
 			dropdownView.bind( 'isEnabled' ).to( command );
 
 
 			dropdownView.on( 'execute', ( evt, val ) => {
 			dropdownView.on( 'execute', ( evt, val ) => {
-				dropdownView.set( 'lastlySelectedColor', val );
 				if ( val.value !== null ) {
 				if ( val.value !== null ) {
 					colorTableView.recentlyUsedColors.add( { color: val.value, hasBorder: val.hasBorder }, 0 );
 					colorTableView.recentlyUsedColors.add( { color: val.value, hasBorder: val.hasBorder }, 0 );
 				}
 				}
 				editor.execute( FONT_COLOR, val );
 				editor.execute( FONT_COLOR, val );
 			} );
 			} );
 
 
-			splitButtonView.on( 'execute', () => {
-				editor.execute( FONT_COLOR, dropdownView.lastlySelectedColor );
-			} );
-
 			return dropdownView;
 			return dropdownView;
 		} );
 		} );
 	}
 	}