feat(toolbar): enable extensions to change toolbar button sections (#4367)

This commit is contained in:
Pedro H. Köhler 2024-09-12 15:34:25 -03:00 committed by GitHub
parent c08debd65a
commit 1bfce0a03c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -374,8 +374,11 @@ export default class ToolbarService extends PubSubService {
* @param {Array} buttons - The buttons to be added to the section.
*/
createButtonSection(key, buttons) {
// make sure all buttons have at least an empty props
this.state.buttonSections[key] = buttons;
if (this.state.buttonSections[key]) {
this.state.buttonSections[key].push(...buttons);
} else {
this.state.buttonSections[key] = buttons;
}
this._broadcastEvent(this.EVENTS.TOOL_BAR_MODIFIED, { ...this.state });
}