Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
35034eda
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,发现更多精彩内容 >>
提交
35034eda
编写于
8月 08, 2019
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'pr/72171'
上级
a912dff9
f464c1de
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
55 addition
and
14 deletion
+55
-14
src/vs/base/browser/ui/inputbox/inputBox.css
src/vs/base/browser/ui/inputbox/inputBox.css
+7
-2
src/vs/base/browser/ui/inputbox/inputBox.ts
src/vs/base/browser/ui/inputbox/inputBox.ts
+47
-8
src/vs/workbench/contrib/scm/browser/scmViewlet.ts
src/vs/workbench/contrib/scm/browser/scmViewlet.ts
+1
-4
未找到文件。
src/vs/base/browser/ui/inputbox/inputBox.css
浏览文件 @
35034eda
...
...
@@ -58,7 +58,12 @@
.monaco-inputbox
>
.wrapper
>
textarea
.input
{
display
:
block
;
overflow
:
hidden
;
-ms-overflow-style
:
none
;
/* IE 10+ */
overflow
:
-moz-scrollbars-none
;
/* Firefox */
}
.monaco-inputbox
>
.wrapper
>
textarea
.input
::-webkit-scrollbar
{
display
:
none
;
}
.monaco-inputbox
>
.wrapper
>
.mirror
{
...
...
@@ -116,4 +121,4 @@
background-repeat
:
no-repeat
;
width
:
16px
;
height
:
16px
;
}
\ No newline at end of file
}
src/vs/base/browser/ui/inputbox/inputBox.ts
浏览文件 @
35034eda
...
...
@@ -19,6 +19,9 @@ import { Color } from 'vs/base/common/color';
import
{
mixin
}
from
'
vs/base/common/objects
'
;
import
{
HistoryNavigator
}
from
'
vs/base/common/history
'
;
import
{
IHistoryNavigationWidget
}
from
'
vs/base/browser/history
'
;
import
{
ScrollableElement
}
from
'
vs/base/browser/ui/scrollbar/scrollableElement
'
;
import
{
ScrollbarVisibility
}
from
'
vs/base/common/scrollable
'
;
import
{
domEvent
}
from
'
vs/base/browser/event
'
;
const
$
=
dom
.
$
;
...
...
@@ -28,6 +31,7 @@ export interface IInputOptions extends IInputBoxStyles {
readonly
type
?:
string
;
readonly
validationOptions
?:
IInputValidationOptions
;
readonly
flexibleHeight
?:
boolean
;
readonly
flexibleMaxHeight
?:
number
;
readonly
actions
?:
ReadonlyArray
<
IAction
>
;
}
...
...
@@ -86,7 +90,6 @@ export class InputBox extends Widget {
private
contextViewProvider
?:
IContextViewProvider
;
element
:
HTMLElement
;
private
input
:
HTMLInputElement
;
private
mirror
:
HTMLElement
|
undefined
;
private
actionbar
?:
ActionBar
;
private
options
:
IInputOptions
;
private
message
:
IMessage
|
null
;
...
...
@@ -94,7 +97,12 @@ export class InputBox extends Widget {
private
ariaLabel
:
string
;
private
validation
?:
IInputValidator
;
private
state
:
'
idle
'
|
'
open
'
|
'
closed
'
=
'
idle
'
;
private
cachedHeight
:
number
|
null
;
private
mirror
:
HTMLElement
|
undefined
;
private
cachedHeight
:
number
|
undefined
;
private
cachedContentHeight
:
number
|
undefined
;
private
maxHeight
:
number
=
Number
.
POSITIVE_INFINITY
;
private
scrollableElement
:
ScrollableElement
|
undefined
;
private
inputBackground
?:
Color
;
private
inputForeground
?:
Color
;
...
...
@@ -123,7 +131,6 @@ export class InputBox extends Widget {
this
.
options
=
options
||
Object
.
create
(
null
);
mixin
(
this
.
options
,
defaultOpts
,
false
);
this
.
message
=
null
;
this
.
cachedHeight
=
null
;
this
.
placeholder
=
this
.
options
.
placeholder
||
''
;
this
.
ariaLabel
=
this
.
options
.
ariaLabel
||
''
;
...
...
@@ -159,8 +166,26 @@ export class InputBox extends Widget {
this
.
onblur
(
this
.
input
,
()
=>
dom
.
removeClass
(
this
.
element
,
'
synthetic-focus
'
));
if
(
this
.
options
.
flexibleHeight
)
{
this
.
maxHeight
=
typeof
this
.
options
.
flexibleMaxHeight
===
'
number
'
?
this
.
options
.
flexibleMaxHeight
:
Number
.
POSITIVE_INFINITY
;
this
.
mirror
=
dom
.
append
(
wrapper
,
$
(
'
div.mirror
'
));
this
.
mirror
.
innerHTML
=
'
'
;
this
.
scrollableElement
=
new
ScrollableElement
(
this
.
element
,
{
vertical
:
ScrollbarVisibility
.
Auto
});
dom
.
append
(
container
,
this
.
scrollableElement
.
getDomNode
());
this
.
_register
(
this
.
scrollableElement
);
// from ScrollableElement to DOM
this
.
_register
(
this
.
scrollableElement
.
onScroll
(
e
=>
this
.
input
.
scrollTop
=
e
.
scrollTop
));
const
onSelectionChange
=
Event
.
filter
(
domEvent
(
document
,
'
selectionchange
'
),
()
=>
{
const
selection
=
document
.
getSelection
();
return
!!
selection
&&
selection
.
anchorNode
===
wrapper
;
});
// from DOM to ScrollableElement
this
.
_register
(
onSelectionChange
(
this
.
updateScrollDimensions
,
this
));
this
.
_register
(
this
.
onDidHeightChange
(
this
.
updateScrollDimensions
,
this
));
}
else
{
this
.
input
.
type
=
this
.
options
.
type
||
'
text
'
;
this
.
input
.
setAttribute
(
'
wrap
'
,
'
off
'
);
...
...
@@ -250,7 +275,7 @@ export class InputBox extends Widget {
}
public
get
height
():
number
{
return
t
his
.
cachedHeight
===
null
?
dom
.
getTotalHeight
(
this
.
element
)
:
this
.
cachedHeight
;
return
t
ypeof
this
.
cachedHeight
===
'
number
'
?
this
.
cachedHeight
:
dom
.
getTotalHeight
(
this
.
element
)
;
}
public
focus
():
void
{
...
...
@@ -301,6 +326,19 @@ export class InputBox extends Widget {
}
}
private
updateScrollDimensions
():
void
{
if
(
typeof
this
.
cachedContentHeight
!==
'
number
'
||
typeof
this
.
cachedHeight
!==
'
number
'
)
{
return
;
}
const
scrollHeight
=
this
.
cachedContentHeight
;
const
height
=
this
.
cachedHeight
;
const
scrollTop
=
this
.
input
.
scrollTop
;
this
.
scrollableElement
!
.
setScrollDimensions
({
scrollHeight
,
height
});
this
.
scrollableElement
!
.
setScrollPosition
({
scrollTop
});
}
public
showMessage
(
message
:
IMessage
,
force
?:
boolean
):
void
{
this
.
message
=
message
;
...
...
@@ -510,12 +548,13 @@ export class InputBox extends Widget {
return
;
}
const
previousHeight
=
this
.
cachedHeight
;
this
.
cachedHeight
=
dom
.
getTotalHeight
(
this
.
mirror
);
const
previousHeight
=
this
.
cached
Content
Height
;
this
.
cached
Content
Height
=
dom
.
getTotalHeight
(
this
.
mirror
);
if
(
previousHeight
!==
this
.
cachedHeight
)
{
if
(
previousHeight
!==
this
.
cachedContentHeight
)
{
this
.
cachedHeight
=
Math
.
min
(
this
.
cachedContentHeight
,
this
.
maxHeight
);
this
.
input
.
style
.
height
=
this
.
cachedHeight
+
'
px
'
;
this
.
_onDidHeightChange
.
fire
(
this
.
cachedHeight
);
this
.
_onDidHeightChange
.
fire
(
this
.
cached
Content
Height
);
}
}
...
...
src/vs/workbench/contrib/scm/browser/scmViewlet.ts
浏览文件 @
35034eda
...
...
@@ -797,7 +797,7 @@ export class RepositoryPanel extends ViewletPanel {
const
triggerValidation
=
()
=>
validationDelayer
.
trigger
(
validate
);
this
.
inputBox
=
new
InputBox
(
this
.
inputBoxContainer
,
this
.
contextViewService
,
{
flexibleHeight
:
true
});
this
.
inputBox
=
new
InputBox
(
this
.
inputBoxContainer
,
this
.
contextViewService
,
{
flexibleHeight
:
true
,
flexibleMaxHeight
:
134
});
this
.
inputBox
.
setEnabled
(
this
.
isBodyVisible
());
this
.
_register
(
attachInputBoxStyler
(
this
.
inputBox
,
this
.
themeService
));
this
.
_register
(
this
.
inputBox
);
...
...
@@ -896,11 +896,8 @@ export class RepositoryPanel extends ViewletPanel {
const
listHeight
=
height
-
(
editorHeight
+
12
/* margin */
);
this
.
listContainer
.
style
.
height
=
`
${
listHeight
}
px`
;
this
.
list
.
layout
(
listHeight
,
width
);
toggleClass
(
this
.
inputBoxContainer
,
'
scroll
'
,
editorHeight
>=
134
);
}
else
{
addClass
(
this
.
inputBoxContainer
,
'
hidden
'
);
removeClass
(
this
.
inputBoxContainer
,
'
scroll
'
);
this
.
listContainer
.
style
.
height
=
`
${
height
}
px`
;
this
.
list
.
layout
(
height
,
width
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录