mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-01 09:35:41 -05:00
Merge from vscode 79a1f5a5ca0c6c53db617aa1fa5a2396d2caebe2
This commit is contained in:
@@ -9,9 +9,9 @@
|
||||
|
||||
.context-view-block {
|
||||
position: fixed;
|
||||
cursor: initial;
|
||||
left:0;
|
||||
top:0;
|
||||
z-index: -1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ 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 { EventType, $, removeNode } from 'vs/base/browser/dom';
|
||||
import { EventType, $, removeNode, isHTMLElement } from 'vs/base/browser/dom';
|
||||
import { attachMenuStyler } from 'vs/platform/theme/common/styler';
|
||||
import { domEvent } from 'vs/base/browser/event';
|
||||
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
@@ -50,6 +50,7 @@ export class ContextMenuHandler {
|
||||
|
||||
let menu: Menu | undefined;
|
||||
|
||||
const anchor = delegate.getAnchor();
|
||||
this.contextViewService.showContextView({
|
||||
getAnchor: () => delegate.getAnchor(),
|
||||
canRelayout: false,
|
||||
@@ -65,6 +66,7 @@ export class ContextMenuHandler {
|
||||
// Render invisible div to block mouse interaction in the rest of the UI
|
||||
if (this.options.blockMouse) {
|
||||
this.block = container.appendChild($('.context-view-block'));
|
||||
domEvent(this.block, EventType.MOUSE_DOWN)((e: MouseEvent) => e.stopPropagation());
|
||||
}
|
||||
|
||||
const menuDisposables = new DisposableStore();
|
||||
@@ -131,7 +133,7 @@ export class ContextMenuHandler {
|
||||
this.focusToReturn.focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, !!delegate.anchorAsContainer && isHTMLElement(anchor) ? anchor : undefined);
|
||||
}
|
||||
|
||||
private onActionRun(e: IRunEvent): void {
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface IContextViewService extends IContextViewProvider {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
|
||||
showContextView(delegate: IContextViewDelegate): void;
|
||||
showContextView(delegate: IContextViewDelegate, container?: HTMLElement): void;
|
||||
hideContextView(data?: any): void;
|
||||
layout(): void;
|
||||
anchorAlignment?: AnchorAlignment;
|
||||
|
||||
@@ -12,13 +12,15 @@ export class ContextViewService extends Disposable implements IContextViewServic
|
||||
_serviceBrand: undefined;
|
||||
|
||||
private contextView: ContextView;
|
||||
private container: HTMLElement;
|
||||
|
||||
constructor(
|
||||
@ILayoutService readonly layoutService: ILayoutService
|
||||
) {
|
||||
super();
|
||||
|
||||
this.contextView = this._register(new ContextView(layoutService.container));
|
||||
this.container = layoutService.container;
|
||||
this.contextView = this._register(new ContextView(this.container, false));
|
||||
this.layout();
|
||||
|
||||
this._register(layoutService.onLayout(() => this.layout()));
|
||||
@@ -26,11 +28,24 @@ export class ContextViewService extends Disposable implements IContextViewServic
|
||||
|
||||
// ContextView
|
||||
|
||||
setContainer(container: HTMLElement): void {
|
||||
this.contextView.setContainer(container);
|
||||
setContainer(container: HTMLElement, useFixedPosition?: boolean): void {
|
||||
this.contextView.setContainer(container, !!useFixedPosition);
|
||||
}
|
||||
|
||||
showContextView(delegate: IContextViewDelegate): void {
|
||||
showContextView(delegate: IContextViewDelegate, container?: HTMLElement): void {
|
||||
|
||||
if (container) {
|
||||
if (container !== this.container) {
|
||||
this.container = container;
|
||||
this.setContainer(container, true);
|
||||
}
|
||||
} else {
|
||||
if (this.container !== this.layoutService.container) {
|
||||
this.container = this.layoutService.container;
|
||||
this.setContainer(this.container, false);
|
||||
}
|
||||
}
|
||||
|
||||
this.contextView.show(delegate);
|
||||
}
|
||||
|
||||
@@ -41,4 +56,4 @@ export class ContextViewService extends Disposable implements IContextViewServic
|
||||
hideContextView(data?: any): void {
|
||||
this.contextView.hide(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user