Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3fae073b
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,发现更多精彩内容 >>
提交
3fae073b
编写于
10月 17, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update css class of editor container based on layout setting
上级
ca1184ee
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
52 addition
and
32 deletion
+52
-32
src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts
...workbench/browser/parts/editor/sideBySideEditorControl.ts
+52
-32
未找到文件。
src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts
浏览文件 @
3fae073b
...
...
@@ -100,6 +100,10 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
private
dimension
:
Dimension
;
private
dragging
:
boolean
;
private
layoutVertically
:
boolean
;
private
showTabs
:
boolean
;
private
showIcons
:
boolean
;
private
silos
:
Builder
[];
private
siloWidths
:
number
[];
private
siloInitialRatios
:
number
[];
...
...
@@ -152,32 +156,57 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
this
.
toDispose
.
push
(
this
.
onStacksChangeScheduler
);
this
.
stacksChangedBuffer
=
[];
this
.
create
(
this
.
parent
);
this
.
onConfigurationUpdated
(
this
.
configurationService
.
getConfiguration
<
IWorkbenchEditorConfiguration
>
());
this
.
create
();
this
.
registerListeners
();
}
private
registerListeners
():
void
{
this
.
toDispose
.
push
(
this
.
stacks
.
onModelChanged
(
e
=>
this
.
onStacksChanged
(
e
)));
this
.
toDispose
.
push
(
this
.
configurationService
.
onDidUpdateConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
e
.
config
)));
this
.
toDispose
.
push
(
this
.
configurationService
.
onDidUpdateConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
e
.
config
,
true
)));
this
.
extensionService
.
onReady
().
then
(()
=>
this
.
onExtensionsReady
());
}
private
onConfigurationUpdated
(
config
:
IWorkbenchEditorConfiguration
):
void
{
const
{
showTabs
,
showIcons
}
=
this
.
getConfig
();
private
onConfigurationUpdated
(
config
:
IWorkbenchEditorConfiguration
,
refresh
?:
boolean
):
void
{
if
(
config
.
workbench
&&
config
.
workbench
.
editor
)
{
this
.
showTabs
=
config
.
workbench
.
editor
.
showTabs
;
this
.
showIcons
=
config
.
workbench
.
editor
.
showIcons
;
this
.
layoutVertically
=
(
config
.
workbench
.
editor
.
sideBySideLayout
!==
'
horizontal
'
);
}
else
{
this
.
showTabs
=
true
;
this
.
showIcons
=
false
;
this
.
layoutVertically
=
true
;
}
if
(
!
refresh
)
{
return
;
// return early if no refresh is needed
}
// Editor Layout
const
verticalLayouting
=
this
.
parent
.
hasClass
(
'
vertical-layout
'
);
if
(
verticalLayouting
!==
this
.
layoutVertically
)
{
this
.
parent
.
removeClass
(
'
vertical-layout
'
,
'
horizontal-layout
'
);
this
.
parent
.
addClass
(
this
.
layoutVertically
?
'
vertical-layout
'
:
'
horizontal-layout
'
);
this
.
layout
(
this
.
dimension
);
}
// Editor Containers
POSITIONS
.
forEach
(
position
=>
{
const
titleControl
=
this
.
getTitleAreaControl
(
position
);
// TItle Container
const
titleContainer
=
$
(
titleControl
.
getContainer
());
if
(
showTabs
)
{
if
(
this
.
showTabs
)
{
titleContainer
.
addClass
(
'
tabs
'
);
}
else
{
titleContainer
.
removeClass
(
'
tabs
'
);
}
const
showingIcons
=
titleContainer
.
hasClass
(
'
show-file-icons
'
);
if
(
showIcons
)
{
if
(
this
.
showIcons
)
{
titleContainer
.
addClass
(
'
show-file-icons
'
);
}
else
{
titleContainer
.
removeClass
(
'
show-file-icons
'
);
...
...
@@ -188,14 +217,14 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
const
usingTabs
=
(
titleControl
instanceof
TabsTitleControl
);
// Recreate title when tabs change
if
(
usingTabs
!==
showTabs
)
{
if
(
usingTabs
!==
this
.
showTabs
)
{
titleControl
.
dispose
();
titleContainer
.
empty
();
this
.
createTitleControl
(
this
.
stacks
.
groupAt
(
position
),
this
.
silos
[
position
],
titleContainer
,
this
.
getInstantiationService
(
position
));
}
// Refresh title when icons change
else
if
(
showingIcons
!==
showIcons
)
{
else
if
(
showingIcons
!==
this
.
showIcons
)
{
titleControl
.
refresh
(
true
);
}
}
...
...
@@ -739,16 +768,19 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
return
this
.
lastActivePosition
;
}
private
create
(
parent
:
Builder
):
void
{
private
create
():
void
{
// Store layout as class property
this
.
parent
.
addClass
(
this
.
layoutVertically
?
'
vertical-layout
'
:
'
horizontal-layout
'
);
// Allow to drop into container to open
this
.
enableDropTarget
(
parent
.
getHTMLElement
());
this
.
enableDropTarget
(
this
.
parent
.
getHTMLElement
());
// Left Silo
this
.
silos
[
Position
.
LEFT
]
=
$
(
parent
).
div
({
class
:
'
one-editor-silo editor-left monaco-editor-background
'
});
this
.
silos
[
Position
.
LEFT
]
=
$
(
this
.
parent
).
div
({
class
:
'
one-editor-silo editor-left monaco-editor-background
'
});
// Left Sash
this
.
leftSash
=
new
Sash
(
parent
.
getHTMLElement
(),
this
,
{
baseSize
:
5
});
this
.
leftSash
=
new
Sash
(
this
.
parent
.
getHTMLElement
(),
this
,
{
baseSize
:
5
});
this
.
toDispose
.
push
(
this
.
leftSash
.
addListener2
(
'
start
'
,
()
=>
this
.
onLeftSashDragStart
()));
this
.
toDispose
.
push
(
this
.
leftSash
.
addListener2
(
'
change
'
,
(
e
:
ISashEvent
)
=>
this
.
onLeftSashDrag
(
e
)));
this
.
toDispose
.
push
(
this
.
leftSash
.
addListener2
(
'
end
'
,
()
=>
this
.
onLeftSashDragEnd
()));
...
...
@@ -756,10 +788,10 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
this
.
leftSash
.
hide
();
// Center Silo
this
.
silos
[
Position
.
CENTER
]
=
$
(
parent
).
div
({
class
:
'
one-editor-silo editor-center monaco-editor-background
'
});
this
.
silos
[
Position
.
CENTER
]
=
$
(
this
.
parent
).
div
({
class
:
'
one-editor-silo editor-center monaco-editor-background
'
});
// Right Sash
this
.
rightSash
=
new
Sash
(
parent
.
getHTMLElement
(),
this
,
{
baseSize
:
5
});
this
.
rightSash
=
new
Sash
(
this
.
parent
.
getHTMLElement
(),
this
,
{
baseSize
:
5
});
this
.
toDispose
.
push
(
this
.
rightSash
.
addListener2
(
'
start
'
,
()
=>
this
.
onRightSashDragStart
()));
this
.
toDispose
.
push
(
this
.
rightSash
.
addListener2
(
'
change
'
,
(
e
:
ISashEvent
)
=>
this
.
onRightSashDrag
(
e
)));
this
.
toDispose
.
push
(
this
.
rightSash
.
addListener2
(
'
end
'
,
()
=>
this
.
onRightSashDragEnd
()));
...
...
@@ -767,10 +799,9 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
this
.
rightSash
.
hide
();
// Right Silo
this
.
silos
[
Position
.
RIGHT
]
=
$
(
parent
).
div
({
class
:
'
one-editor-silo editor-right monaco-editor-background
'
});
this
.
silos
[
Position
.
RIGHT
]
=
$
(
this
.
parent
).
div
({
class
:
'
one-editor-silo editor-right monaco-editor-background
'
});
// For each position
const
{
showTabs
,
showIcons
}
=
this
.
getConfig
();
POSITIONS
.
forEach
(
position
=>
{
const
silo
=
this
.
silos
[
position
];
...
...
@@ -785,10 +816,10 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
// Title containers
const
titleContainer
=
$
(
container
).
div
({
'
class
'
:
'
title
'
});
if
(
showTabs
)
{
if
(
this
.
showTabs
)
{
titleContainer
.
addClass
(
'
tabs
'
);
}
if
(
showIcons
)
{
if
(
this
.
showIcons
)
{
titleContainer
.
addClass
(
'
show-file-icons
'
);
}
this
.
hookTitleDragListener
(
titleContainer
);
...
...
@@ -987,13 +1018,12 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
function
createOverlay
(
target
:
HTMLElement
):
void
{
if
(
!
overlay
)
{
const
{
showTabs
}
=
$this
.
getConfig
();
const
containers
=
$this
.
visibleEditors
.
filter
(
e
=>
!!
e
).
map
(
e
=>
e
.
getContainer
());
containers
.
forEach
((
container
,
index
)
=>
{
if
(
container
&&
DOM
.
isAncestor
(
target
,
container
.
getHTMLElement
()))
{
overlay
=
$
(
'
div
'
).
style
({
top
:
showTabs
?
SideBySideEditorControl
.
EDITOR_TITLE_HEIGHT
+
'
px
'
:
0
,
height
:
showTabs
?
`calc(100% -
${
SideBySideEditorControl
.
EDITOR_TITLE_HEIGHT
}
px`
:
'
100%
'
top
:
$this
.
showTabs
?
SideBySideEditorControl
.
EDITOR_TITLE_HEIGHT
+
'
px
'
:
0
,
height
:
$this
.
showTabs
?
`calc(100% -
${
SideBySideEditorControl
.
EDITOR_TITLE_HEIGHT
}
px`
:
'
100%
'
}).
id
(
overlayId
);
overlay
.
appendTo
(
container
);
...
...
@@ -1082,9 +1112,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
}
private
createTitleControl
(
context
:
IEditorGroup
,
silo
:
Builder
,
container
:
Builder
,
instantiationService
:
IInstantiationService
):
void
{
const
{
showTabs
}
=
this
.
getConfig
();
const
titleAreaControl
=
instantiationService
.
createInstance
<
ITitleAreaControl
>
(
showTabs
?
TabsTitleControl
:
NoTabsTitleControl
);
const
titleAreaControl
=
instantiationService
.
createInstance
<
ITitleAreaControl
>
(
this
.
showTabs
?
TabsTitleControl
:
NoTabsTitleControl
);
titleAreaControl
.
create
(
container
.
getHTMLElement
());
titleAreaControl
.
setContext
(
context
);
titleAreaControl
.
refresh
(
true
/* instant */
);
...
...
@@ -1092,14 +1120,6 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
silo
.
child
().
setProperty
(
SideBySideEditorControl
.
TITLE_AREA_CONTROL_KEY
,
titleAreaControl
);
// associate with container
}
private
getConfig
(
config
=
this
.
configurationService
.
getConfiguration
<
IWorkbenchEditorConfiguration
>
()):
{
showTabs
?:
boolean
;
showIcons
?:
boolean
}
{
if
(
config
.
workbench
&&
config
.
workbench
.
editor
)
{
return
{
showTabs
:
config
.
workbench
.
editor
.
showTabs
,
showIcons
:
config
.
workbench
.
editor
.
showIcons
};
}
return
Object
.
create
(
null
);
}
private
findPosition
(
element
:
HTMLElement
):
Position
{
let
parent
=
element
.
parentElement
;
while
(
parent
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录