Skip to content

Commit

Permalink
Collapse panel on toggle view
Browse files Browse the repository at this point in the history
Signed-off-by: Miro Spönemann <miro.spoenemann@typefox.io>
  • Loading branch information
spoenemann committed Jan 24, 2020
1 parent 8d69ddd commit c613380
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/core/src/browser/shell/view-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,23 @@ export abstract class AbstractViewContribution<T extends Widget> implements Comm
};
await shell.addWidget(widget, widgetArgs);
} else if (args.toggle && area && shell.isExpanded(area) && tabBar.currentTitle === widget.title) {
// The widget is attached and visible, so close it (toggle)
await this.closeView();
// The widget is attached and visible, so collapse the containing panel (toggle)
switch (area) {
case 'left':
case 'right':
shell.collapsePanel(area);
break;
case 'bottom':
// Don't collapse the bottom panel if it's currently split
if (shell.bottomAreaTabBars.length === 1) {
shell.collapsePanel('bottom');
}
break;
default:
// The main area cannot be collapsed, so close the widget
await this.closeView();
}
return this.widget;
}
if (widget.isAttached && args.activate) {
await shell.activateWidget(this.viewId);
Expand Down

0 comments on commit c613380

Please sign in to comment.