From 1bfce0a03cbbb4cc1f69e8b5d1d72244b30d6b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20H=2E=20K=C3=B6hler?= Date: Thu, 12 Sep 2024 15:34:25 -0300 Subject: [PATCH] feat(toolbar): enable extensions to change toolbar button sections (#4367) --- .../core/src/services/ToolBarService/ToolbarService.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/core/src/services/ToolBarService/ToolbarService.ts b/platform/core/src/services/ToolBarService/ToolbarService.ts index 7d80f843afe..3f8c0e85fae 100644 --- a/platform/core/src/services/ToolBarService/ToolbarService.ts +++ b/platform/core/src/services/ToolBarService/ToolbarService.ts @@ -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 }); }