提交 627e7e97 编写于 作者: S SteVen Batten

refs Microsoft/monaco-editor#1357

上级 27a1eff1
......@@ -665,5 +665,9 @@ export class SimpleLayoutService implements ILayoutService {
return this._container;
}
get hasWorkbench(): boolean {
return false;
}
constructor(private _container: HTMLElement) { }
}
......@@ -16,9 +16,10 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IContextMenuDelegate } from 'vs/base/browser/contextmenu';
import { addDisposableListener, EventType, $ } from 'vs/base/browser/dom';
import { addDisposableListener, EventType, $, removeNode } from 'vs/base/browser/dom';
import { attachMenuStyler } from 'vs/platform/theme/common/styler';
import { domEvent } from 'vs/base/browser/event';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
export class ContextMenuHandler {
private element: HTMLElement | null;
......@@ -28,14 +29,14 @@ export class ContextMenuHandler {
private block: HTMLElement | null;
constructor(
element: HTMLElement | null,
private layoutService: ILayoutService,
private contextViewService: IContextViewService,
private telemetryService: ITelemetryService,
private notificationService: INotificationService,
private keybindingService: IKeybindingService,
private themeService: IThemeService
) {
this.setContainer(element);
this.setContainer(this.layoutService.container);
}
setContainer(container: HTMLElement | null): void {
......@@ -75,7 +76,9 @@ export class ContextMenuHandler {
}
// Render invisible div to block mouse interaction in the rest of the UI
this.block = container.appendChild($('.context-view-block'));
if (this.layoutService.hasWorkbench) {
this.block = container.appendChild($('.context-view-block'));
}
const menuDisposables: IDisposable[] = [];
......@@ -110,7 +113,7 @@ export class ContextMenuHandler {
}
if (this.block) {
this.block.remove();
removeNode(this.block);
this.block = null;
}
......
......@@ -32,7 +32,7 @@ export class ContextMenuService extends Disposable implements IContextMenuServic
) {
super();
this.contextMenuHandler = this._register(new ContextMenuHandler(layoutService.container, contextViewService, telemetryService, notificationService, keybindingService, themeService));
this.contextMenuHandler = this._register(new ContextMenuHandler(layoutService, contextViewService, telemetryService, notificationService, keybindingService, themeService));
}
dispose(): void {
......
......@@ -32,4 +32,10 @@ export interface ILayoutService {
* event carries the dimensions of the container as part of it.
*/
readonly onLayout: Event<IDimension>;
/**
* Indicates if the layout has a workbench surrounding the editor
*/
readonly hasWorkbench: boolean;
}
\ No newline at end of file
......@@ -483,6 +483,8 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService {
get container(): HTMLElement { return this.workbench; }
get hasWorkbench(): boolean { return true; }
private parts: Map<string, Part> = new Map<string, Part>();
private workbenchGrid: Grid<View> | WorkbenchLegacyLayout;
......
......@@ -505,6 +505,10 @@ export class TestLayoutService implements IWorkbenchLayoutService {
return false;
}
public get hasWorkbench(): boolean {
return true;
}
public setEditorHidden(_hidden: boolean): Promise<void> { return Promise.resolve(); }
public setSideBarHidden(_hidden: boolean): Promise<void> { return Promise.resolve(); }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册