fixes #103169
This commit is contained in:
parent
e85dccfe85
commit
f1547427ea
4 changed files with 17 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue