提交 d06956dd 编写于 作者: I isidor

editor: allow editor action descriptor to pass in a KbExpr

上级 cd6d41ce
...@@ -27,6 +27,7 @@ export enum ContextKey { ...@@ -27,6 +27,7 @@ export enum ContextKey {
export interface IEditorActionKeybindingOptions extends IKeybindings { export interface IEditorActionKeybindingOptions extends IKeybindings {
handler?: ICommandHandler; handler?: ICommandHandler;
context: ContextKey; context: ContextKey;
kbExpr?: KbExpr;
} }
export interface IEditorCommandKeybindingOptions extends IKeybindings { export interface IEditorCommandKeybindingOptions extends IKeybindings {
context: ContextKey; context: ContextKey;
...@@ -177,10 +178,14 @@ class EditorContributionRegistry { ...@@ -177,10 +178,14 @@ class EditorContributionRegistry {
} }
var context: KbExpr = null; var context: KbExpr = null;
if (desc.kbOpts.context === ContextKey.EditorTextFocus) { if (typeof desc.kbOpts.kbExpr === 'undefined') {
context = KbExpr.has(EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS); if (desc.kbOpts.context === ContextKey.EditorTextFocus) {
} else if (desc.kbOpts.context === ContextKey.EditorFocus) { context = KbExpr.has(EditorCommon.KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS);
context = KbExpr.has(EditorCommon.KEYBINDING_CONTEXT_EDITOR_FOCUS); } else if (desc.kbOpts.context === ContextKey.EditorFocus) {
context = KbExpr.has(EditorCommon.KEYBINDING_CONTEXT_EDITOR_FOCUS);
}
} else {
context = desc.kbOpts.kbExpr;
} }
var commandDesc: ICommandDescriptor = { var commandDesc: ICommandDescriptor = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册