Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a4207f77
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,发现更多精彩内容 >>
未验证
提交
a4207f77
编写于
3月 26, 2020
作者:
B
Benjamin Pasero
提交者:
GitHub
3月 26, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
web - allow to contribute navigation entries (#93467)
上级
12bdf225
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
42 addition
and
32 deletion
+42
-32
src/vs/base/browser/ui/menu/menubar.ts
src/vs/base/browser/ui/menu/menubar.ts
+5
-3
src/vs/platform/actions/common/actions.ts
src/vs/platform/actions/common/actions.ts
+1
-1
src/vs/workbench/api/common/menusExtensionPoint.ts
src/vs/workbench/api/common/menusExtensionPoint.ts
+2
-0
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
+34
-28
未找到文件。
src/vs/base/browser/ui/menu/menubar.ts
浏览文件 @
a4207f77
...
...
@@ -32,6 +32,7 @@ export interface IMenuBarOptions {
getKeybinding
?:
(
action
:
IAction
)
=>
ResolvedKeybinding
|
undefined
;
alwaysOnMnemonics
?:
boolean
;
compactMode
?:
Direction
;
getCompactMenuActions
?:
()
=>
IAction
[]
}
export
interface
MenuBarMenu
{
...
...
@@ -91,7 +92,7 @@ export class MenuBar extends Disposable {
private
menuStyle
:
IMenuStyles
|
undefined
;
private
overflowLayoutScheduled
:
IDisposable
|
undefined
=
undefined
;
constructor
(
private
container
:
HTMLElement
,
private
options
:
IMenuBarOptions
=
{}
,
private
compactMenuActions
?:
IAction
[]
)
{
constructor
(
private
container
:
HTMLElement
,
private
options
:
IMenuBarOptions
=
{})
{
super
();
this
.
container
.
setAttribute
(
'
role
'
,
'
menubar
'
);
...
...
@@ -492,9 +493,10 @@ export class MenuBar extends Disposable {
this
.
overflowMenu
.
buttonElement
.
style
.
visibility
=
'
visible
'
;
}
if
(
this
.
compactMenuActions
&&
this
.
compactMenuActions
.
length
)
{
const
compactMenuActions
=
this
.
options
.
getCompactMenuActions
?.();
if
(
compactMenuActions
&&
compactMenuActions
.
length
)
{
this
.
overflowMenu
.
actions
.
push
(
new
Separator
());
this
.
overflowMenu
.
actions
.
push
(...
this
.
compactMenuActions
);
this
.
overflowMenu
.
actions
.
push
(...
compactMenuActions
);
}
}
else
{
DOM
.
removeNode
(
this
.
overflowMenu
.
buttonElement
);
...
...
src/vs/platform/actions/common/actions.ts
浏览文件 @
a4207f77
...
...
@@ -92,6 +92,7 @@ export class MenuId {
static
readonly
MenubarSwitchGroupMenu
=
new
MenuId
(
'
MenubarSwitchGroupMenu
'
);
static
readonly
MenubarTerminalMenu
=
new
MenuId
(
'
MenubarTerminalMenu
'
);
static
readonly
MenubarViewMenu
=
new
MenuId
(
'
MenubarViewMenu
'
);
static
readonly
MenubarWebNavigationMenu
=
new
MenuId
(
'
MenubarWebNavigationMenu
'
);
static
readonly
OpenEditorsContext
=
new
MenuId
(
'
OpenEditorsContext
'
);
static
readonly
ProblemsPanelContext
=
new
MenuId
(
'
ProblemsPanelContext
'
);
static
readonly
SCMChangeContext
=
new
MenuId
(
'
SCMChangeContext
'
);
...
...
@@ -121,7 +122,6 @@ export class MenuId {
static
readonly
TimelineTitle
=
new
MenuId
(
'
TimelineTitle
'
);
static
readonly
TimelineTitleContext
=
new
MenuId
(
'
TimelineTitleContext
'
);
static
readonly
AccountsContext
=
new
MenuId
(
'
AccountsContext
'
);
static
readonly
WebMenuActions
=
new
MenuId
(
'
MenubarWebMenu
'
);
readonly
id
:
number
;
readonly
_debugName
:
string
;
...
...
src/vs/workbench/api/common/menusExtensionPoint.ts
浏览文件 @
a4207f77
...
...
@@ -38,6 +38,7 @@ namespace schema {
case
'
debug/toolbar
'
:
return
MenuId
.
DebugToolBar
;
case
'
debug/toolBar
'
:
return
MenuId
.
DebugToolBar
;
case
'
menuBar/file
'
:
return
MenuId
.
MenubarFileMenu
;
case
'
menuBar/webNavigation
'
:
return
MenuId
.
MenubarWebNavigationMenu
;
case
'
scm/title
'
:
return
MenuId
.
SCMTitle
;
case
'
scm/sourceControl
'
:
return
MenuId
.
SCMSourceControl
;
case
'
scm/resourceState/context
'
:
return
MenuId
.
SCMResourceContext
;
...
...
@@ -64,6 +65,7 @@ namespace schema {
switch
(
menuId
)
{
case
MenuId
.
StatusBarWindowIndicatorMenu
:
case
MenuId
.
MenubarFileMenu
:
case
MenuId
.
MenubarWebNavigationMenu
:
return
true
;
}
return
false
;
...
...
src/vs/workbench/browser/parts/titlebar/menubarControl.ts
浏览文件 @
a4207f77
...
...
@@ -26,7 +26,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
import
{
INotificationService
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IPreferencesService
}
from
'
vs/workbench/services/preferences/common/preferences
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
MenuBar
}
from
'
vs/base/browser/ui/menu/menubar
'
;
import
{
MenuBar
,
IMenuBarOptions
}
from
'
vs/base/browser/ui/menu/menubar
'
;
import
{
SubmenuAction
,
Direction
}
from
'
vs/base/browser/ui/menu/menu
'
;
import
{
attachMenuStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
...
...
@@ -509,30 +509,11 @@ export class CustomMenubarControl extends MenubarControl {
}
if
(
firstTime
)
{
const
webActions
=
[];
const
webMenu
=
this
.
menuService
.
createMenu
(
MenuId
.
WebMenuActions
,
this
.
contextKeyService
);
for
(
const
groups
of
webMenu
.
getActions
())
{
const
[,
actions
]
=
groups
;
for
(
const
action
of
actions
)
{
action
.
label
=
mnemonicMenuLabel
(
this
.
calculateActionLabel
(
action
));
webActions
.
push
(
action
);
}
}
this
.
menubar
=
this
.
_register
(
new
MenuBar
(
this
.
container
,
{
enableMnemonics
:
this
.
currentEnableMenuBarMnemonics
,
disableAltFocus
:
this
.
currentDisableMenuBarAltFocus
,
visibility
:
this
.
currentMenubarVisibility
,
getKeybinding
:
(
action
)
=>
this
.
keybindingService
.
lookupKeybinding
(
action
.
id
),
compactMode
:
this
.
currentCompactMenuMode
},
webActions
.
length
>
0
?
webActions
:
undefined
));
this
.
menubar
=
this
.
_register
(
new
MenuBar
(
this
.
container
,
this
.
getMenuBarOptions
()));
this
.
accessibilityService
.
alwaysUnderlineAccessKeys
().
then
(
val
=>
{
this
.
alwaysOnMnemonics
=
val
;
if
(
this
.
menubar
)
{
this
.
menubar
.
update
({
enableMnemonics
:
this
.
currentEnableMenuBarMnemonics
,
disableAltFocus
:
this
.
currentDisableMenuBarAltFocus
,
visibility
:
this
.
currentMenubarVisibility
,
getKeybinding
:
(
action
)
=>
this
.
keybindingService
.
lookupKeybinding
(
action
.
id
),
alwaysOnMnemonics
:
this
.
alwaysOnMnemonics
,
compactMode
:
this
.
currentCompactMenuMode
});
}
this
.
menubar
?.
update
(
this
.
getMenuBarOptions
());
});
this
.
_register
(
this
.
menubar
.
onFocusStateChange
(
focused
=>
{
...
...
@@ -558,9 +539,7 @@ export class CustomMenubarControl extends MenubarControl {
this
.
_register
(
attachMenuStyler
(
this
.
menubar
,
this
.
themeService
));
}
else
{
if
(
this
.
menubar
)
{
this
.
menubar
.
update
({
enableMnemonics
:
this
.
currentEnableMenuBarMnemonics
,
disableAltFocus
:
this
.
currentDisableMenuBarAltFocus
,
visibility
:
this
.
currentMenubarVisibility
,
getKeybinding
:
(
action
)
=>
this
.
keybindingService
.
lookupKeybinding
(
action
.
id
),
alwaysOnMnemonics
:
this
.
alwaysOnMnemonics
,
compactMode
:
this
.
currentCompactMenuMode
});
}
this
.
menubar
?.
update
(
this
.
getMenuBarOptions
());
}
// Update the menu actions
...
...
@@ -631,6 +610,35 @@ export class CustomMenubarControl extends MenubarControl {
}
}
private
getMenuBarOptions
():
IMenuBarOptions
{
return
{
enableMnemonics
:
this
.
currentEnableMenuBarMnemonics
,
disableAltFocus
:
this
.
currentDisableMenuBarAltFocus
,
visibility
:
this
.
currentMenubarVisibility
,
getKeybinding
:
(
action
)
=>
this
.
keybindingService
.
lookupKeybinding
(
action
.
id
),
alwaysOnMnemonics
:
this
.
alwaysOnMnemonics
,
compactMode
:
this
.
currentCompactMenuMode
,
getCompactMenuActions
:
()
=>
{
if
(
!
isWeb
)
{
return
[];
// only for web
}
const
webNavigationActions
:
IAction
[]
=
[];
const
webNavigationMenu
=
this
.
menuService
.
createMenu
(
MenuId
.
MenubarWebNavigationMenu
,
this
.
contextKeyService
);
for
(
const
groups
of
webNavigationMenu
.
getActions
())
{
const
[,
actions
]
=
groups
;
for
(
const
action
of
actions
)
{
action
.
label
=
mnemonicMenuLabel
(
this
.
calculateActionLabel
(
action
));
webNavigationActions
.
push
(
action
);
}
}
webNavigationMenu
.
dispose
();
return
webNavigationActions
;
}
};
}
protected
onDidChangeWindowFocus
(
hasFocus
:
boolean
):
void
{
super
.
onDidChangeWindowFocus
(
hasFocus
);
...
...
@@ -693,8 +701,6 @@ export class CustomMenubarControl extends MenubarControl {
this
.
container
.
style
.
height
=
`
${
dimension
.
height
}
px`
;
}
if
(
this
.
menubar
)
{
this
.
menubar
.
update
({
enableMnemonics
:
this
.
currentEnableMenuBarMnemonics
,
disableAltFocus
:
this
.
currentDisableMenuBarAltFocus
,
visibility
:
this
.
currentMenubarVisibility
,
getKeybinding
:
(
action
)
=>
this
.
keybindingService
.
lookupKeybinding
(
action
.
id
),
alwaysOnMnemonics
:
this
.
alwaysOnMnemonics
,
compactMode
:
this
.
currentCompactMenuMode
});
}
this
.
menubar
?.
update
(
this
.
getMenuBarOptions
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录