提交 184e7288 编写于 作者: C Chirag Bhatia

Fixes #17701 - Integrated Terminal Context Menu is triggered via contextmenu...

Fixes #17701 - Integrated Terminal Context Menu is triggered via contextmenu event instead of mousedown
上级 c52f03cc
......@@ -26,6 +26,7 @@ export class TerminalPanel extends Panel {
private _actions: IAction[];
private _contextMenuActions: IAction[];
private _cancelContextMenu: boolean = false;
private _currentBaseThemeId: string;
private _font: ITerminalFont;
private _fontStyleElement: HTMLElement;
......@@ -159,24 +160,29 @@ export class TerminalPanel extends Panel {
} else {
terminal.paste();
}
} else {
const standardEvent = new StandardMouseEvent(event);
let anchor: { x: number, y: number } = { x: standardEvent.posx, y: standardEvent.posy };
this._contextMenuService.showContextMenu({
getAnchor: () => anchor,
getActions: () => TPromise.as(this._getContextMenuActions()),
getActionsContext: () => this._parentDomElement,
getKeyBinding: (action) => {
const [kb] = this._keybindingService.lookupKeybindings(action.id);
if (kb) {
return kb;
}
return null;
}
});
this._cancelContextMenu = true;
}
}
}));
this._register(DOM.addDisposableListener(this._parentDomElement, 'contextmenu', (event: MouseEvent) => {
if (!this._cancelContextMenu) {
const standardEvent = new StandardMouseEvent(event);
let anchor: { x: number, y: number } = { x: standardEvent.posx, y: standardEvent.posy };
this._contextMenuService.showContextMenu({
getAnchor: () => anchor,
getActions: () => TPromise.as(this._getContextMenuActions()),
getActionsContext: () => this._parentDomElement,
getKeyBinding: (action) => {
const [kb] = this._keybindingService.lookupKeybindings(action.id);
if (kb) {
return kb;
}
return null;
}
});
}
this._cancelContextMenu = false;
}));
this._register(DOM.addDisposableListener(this._parentDomElement, 'click', (event) => {
if (this._terminalService.terminalInstances.length === 0) {
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册