mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-29 09:09:03 +01:00
Hide webview view icons when the view is collapsed (#188204)
Follow up on #185864 Otherwise always show them when the view is visible
This commit is contained in:
@@ -15,7 +15,8 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.monaco-pane-view .pane > .pane-header > .actions.show {
|
||||
.monaco-pane-view .pane > .pane-header > .actions.show-always,
|
||||
.monaco-pane-view .pane.expanded > .pane-header > .actions.show-expanded {
|
||||
display: initial;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,11 +47,22 @@ import { BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { defaultButtonStyles, defaultProgressBarStyles } from 'vs/platform/theme/browser/defaultStyles';
|
||||
|
||||
export enum ViewPaneShowActions {
|
||||
/** Show the actions when the view is hovered. This is the default behavior. */
|
||||
Default,
|
||||
|
||||
/** Always shows the actions when the view is expanded */
|
||||
WhenExpanded,
|
||||
|
||||
/** Always shows the actions */
|
||||
Always,
|
||||
}
|
||||
|
||||
export interface IViewPaneOptions extends IPaneOptions {
|
||||
id: string;
|
||||
showActionsAlways?: boolean;
|
||||
titleMenuId?: MenuId;
|
||||
donotForwardArgs?: boolean;
|
||||
readonly id: string;
|
||||
readonly showActions?: ViewPaneShowActions;
|
||||
readonly titleMenuId?: MenuId;
|
||||
readonly donotForwardArgs?: boolean;
|
||||
}
|
||||
|
||||
export interface IFilterViewPaneOptions extends IViewPaneOptions {
|
||||
@@ -188,7 +199,7 @@ export abstract class ViewPane extends Pane implements IView {
|
||||
private progressIndicator!: IProgressIndicator;
|
||||
|
||||
private toolbar?: WorkbenchToolBar;
|
||||
private readonly showActionsAlways: boolean = false;
|
||||
private readonly showActions: ViewPaneShowActions;
|
||||
private headerContainer?: HTMLElement;
|
||||
private titleContainer?: HTMLElement;
|
||||
private titleDescriptionContainer?: HTMLElement;
|
||||
@@ -219,7 +230,7 @@ export abstract class ViewPane extends Pane implements IView {
|
||||
this.id = options.id;
|
||||
this._title = options.title;
|
||||
this._titleDescription = options.titleDescription;
|
||||
this.showActionsAlways = !!options.showActionsAlways;
|
||||
this.showActions = options.showActions ?? ViewPaneShowActions.Default;
|
||||
|
||||
this.scopedContextKeyService = this._register(contextKeyService.createScoped(this.element));
|
||||
this.scopedContextKeyService.createKey('view', this.id);
|
||||
@@ -288,7 +299,8 @@ export abstract class ViewPane extends Pane implements IView {
|
||||
this.renderHeaderTitle(container, this.title);
|
||||
|
||||
const actions = append(container, $('.actions'));
|
||||
actions.classList.toggle('show', this.showActionsAlways);
|
||||
actions.classList.toggle('show-always', this.showActions === ViewPaneShowActions.Always);
|
||||
actions.classList.toggle('show-expanded', this.showActions === ViewPaneShowActions.WhenExpanded);
|
||||
this.toolbar = this.instantiationService.createInstance(WorkbenchToolBar, actions, {
|
||||
orientation: ActionsOrientation.HORIZONTAL,
|
||||
actionViewItemProvider: action => this.getActionViewItem(action),
|
||||
|
||||
@@ -29,7 +29,7 @@ import { ManageExtensionAction, getContextMenuActions, ExtensionAction } from 'v
|
||||
import { WorkbenchPagedList } from 'vs/platform/list/browser/listService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPane';
|
||||
import { ViewPane, IViewPaneOptions, ViewPaneShowActions } from 'vs/workbench/browser/parts/views/viewPane';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { coalesce, distinct, flatten } from 'vs/base/common/arrays';
|
||||
import { alert } from 'vs/base/browser/ui/aria/aria';
|
||||
@@ -150,7 +150,7 @@ export class ExtensionsListView extends ViewPane {
|
||||
) {
|
||||
super({
|
||||
...(viewletViewOptions as IViewPaneOptions),
|
||||
showActionsAlways: true,
|
||||
showActions: ViewPaneShowActions.Always,
|
||||
maximumBodySize: options.flexibleHeight ? (storageService.getNumber(`${viewletViewOptions.id}.size`, StorageScope.PROFILE, 0) ? undefined : 0) : undefined
|
||||
}, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
||||
if (this.options.onDidChangeTitle) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import { IProgressService } from 'vs/platform/progress/common/progress';
|
||||
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { ViewPane } from 'vs/workbench/browser/parts/views/viewPane';
|
||||
import { ViewPane, ViewPaneShowActions } from 'vs/workbench/browser/parts/views/viewPane';
|
||||
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
import { Memento, MementoObject } from 'vs/workbench/common/memento';
|
||||
import { IViewBadge, IViewDescriptorService, IViewsService } from 'vs/workbench/common/views';
|
||||
@@ -84,7 +84,7 @@ export class WebviewViewPane extends ViewPane {
|
||||
@IWebviewService private readonly webviewService: IWebviewService,
|
||||
@IWebviewViewService private readonly webviewViewService: IWebviewViewService,
|
||||
) {
|
||||
super({ ...options, titleMenuId: MenuId.ViewTitle, showActionsAlways: true }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
||||
super({ ...options, titleMenuId: MenuId.ViewTitle, showActions: ViewPaneShowActions.WhenExpanded }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
||||
this.extensionId = options.fromExtensionId;
|
||||
this.defaultTitle = this.title;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user