Skip to content

Commit

Permalink
Updated isEnabled condition of collapse panel command so it's disable…
Browse files Browse the repository at this point in the history
…d when panel is collapsed (#14616)
  • Loading branch information
sophiali23 authored Dec 12, 2024
1 parent 04dfd9b commit 60cbc71
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/core/src/browser/common-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)!)
}));
Expand Down

0 comments on commit 60cbc71

Please sign in to comment.