fix(ToolbarRow): Update ToolbarRow so that an activeButton in a submenu is passed in as an activeCom (#668)
This commit is contained in:
parent
7bc9b45853
commit
3d425f54cc
@ -156,10 +156,17 @@ class ToolbarRow extends Component {
|
|||||||
*/
|
*/
|
||||||
function _getButtonComponents(toolbarButtons, activeButtons) {
|
function _getButtonComponents(toolbarButtons, activeButtons) {
|
||||||
return toolbarButtons.map((button, index) => {
|
return toolbarButtons.map((button, index) => {
|
||||||
|
let activeCommand = undefined;
|
||||||
|
|
||||||
if (button.buttons && button.buttons.length) {
|
if (button.buttons && button.buttons.length) {
|
||||||
// Iterate over button definitions and update `onClick` behavior
|
// Iterate over button definitions and update `onClick` behavior
|
||||||
const childButtons = button.buttons.map(childButton => {
|
const childButtons = button.buttons.map(childButton => {
|
||||||
childButton.onClick = _handleToolbarButtonClick.bind(this, childButton);
|
childButton.onClick = _handleToolbarButtonClick.bind(this, childButton);
|
||||||
|
|
||||||
|
if (activeButtons.indexOf(childButton.id) > -1) {
|
||||||
|
activeCommand = childButton.id;
|
||||||
|
}
|
||||||
|
|
||||||
return childButton;
|
return childButton;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -169,6 +176,7 @@ function _getButtonComponents(toolbarButtons, activeButtons) {
|
|||||||
text={button.label}
|
text={button.label}
|
||||||
icon={button.icon}
|
icon={button.icon}
|
||||||
buttons={childButtons}
|
buttons={childButtons}
|
||||||
|
activeCommand={activeCommand}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user