Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
427b3bbe
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
427b3bbe
编写于
2月 14, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move webview keybindings to own file
上级
7a7e566e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
59 addition
and
45 deletion
+59
-45
src/vs/workbench/parts/html/browser/html.contribution.ts
src/vs/workbench/parts/html/browser/html.contribution.ts
+2
-0
src/vs/workbench/parts/html/browser/webview.contribution.ts
src/vs/workbench/parts/html/browser/webview.contribution.ts
+53
-0
src/vs/workbench/parts/html/browser/webviewEditor.ts
src/vs/workbench/parts/html/browser/webviewEditor.ts
+4
-45
未找到文件。
src/vs/workbench/parts/html/browser/html.contribution.ts
浏览文件 @
427b3bbe
...
...
@@ -20,6 +20,8 @@ import { MenuRegistry } from 'vs/platform/actions/common/actions';
import
{
IExtensionsWorkbenchService
}
from
'
vs/workbench/parts/extensions/common/extensions
'
;
import
{
IEditorRegistry
,
EditorDescriptor
,
Extensions
as
EditorExtensions
}
from
'
vs/workbench/browser/editor
'
;
import
'
./webview.contribution
'
;
function
getActivePreviewsForResource
(
accessor
:
ServicesAccessor
,
resource
:
URI
|
string
)
{
const
uri
=
resource
instanceof
URI
?
resource
:
URI
.
parse
(
resource
);
return
accessor
.
get
(
IWorkbenchEditorService
).
getVisibleEditors
()
...
...
src/vs/workbench/parts/html/browser/webview.contribution.ts
0 → 100644
浏览文件 @
427b3bbe
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
ContextKeyExpr
,
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
as
ActionExtensions
}
from
'
vs/workbench/common/actions
'
;
import
{
KEYBINDING_CONTEXT_WEBVIEWEDITOR_FIND_WIDGET_INPUT_FOCUSED
,
ShowWebViewEditorFindTermCommand
,
KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS
,
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE
,
HideWebViewEditorFindCommand
,
ShowWebViewEditorFindWidgetAction
}
from
'
./webviewEditor
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
const
category
=
'
Webview
'
;
const
actionRegistry
=
<
IWorkbenchActionRegistry
>
Registry
.
as
(
ActionExtensions
.
WorkbenchActions
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ShowWebViewEditorFindWidgetAction
,
ShowWebViewEditorFindWidgetAction
.
ID
,
ShowWebViewEditorFindWidgetAction
.
LABEL
,
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_F
},
KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS
),
'
Webview: Focus Find Widget
'
,
category
);
const
showNextFindTermCommand
=
new
ShowWebViewEditorFindTermCommand
({
id
:
'
editor.action.webvieweditor.showNextFindTerm
'
,
precondition
:
KEYBINDING_CONTEXT_WEBVIEWEDITOR_FIND_WIDGET_INPUT_FOCUSED
,
kbOpts
:
{
primary
:
KeyMod
.
Alt
|
KeyCode
.
DownArrow
}
},
true
);
KeybindingsRegistry
.
registerCommandAndKeybindingRule
(
showNextFindTermCommand
.
toCommandAndKeybindingRule
(
KeybindingsRegistry
.
WEIGHT
.
editorContrib
()));
const
showPreviousFindTermCommand
=
new
ShowWebViewEditorFindTermCommand
({
id
:
'
editor.action.webvieweditor.showPreviousFindTerm
'
,
precondition
:
KEYBINDING_CONTEXT_WEBVIEWEDITOR_FIND_WIDGET_INPUT_FOCUSED
,
kbOpts
:
{
primary
:
KeyMod
.
Alt
|
KeyCode
.
UpArrow
}
},
false
);
KeybindingsRegistry
.
registerCommandAndKeybindingRule
(
showPreviousFindTermCommand
.
toCommandAndKeybindingRule
(
KeybindingsRegistry
.
WEIGHT
.
editorContrib
()));
const
hideCommand
=
new
HideWebViewEditorFindCommand
({
id
:
'
editor.action.webvieweditor.hideFind
'
,
precondition
:
ContextKeyExpr
.
and
(
KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS
,
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE
),
kbOpts
:
{
primary
:
KeyCode
.
Escape
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
(
hideCommand
.
toCommandAndKeybindingRule
(
KeybindingsRegistry
.
WEIGHT
.
editorContrib
()));
src/vs/workbench/parts/html/browser/webviewEditor.ts
浏览文件 @
427b3bbe
...
...
@@ -12,15 +12,10 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
Command
,
ICommandOptions
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
ContextKeyExpr
,
IContextKey
,
RawContextKey
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
IContextKey
,
RawContextKey
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
Webview
}
from
'
./webview
'
;
import
{
Builder
}
from
'
vs/base/browser/builder
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
as
ActionExtensions
}
from
'
vs/workbench/common/actions
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
...
...
@@ -98,7 +93,7 @@ export abstract class WebviewEditor extends BaseWebviewEditor {
protected
abstract
createEditor
(
parent
:
Builder
):
void
;
}
class
ShowWebViewEditorFindWidgetAction
extends
Action
{
export
class
ShowWebViewEditorFindWidgetAction
extends
Action
{
public
static
readonly
ID
=
'
editor.action.webvieweditor.showFind
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
editor.action.webvieweditor.showFind
'
,
"
Focus Find Widget
"
);
...
...
@@ -127,15 +122,7 @@ class ShowWebViewEditorFindWidgetAction extends Action {
}
}
const
category
=
'
Webview
'
;
let
actionRegistry
=
<
IWorkbenchActionRegistry
>
Registry
.
as
(
ActionExtensions
.
WorkbenchActions
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ShowWebViewEditorFindWidgetAction
,
ShowWebViewEditorFindWidgetAction
.
ID
,
ShowWebViewEditorFindWidgetAction
.
LABEL
,
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_F
},
KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS
),
'
Webview: Focus Find Widget
'
,
category
);
class
HideWebViewEditorFindCommand
extends
Command
{
export
class
HideWebViewEditorFindCommand
extends
Command
{
public
runCommand
(
accessor
:
ServicesAccessor
,
args
:
any
):
void
{
const
webViewEditor
=
this
.
getWebViewEditor
(
accessor
);
if
(
webViewEditor
)
{
...
...
@@ -151,18 +138,8 @@ class HideWebViewEditorFindCommand extends Command {
return
null
;
}
}
const
hideCommand
=
new
HideWebViewEditorFindCommand
({
id
:
'
editor.action.webvieweditor.hideFind
'
,
precondition
:
ContextKeyExpr
.
and
(
KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS
,
KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE
),
kbOpts
:
{
primary
:
KeyCode
.
Escape
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
(
hideCommand
.
toCommandAndKeybindingRule
(
KeybindingsRegistry
.
WEIGHT
.
editorContrib
()));
class
ShowWebViewEditorFindTermCommand
extends
Command
{
export
class
ShowWebViewEditorFindTermCommand
extends
Command
{
constructor
(
opts
:
ICommandOptions
,
private
_next
:
boolean
)
{
super
(
opts
);
}
...
...
@@ -186,21 +163,3 @@ class ShowWebViewEditorFindTermCommand extends Command {
return
null
;
}
}
const
showNextFindTermCommand
=
new
ShowWebViewEditorFindTermCommand
({
id
:
'
editor.action.webvieweditor.showNextFindTerm
'
,
precondition
:
KEYBINDING_CONTEXT_WEBVIEWEDITOR_FIND_WIDGET_INPUT_FOCUSED
,
kbOpts
:
{
primary
:
KeyMod
.
Alt
|
KeyCode
.
DownArrow
}
},
true
);
KeybindingsRegistry
.
registerCommandAndKeybindingRule
(
showNextFindTermCommand
.
toCommandAndKeybindingRule
(
KeybindingsRegistry
.
WEIGHT
.
editorContrib
()));
const
showPreviousFindTermCommand
=
new
ShowWebViewEditorFindTermCommand
({
id
:
'
editor.action.webvieweditor.showPreviousFindTerm
'
,
precondition
:
KEYBINDING_CONTEXT_WEBVIEWEDITOR_FIND_WIDGET_INPUT_FOCUSED
,
kbOpts
:
{
primary
:
KeyMod
.
Alt
|
KeyCode
.
UpArrow
}
},
false
);
KeybindingsRegistry
.
registerCommandAndKeybindingRule
(
showPreviousFindTermCommand
.
toCommandAndKeybindingRule
(
KeybindingsRegistry
.
WEIGHT
.
editorContrib
()));
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录