Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
37b338db
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
37b338db
编写于
6月 17, 2018
作者:
S
SteVen Batten
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
switching to accessKey, way cleaner
上级
11c186f1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
29 deletion
+9
-29
src/vs/base/browser/ui/actionbar/actionbar.ts
src/vs/base/browser/ui/actionbar/actionbar.ts
+4
-10
src/vs/workbench/browser/parts/menubar/menubarPart.ts
src/vs/workbench/browser/parts/menubar/menubarPart.ts
+5
-19
未找到文件。
src/vs/base/browser/ui/actionbar/actionbar.ts
浏览文件 @
37b338db
...
...
@@ -17,7 +17,7 @@ import * as DOM from 'vs/base/browser/dom';
import
*
as
types
from
'
vs/base/common/types
'
;
import
{
EventType
,
Gesture
}
from
'
vs/base/browser/touch
'
;
import
{
StandardKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
KeyCode
,
KeyMod
,
KeyCodeUtils
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyCode
,
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
IContextViewProvider
}
from
'
vs/base/browser/ui/contextview/contextview
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
...
...
@@ -380,10 +380,6 @@ export class ActionBar implements IActionRunner {
// Items
public
items
:
IActionItem
[];
private
mnemonics
:
{
[
index
:
number
]:
IAction
;
}
=
{};
private
focusedItem
:
number
;
private
focusTracker
:
DOM
.
IFocusTracker
;
...
...
@@ -457,8 +453,6 @@ export class ActionBar implements IActionRunner {
this
.
focusNext
();
}
else
if
(
event
.
equals
(
KeyCode
.
Escape
))
{
this
.
cancel
();
}
else
if
(
this
.
mnemonics
[
event
.
keyCode
])
{
this
.
run
(
this
.
mnemonics
[
event
.
keyCode
]);
}
else
if
(
event
.
equals
(
KeyCode
.
Enter
)
||
event
.
equals
(
KeyCode
.
Space
))
{
// Nothing, just staying out of the else branch
}
else
{
...
...
@@ -571,12 +565,12 @@ export class ActionBar implements IActionRunner {
return
this
.
domNode
;
}
private
_addMnemonic
(
action
:
IAction
):
void
{
private
_addMnemonic
(
action
:
IAction
,
actionItemElement
:
HTMLElement
):
void
{
let
matches
=
BaseActionItem
.
MNEMONIC_REGEX
.
exec
(
action
.
label
);
if
(
matches
&&
matches
.
length
===
2
)
{
let
mnemonic
=
matches
[
1
];
this
.
mnemonics
[
KeyCodeUtils
.
fromString
(
mnemonic
)]
=
action
;
actionItemElement
.
accessKey
=
mnemonic
.
toLocaleLowerCase
()
;
}
}
...
...
@@ -597,7 +591,7 @@ export class ActionBar implements IActionRunner {
e
.
stopPropagation
();
});
this
.
_addMnemonic
(
action
);
this
.
_addMnemonic
(
action
,
actionItemElement
);
let
item
:
IActionItem
=
null
;
...
...
src/vs/workbench/browser/parts/menubar/menubarPart.ts
浏览文件 @
37b338db
...
...
@@ -14,7 +14,7 @@ import { IMenubarService, IMenubarMenu, IMenubarMenuItemAction, IMenubarData } f
import
{
IMenuService
,
MenuId
,
IMenu
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IWindowService
,
MenuBarVisibility
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IContextKeyService
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ActionRunner
,
IActionRunner
,
IAction
}
from
'
vs/base/common/actions
'
;
import
{
Builder
,
$
}
from
'
vs/base/browser/builder
'
;
import
{
Separator
,
ActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
...
...
@@ -23,10 +23,8 @@ import { TITLE_BAR_ACTIVE_BACKGROUND, TITLE_BAR_ACTIVE_FOREGROUND } from 'vs/wor
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
isWindows
,
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
Menu
,
IMenuOptions
}
from
'
vs/base/browser/ui/menu/menu
'
;
import
{
KeyCode
,
KeyCodeUtils
,
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
StandardKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IConfigurationService
,
IConfigurationChangeEvent
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
...
...
@@ -291,20 +289,8 @@ export class MenubarPart extends Part {
}
}
private
registerMnemonic
(
menuIndex
:
number
,
keyCode
:
KeyCode
):
void
{
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
menubar.mnemonics.
'
+
menuIndex
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
ContextKeyExpr
.
has
(
'
config.window.enableMenuBarMnemonics
'
),
primary
:
null
,
win
:
{
primary
:
KeyMod
.
Alt
|
keyCode
},
handler
:
(
accessor
,
resource
:
URI
|
object
)
=>
{
if
(
!
this
.
focusedMenu
)
{
this
.
isFocused
=
true
;
this
.
toggleCustomMenu
(
menuIndex
);
}
}
});
private
registerMnemonic
(
topLevelElement
:
HTMLElement
,
mnemonic
:
string
):
void
{
topLevelElement
.
accessKey
=
mnemonic
.
toLocaleLowerCase
();
}
private
setCheckedStatus
(
action
:
IAction
|
IMenubarMenuItemAction
)
{
...
...
@@ -384,7 +370,7 @@ export class MenubarPart extends Part {
let
mnemonic
=
(
/&&
(
.
)
/g
).
exec
(
this
.
topLevelTitles
[
menuTitle
])[
1
];
if
(
mnemonic
)
{
this
.
registerMnemonic
(
menuIndex
,
KeyCodeUtils
.
fromString
(
mnemonic
)
);
this
.
registerMnemonic
(
titleElement
.
getHTMLElement
(),
mnemonic
);
}
this
.
customMenus
.
push
({
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录