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
  • Loading branch information
sophiali23 committed Dec 11, 2024
1 parent f6d6da0 commit 9347773
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 9347773

Please # to comment.