Răsfoiți Sursa

Other: SplitButton dropdown improvements.

Maciej Gołaszewski 8 ani în urmă
părinte
comite
cb5ba19588

+ 5 - 0
packages/ckeditor5-ui/src/button/splitbuttonview.js

@@ -90,6 +90,9 @@ export default class SplitButtonView extends View {
 
 
 		buttonView.delegate( 'execute' ).to( this );
 		buttonView.delegate( 'execute' ).to( this );
 
 
+		buttonView.bind( 'isEnabled' ).to( this );
+		buttonView.bind( 'label' ).to( this );
+
 		return buttonView;
 		return buttonView;
 	}
 	}
 
 
@@ -106,6 +109,8 @@ export default class SplitButtonView extends View {
 
 
 		selectView.delegate( 'execute' ).to( this, 'select' );
 		selectView.delegate( 'execute' ).to( this, 'select' );
 
 
+		selectView.bind( 'isEnabled' ).to( this );
+
 		return selectView;
 		return selectView;
 	}
 	}
 }
 }

+ 2 - 1
packages/ckeditor5-ui/src/dropdown/button/createbuttondropdown.js

@@ -56,10 +56,11 @@ export default function createButtonDropdown( model, locale ) {
 		( ...areEnabled ) => areEnabled.some( isEnabled => isEnabled )
 		( ...areEnabled ) => areEnabled.some( isEnabled => isEnabled )
 	);
 	);
 
 
-	// If defined `staticIcon` use the `defautlIcon` without binding it to active a button.
+	// If defined `staticIcon` use the `defaultIcon` without binding it to active a button.
 	if ( model.staticIcon ) {
 	if ( model.staticIcon ) {
 		model.bind( 'icon' ).to( model, 'defaultIcon' );
 		model.bind( 'icon' ).to( model, 'defaultIcon' );
 	} else {
 	} else {
+		// TODO: move to alignment
 		// Make dropdown icon as any active button.
 		// Make dropdown icon as any active button.
 		model.bind( 'icon' ).to(
 		model.bind( 'icon' ).to(
 			// Bind to #isOn of each button...
 			// Bind to #isOn of each button...

+ 2 - 0
packages/ckeditor5-ui/src/dropdown/createsplitbuttondropdown.js

@@ -21,11 +21,13 @@ export default function createSplitButtonDropdown( model, locale ) {
 
 
 	splitButtonView.bind( 'label', 'isOn', 'isEnabled', 'withText', 'keystroke', 'tooltip', 'icon' ).to( model );
 	splitButtonView.bind( 'label', 'isOn', 'isEnabled', 'withText', 'keystroke', 'tooltip', 'icon' ).to( model );
 	splitButtonView.buttonView.bind( 'isOn' ).to( model );
 	splitButtonView.buttonView.bind( 'isOn' ).to( model );
+	splitButtonView.buttonView.bind( 'tooltip' ).to( model );
 
 
 	const panelView = new DropdownPanelView( locale );
 	const panelView = new DropdownPanelView( locale );
 	const dropdownView = new SplitButtonDropdownView( locale, splitButtonView, panelView );
 	const dropdownView = new SplitButtonDropdownView( locale, splitButtonView, panelView );
 
 
 	// Extend template to hide arrow from dropdown.
 	// Extend template to hide arrow from dropdown.
+	// TODO: enable this on normal button instead of hiding it
 	dropdownView.extendTemplate( {
 	dropdownView.extendTemplate( {
 		attributes: {
 		attributes: {
 			class: 'ck-splitbutton-dropdown'
 			class: 'ck-splitbutton-dropdown'