From 934777390cfee400fe1e241016cd721710944745 Mon Sep 17 00:00:00 2001 From: Sophia Li Date: Wed, 11 Dec 2024 15:52:57 -0500 Subject: [PATCH] Updated isEnabled condition of collapse panel command so it's disabled when panel is collapsed --- packages/core/src/browser/common-frontend-contribution.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/src/browser/common-frontend-contribution.ts b/packages/core/src/browser/common-frontend-contribution.ts index a1bb4f383ac31..4368376590f08 100644 --- a/packages/core/src/browser/common-frontend-contribution.ts +++ b/packages/core/src/browser/common-frontend-contribution.ts @@ -924,7 +924,13 @@ export class CommonFrontendContribution implements FrontendApplicationContributi execute: () => this.shell.closeTabs('main', title => title.closable) }); commandRegistry.registerCommand(CommonCommands.COLLAPSE_PANEL, new CurrentWidgetCommandAdapter(this.shell, { - isEnabled: (_title, tabbar) => Boolean(tabbar && ApplicationShell.isSideArea(this.shell.getAreaFor(tabbar))), + isEnabled: (_title, tabbar) => { + if (tabbar) { + const area = this.shell.getAreaFor(tabbar); + return ApplicationShell.isSideArea(area) && this.shell.isExpanded(area); + } + return false; + }, isVisible: (_title, tabbar) => Boolean(tabbar && ApplicationShell.isSideArea(this.shell.getAreaFor(tabbar))), execute: (_title, tabbar) => tabbar && this.shell.collapsePanel(this.shell.getAreaFor(tabbar)!) }));