提交 f1547427 编写于 作者: S SteVen Batten

fixes #103169

上级 e85dccfe
......@@ -216,6 +216,10 @@ export class ContextView extends Disposable {
}
}
getViewElement(): HTMLElement {
return this.view;
}
layout(): void {
if (!this.isVisible()) {
return;
......
......@@ -49,7 +49,14 @@ export class ContextMenuController implements IEditorContribution {
this._toDispose.add(this._editor.onContextMenu((e: IEditorMouseEvent) => this._onContextMenu(e)));
this._toDispose.add(this._editor.onMouseWheel((e: IMouseWheelEvent) => {
if (this._contextMenuIsBeingShownCount > 0) {
this._contextViewService.hideContextView();
const view = this._contextViewService.getContextViewElement();
const target = e.srcElement as HTMLElement;
// Event triggers on shadow root host first
// Check if the context view is under this host before hiding it #103169
if (!(target.shadowRoot && dom.getShadowRoot(view) === target.shadowRoot)) {
this._contextViewService.hideContextView();
}
}
}));
this._toDispose.add(this._editor.onKeyDown((e: IKeyboardEvent) => {
......
......@@ -17,6 +17,7 @@ export interface IContextViewService extends IContextViewProvider {
showContextView(delegate: IContextViewDelegate, container?: HTMLElement, shadowRoot?: boolean): IDisposable;
hideContextView(data?: any): void;
getContextViewElement(): HTMLElement;
layout(): void;
anchorAlignment?: AnchorAlignment;
}
......
......@@ -58,6 +58,10 @@ export class ContextViewService extends Disposable implements IContextViewServic
return disposable;
}
getContextViewElement(): HTMLElement {
return this.contextView.getViewElement();
}
layout(): void {
this.contextView.layout();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册