Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
742fb528
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
742fb528
编写于
10月 04, 2016
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fit watermark into code org (fixes #13069)
上级
809cef10
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
118 addition
and
7 deletion
+118
-7
src/vs/test/utils/servicesTestUtils.ts
src/vs/test/utils/servicesTestUtils.ts
+4
-0
src/vs/workbench/electron-browser/workbench.ts
src/vs/workbench/electron-browser/workbench.ts
+6
-7
src/vs/workbench/parts/watermark/browser/watermark.css
src/vs/workbench/parts/watermark/browser/watermark.css
+0
-0
src/vs/workbench/parts/watermark/browser/watermark.ts
src/vs/workbench/parts/watermark/browser/watermark.ts
+101
-0
src/vs/workbench/services/part/common/partService.ts
src/vs/workbench/services/part/common/partService.ts
+5
-0
src/vs/workbench/workbench.main.ts
src/vs/workbench/workbench.main.ts
+2
-0
未找到文件。
src/vs/test/utils/servicesTestUtils.ts
浏览文件 @
742fb528
...
...
@@ -230,6 +230,10 @@ export class TestPartService implements IPartService {
return
true
;
}
public
getContainer
(
part
):
HTMLElement
{
return
null
;
}
public
isStatusBarHidden
():
boolean
{
return
false
;
}
...
...
src/vs/workbench/electron-browser/workbench.ts
浏览文件 @
742fb528
...
...
@@ -74,7 +74,6 @@ import {MenuService} from 'vs/platform/actions/common/menuService';
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
*
as
watermark
from
'
vs/workbench/parts/watermark/watermark
'
;
export
const
MessagesVisibleContext
=
new
RawContextKey
<
boolean
>
(
'
globalMessageVisible
'
,
false
);
export
const
EditorsVisibleContext
=
new
RawContextKey
<
boolean
>
(
'
editorIsOpen
'
,
false
);
...
...
@@ -470,6 +469,11 @@ export class Workbench implements IPartService {
return
false
;
}
const
container
=
this
.
getContainer
(
part
);
return
DOM
.
isAncestor
(
activeElement
,
container
);
}
public
getContainer
(
part
:
Parts
):
HTMLElement
{
let
container
:
Builder
=
null
;
switch
(
part
)
{
case
Parts
.
ACTIVITYBAR_PART
:
...
...
@@ -488,8 +492,7 @@ export class Workbench implements IPartService {
container
=
this
.
statusbarPart
.
getContainer
();
break
;
}
return
DOM
.
isAncestor
(
activeElement
,
container
.
getHTMLElement
());
return
container
&&
container
.
getHTMLElement
();
}
public
isVisible
(
part
:
Parts
):
boolean
{
...
...
@@ -783,10 +786,6 @@ export class Workbench implements IPartService {
role
:
'
main
'
});
if
(
this
.
telemetryService
.
getExperiments
().
showCommandsWatermark
)
{
this
.
toDispose
.
push
(
watermark
.
create
(
editorContainer
,
this
.
keybindingService
));
}
this
.
editorPart
.
create
(
editorContainer
);
}
...
...
src/vs/workbench/parts/watermark/watermark.css
→
src/vs/workbench/parts/watermark/
browser/
watermark.css
浏览文件 @
742fb528
文件已移动
src/vs/workbench/parts/watermark/watermark.ts
→
src/vs/workbench/parts/watermark/
browser/
watermark.ts
浏览文件 @
742fb528
...
...
@@ -5,10 +5,16 @@
'
use strict
'
;
import
'
vs/css!./watermark
'
;
import
{
Builder
,
$
}
from
'
vs/base/browser/builder
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
$
}
from
'
vs/base/browser/builder
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
Parts
,
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
{
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
}
from
'
vs/workbench/common/contributions
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
const
entries
=
[
{
...
...
@@ -35,28 +41,61 @@ const entries = [
const
UNBOUND
=
nls
.
localize
(
'
watermark.unboundCommand
'
,
"
unbound
"
);
export
function
create
(
container
:
Builder
,
keybindingService
:
IKeybindingService
):
IDisposable
{
const
watermark
=
$
(
container
)
.
addClass
(
'
has-watermark
'
)
.
div
({
'
class
'
:
'
watermark
'
});
const
box
=
$
(
watermark
)
.
div
({
'
class
'
:
'
watermark-box
'
});
function
update
()
{
const
builder
=
$
(
box
);
builder
.
clearChildren
();
entries
.
map
(
entry
=>
{
builder
.
element
(
'
dl
'
,
{},
dl
=>
{
dl
.
element
(
'
dt
'
,
{},
dt
=>
dt
.
text
(
entry
.
text
));
dl
.
element
(
'
dd
'
,
{},
dd
=>
dd
.
innerHtml
(
entry
.
ids
.
map
(
id
=>
keybindingService
.
lookupKeybindings
(
id
).
slice
(
0
,
1
)
.
map
(
k
=>
`<span class="shortcuts">
${
keybindingService
.
getLabelFor
(
k
)}
</span>`
)
.
join
(
''
)
||
UNBOUND
)
.
join
(
'
/
'
)
));
export
class
WatermarkContribution
implements
IWorkbenchContribution
{
private
toDispose
:
IDisposable
[]
=
[];
constructor
(
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
IPartService
private
partService
:
IPartService
,
@
IKeybindingService
private
keybindingService
:
IKeybindingService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
)
{
if
(
telemetryService
.
getExperiments
().
showCommandsWatermark
)
{
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
);
this
.
partService
.
joinCreation
().
then
(()
=>
{
this
.
create
();
});
}
}
public
getId
()
{
return
'
vs.watermark
'
;
}
private
create
():
void
{
const
container
=
this
.
partService
.
getContainer
(
Parts
.
EDITOR_PART
);
const
watermark
=
$
()
.
div
({
'
class
'
:
'
watermark
'
});
const
box
=
$
(
watermark
)
.
div
({
'
class
'
:
'
watermark-box
'
});
const
update
=
()
=>
{
const
builder
=
$
(
box
);
builder
.
clearChildren
();
entries
.
map
(
entry
=>
{
builder
.
element
(
'
dl
'
,
{},
dl
=>
{
dl
.
element
(
'
dt
'
,
{},
dt
=>
dt
.
text
(
entry
.
text
));
dl
.
element
(
'
dd
'
,
{},
dd
=>
dd
.
innerHtml
(
entry
.
ids
.
map
(
id
=>
this
.
keybindingService
.
lookupKeybindings
(
id
).
slice
(
0
,
1
)
.
map
(
k
=>
`<span class="shortcuts">
${
this
.
keybindingService
.
getLabelFor
(
k
)}
</span>`
)
.
join
(
''
)
||
UNBOUND
)
.
join
(
'
/
'
)
));
});
});
});
};
update
();
watermark
.
build
(
container
,
0
);
$
(
container
)
.
addClass
(
'
has-watermark
'
);
this
.
toDispose
.
push
(
this
.
keybindingService
.
onDidUpdateKeybindings
(
update
));
}
public
dispose
():
void
{
this
.
toDispose
=
dispose
(
this
.
toDispose
);
}
update
();
return
keybindingService
.
onDidUpdateKeybindings
(
update
);
}
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
)
.
registerWorkbenchContribution
(
WatermarkContribution
);
src/vs/workbench/services/part/common/partService.ts
浏览文件 @
742fb528
...
...
@@ -45,6 +45,11 @@ export interface IPartService {
*/
hasFocus
(
part
:
Parts
):
boolean
;
/**
* Returns the parts HTML element, if there is one.
*/
getContainer
(
part
:
Parts
):
HTMLElement
;
/**
* Returns iff the part is visible.
*/
...
...
src/vs/workbench/workbench.main.ts
浏览文件 @
742fb528
...
...
@@ -93,3 +93,5 @@ import 'vs/workbench/electron-browser/main.contribution';
import
'
vs/workbench/electron-browser/main
'
;
import
'
vs/workbench/parts/themes/test/electron-browser/themes.test.contribution
'
;
import
'
vs/workbench/parts/watermark/browser/watermark
'
;
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录