fixed:移除webview默认的几个右键菜单.
This commit is contained in:
parent
372114b5e2
commit
a5f14eabd0
|
@ -6,9 +6,9 @@
|
||||||
import { getActiveElement } from 'vs/base/browser/dom';
|
import { getActiveElement } from 'vs/base/browser/dom';
|
||||||
import { MultiCommand, RedoCommand, SelectAllCommand, UndoCommand } from 'vs/editor/browser/editorExtensions';
|
import { MultiCommand, RedoCommand, SelectAllCommand, UndoCommand } from 'vs/editor/browser/editorExtensions';
|
||||||
import { CopyAction, CutAction, PasteAction } from 'vs/editor/contrib/clipboard/browser/clipboard';
|
import { CopyAction, CutAction, PasteAction } from 'vs/editor/contrib/clipboard/browser/clipboard';
|
||||||
import * as nls from 'vs/nls';
|
// import * as nls from 'vs/nls';
|
||||||
import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
|
// import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
|
||||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
// import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { IWebviewService, IWebview } from 'vs/workbench/contrib/webview/browser/webview';
|
import { IWebviewService, IWebview } from 'vs/workbench/contrib/webview/browser/webview';
|
||||||
import { WebviewInput } from 'vs/workbench/contrib/webviewPanel/browser/webviewEditorInput';
|
import { WebviewInput } from 'vs/workbench/contrib/webviewPanel/browser/webviewEditorInput';
|
||||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||||
|
@ -48,38 +48,38 @@ overrideCommandForWebview(CutAction, webview => webview.cut());
|
||||||
|
|
||||||
export const PreventDefaultContextMenuItemsContextKeyName = 'preventDefaultContextMenuItems';
|
export const PreventDefaultContextMenuItemsContextKeyName = 'preventDefaultContextMenuItems';
|
||||||
|
|
||||||
if (CutAction) {
|
// if (CutAction) {
|
||||||
MenuRegistry.appendMenuItem(MenuId.WebviewContext, {
|
// MenuRegistry.appendMenuItem(MenuId.WebviewContext, {
|
||||||
command: {
|
// command: {
|
||||||
id: CutAction.id,
|
// id: CutAction.id,
|
||||||
title: nls.localize('cut', "Cut"),
|
// title: nls.localize('cut', "Cut"),
|
||||||
},
|
// },
|
||||||
group: '5_cutcopypaste',
|
// group: '5_cutcopypaste',
|
||||||
order: 1,
|
// order: 1,
|
||||||
when: ContextKeyExpr.not(PreventDefaultContextMenuItemsContextKeyName),
|
// when: ContextKeyExpr.not(PreventDefaultContextMenuItemsContextKeyName),
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (CopyAction) {
|
// if (CopyAction) {
|
||||||
MenuRegistry.appendMenuItem(MenuId.WebviewContext, {
|
// MenuRegistry.appendMenuItem(MenuId.WebviewContext, {
|
||||||
command: {
|
// command: {
|
||||||
id: CopyAction.id,
|
// id: CopyAction.id,
|
||||||
title: nls.localize('copy', "Copy"),
|
// title: nls.localize('copy', "Copy"),
|
||||||
},
|
// },
|
||||||
group: '5_cutcopypaste',
|
// group: '5_cutcopypaste',
|
||||||
order: 2,
|
// order: 2,
|
||||||
when: ContextKeyExpr.not(PreventDefaultContextMenuItemsContextKeyName),
|
// when: ContextKeyExpr.not(PreventDefaultContextMenuItemsContextKeyName),
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (PasteAction) {
|
// if (PasteAction) {
|
||||||
MenuRegistry.appendMenuItem(MenuId.WebviewContext, {
|
// MenuRegistry.appendMenuItem(MenuId.WebviewContext, {
|
||||||
command: {
|
// command: {
|
||||||
id: PasteAction.id,
|
// id: PasteAction.id,
|
||||||
title: nls.localize('paste', "Paste"),
|
// title: nls.localize('paste', "Paste"),
|
||||||
},
|
// },
|
||||||
group: '5_cutcopypaste',
|
// group: '5_cutcopypaste',
|
||||||
order: 3,
|
// order: 3,
|
||||||
when: ContextKeyExpr.not(PreventDefaultContextMenuItemsContextKeyName),
|
// when: ContextKeyExpr.not(PreventDefaultContextMenuItemsContextKeyName),
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
Loading…
Reference in New Issue