Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
3e3dd8ce
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
3e3dd8ce
编写于
8月 05, 2016
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #9887
上级
fe974d08
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
40 addition
and
18 deletion
+40
-18
src/vs/workbench/parts/search/browser/media/searchviewlet.css
...vs/workbench/parts/search/browser/media/searchviewlet.css
+23
-6
src/vs/workbench/parts/search/browser/searchWidget.ts
src/vs/workbench/parts/search/browser/searchWidget.ts
+17
-12
未找到文件。
src/vs/workbench/parts/search/browser/media/searchviewlet.css
浏览文件 @
3e3dd8ce
...
@@ -25,7 +25,8 @@
...
@@ -25,7 +25,8 @@
cursor
:
pointer
;
cursor
:
pointer
;
}
}
.search-viewlet
.search-widget
.input-box
{
.search-viewlet
.search-widget
.search-container
,
.search-viewlet
.search-widget
.replace-container
{
margin-left
:
17px
;
margin-left
:
17px
;
}
}
...
@@ -38,14 +39,30 @@
...
@@ -38,14 +39,30 @@
vertical-align
:
middle
;
vertical-align
:
middle
;
}
}
.search-viewlet
.search-widget
.replace-
box
{
.search-viewlet
.search-widget
.replace-
container
{
margin-top
:
6px
;
margin-top
:
6px
;
position
:
relative
;
}
}
.search-viewlet
.search-widget
.replace-
box
.disabled
{
.search-viewlet
.search-widget
.replace-
container
.disabled
{
display
:
none
;
display
:
none
;
}
}
.search-viewlet
.search-widget
.replace-container
>
*
{
display
:
inline-block
;
}
.search-viewlet
.search-widget
.replace-container
.monaco-action-bar
{
position
:
absolute
;
margin-left
:
3px
;
}
.search-viewlet
.search-widget
.replace-container
.monaco-action-bar
.action-item
.icon
{
background-repeat
:
no-repeat
;
width
:
20px
;
height
:
25px
;
}
.search-viewlet
.query-clear
{
.search-viewlet
.query-clear
{
width
:
20px
;
width
:
20px
;
height
:
20px
;
height
:
20px
;
...
@@ -63,7 +80,7 @@
...
@@ -63,7 +80,7 @@
.search-viewlet
.query-details
.more
{
.search-viewlet
.query-details
.more
{
position
:
absolute
;
position
:
absolute
;
margin-right
:
0.
5
em
;
margin-right
:
0.
3
em
;
right
:
0
;
right
:
0
;
cursor
:
pointer
;
cursor
:
pointer
;
width
:
16px
;
width
:
16px
;
...
@@ -193,7 +210,7 @@
...
@@ -193,7 +210,7 @@
}
}
.search-viewlet
.action-replace-all
{
.search-viewlet
.action-replace-all
{
background
-image
:
url('replace-all.svg')
;
background
:
url('replace-all.svg')
center
center
no-repeat
;
}
}
.hc-black
.search-viewlet
.action-replace
,
.hc-black
.search-viewlet
.action-replace
,
...
@@ -203,7 +220,7 @@
...
@@ -203,7 +220,7 @@
.hc-black
.search-viewlet
.action-replace-all
,
.hc-black
.search-viewlet
.action-replace-all
,
.vs-dark
.search-viewlet
.action-replace-all
{
.vs-dark
.search-viewlet
.action-replace-all
{
background
-image
:
url('replace-all-inverse.svg')
;
background
:
url('replace-all-inverse.svg')
center
center
no-repeat
;
}
}
.search-viewlet
.label
{
.search-viewlet
.label
{
...
...
src/vs/workbench/parts/search/browser/searchWidget.ts
浏览文件 @
3e3dd8ce
...
@@ -9,6 +9,7 @@ import dom = require('vs/base/browser/dom');
...
@@ -9,6 +9,7 @@ import dom = require('vs/base/browser/dom');
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Widget
}
from
'
vs/base/browser/ui/widget
'
;
import
{
Widget
}
from
'
vs/base/browser/ui/widget
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
ActionBar
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
FindInput
,
IFindInputOptions
}
from
'
vs/base/browser/ui/findinput/findInput
'
;
import
{
FindInput
,
IFindInputOptions
}
from
'
vs/base/browser/ui/findinput/findInput
'
;
import
{
InputBox
}
from
'
vs/base/browser/ui/inputbox/inputBox
'
;
import
{
InputBox
}
from
'
vs/base/browser/ui/inputbox/inputBox
'
;
import
{
Button
}
from
'
vs/base/browser/ui/button/button
'
;
import
{
Button
}
from
'
vs/base/browser/ui/button/button
'
;
...
@@ -74,10 +75,11 @@ export class SearchWidget extends Widget {
...
@@ -74,10 +75,11 @@ export class SearchWidget extends Widget {
public
searchInput
:
FindInput
;
public
searchInput
:
FindInput
;
private
replaceInput
:
InputBox
;
private
replaceInput
:
InputBox
;
private
replace
Input
Container
:
HTMLElement
;
private
replaceContainer
:
HTMLElement
;
private
toggleReplaceButton
:
Button
;
private
toggleReplaceButton
:
Button
;
private
replaceAllAction
:
ReplaceAllAction
;
private
replaceAllAction
:
ReplaceAllAction
;
private
replaceActive
:
IKeybindingContextKey
<
boolean
>
;
private
replaceActive
:
IKeybindingContextKey
<
boolean
>
;
private
replaceActionBar
:
ActionBar
;
private
_onSearchSubmit
=
this
.
_register
(
new
Emitter
<
boolean
>
());
private
_onSearchSubmit
=
this
.
_register
(
new
Emitter
<
boolean
>
());
public
onSearchSubmit
:
Event
<
boolean
>
=
this
.
_onSearchSubmit
.
event
;
public
onSearchSubmit
:
Event
<
boolean
>
=
this
.
_onSearchSubmit
.
event
;
...
@@ -138,7 +140,7 @@ export class SearchWidget extends Widget {
...
@@ -138,7 +140,7 @@ export class SearchWidget extends Widget {
}
}
public
isReplaceShown
():
boolean
{
public
isReplaceShown
():
boolean
{
return
!
dom
.
hasClass
(
this
.
replace
Input
Container
,
'
disabled
'
);
return
!
dom
.
hasClass
(
this
.
replaceContainer
,
'
disabled
'
);
}
}
public
getReplaceValue
():
string
{
public
getReplaceValue
():
string
{
...
@@ -173,7 +175,7 @@ export class SearchWidget extends Widget {
...
@@ -173,7 +175,7 @@ export class SearchWidget extends Widget {
placeholder
:
nls
.
localize
(
'
search.placeHolder
'
,
"
Search
"
)
placeholder
:
nls
.
localize
(
'
search.placeHolder
'
,
"
Search
"
)
};
};
let
searchInputContainer
=
dom
.
append
(
parent
,
dom
.
emmet
(
'
.search-
box
.input-box
'
));
let
searchInputContainer
=
dom
.
append
(
parent
,
dom
.
emmet
(
'
.search-
container
.input-box
'
));
this
.
searchInput
=
this
.
_register
(
new
FindInput
(
searchInputContainer
,
this
.
contextViewService
,
inputOptions
));
this
.
searchInput
=
this
.
_register
(
new
FindInput
(
searchInputContainer
,
this
.
contextViewService
,
inputOptions
));
this
.
searchInput
.
onKeyUp
((
keyboardEvent
:
IKeyboardEvent
)
=>
this
.
onSearchInputKeyUp
(
keyboardEvent
));
this
.
searchInput
.
onKeyUp
((
keyboardEvent
:
IKeyboardEvent
)
=>
this
.
onSearchInputKeyUp
(
keyboardEvent
));
this
.
searchInput
.
onKeyDown
((
keyboardEvent
:
IKeyboardEvent
)
=>
this
.
onSearchInputKeyDown
(
keyboardEvent
));
this
.
searchInput
.
onKeyDown
((
keyboardEvent
:
IKeyboardEvent
)
=>
this
.
onSearchInputKeyDown
(
keyboardEvent
));
...
@@ -184,19 +186,22 @@ export class SearchWidget extends Widget {
...
@@ -184,19 +186,22 @@ export class SearchWidget extends Widget {
}
}
private
renderReplaceInput
(
parent
:
HTMLElement
):
void
{
private
renderReplaceInput
(
parent
:
HTMLElement
):
void
{
this
.
replaceAllAction
=
ReplaceAllAction
.
INSTANCE
;
this
.
replaceContainer
=
dom
.
append
(
parent
,
dom
.
emmet
(
'
.replace-container.disabled
'
));
this
.
replaceAllAction
.
searchWidget
=
this
;
let
replaceBox
=
dom
.
append
(
this
.
replaceContainer
,
dom
.
emmet
(
'
.input-box
'
));
this
.
replaceAllAction
.
label
=
SearchWidget
.
REPLACE_ALL_DISABLED_LABEL
;
this
.
replaceInput
=
this
.
_register
(
new
InputBox
(
replaceBox
,
this
.
contextViewService
,
{
this
.
replaceInputContainer
=
dom
.
append
(
parent
,
dom
.
emmet
(
'
.replace-box.input-box.disabled
'
));
this
.
replaceInput
=
this
.
_register
(
new
InputBox
(
this
.
replaceInputContainer
,
this
.
contextViewService
,
{
ariaLabel
:
nls
.
localize
(
'
label.Replace
'
,
'
Replace: Type replace term and press Enter to preview or Escape to cancel
'
),
ariaLabel
:
nls
.
localize
(
'
label.Replace
'
,
'
Replace: Type replace term and press Enter to preview or Escape to cancel
'
),
placeholder
:
nls
.
localize
(
'
search.replace.placeHolder
'
,
"
Replace
"
),
placeholder
:
nls
.
localize
(
'
search.replace.placeHolder
'
,
"
Replace
"
)
actions
:
[
this
.
replaceAllAction
]
}));
}));
this
.
onkeydown
(
this
.
replaceInput
.
inputElement
,
(
keyboardEvent
)
=>
this
.
onReplaceInputKeyDown
(
keyboardEvent
));
this
.
onkeydown
(
this
.
replaceInput
.
inputElement
,
(
keyboardEvent
)
=>
this
.
onReplaceInputKeyDown
(
keyboardEvent
));
this
.
onkeyup
(
this
.
replaceInput
.
inputElement
,
(
keyboardEvent
)
=>
this
.
onReplaceInputKeyUp
(
keyboardEvent
));
this
.
onkeyup
(
this
.
replaceInput
.
inputElement
,
(
keyboardEvent
)
=>
this
.
onReplaceInputKeyUp
(
keyboardEvent
));
this
.
replaceInput
.
onDidChange
(()
=>
this
.
_onReplaceValueChanged
.
fire
());
this
.
replaceInput
.
onDidChange
(()
=>
this
.
_onReplaceValueChanged
.
fire
());
this
.
searchInput
.
inputBox
.
onDidChange
(()
=>
this
.
onSearchInputChanged
());
this
.
searchInput
.
inputBox
.
onDidChange
(()
=>
this
.
onSearchInputChanged
());
this
.
replaceAllAction
=
ReplaceAllAction
.
INSTANCE
;
this
.
replaceAllAction
.
searchWidget
=
this
;
this
.
replaceAllAction
.
label
=
SearchWidget
.
REPLACE_ALL_DISABLED_LABEL
;
this
.
replaceActionBar
=
this
.
_register
(
new
ActionBar
(
this
.
replaceContainer
));
this
.
replaceActionBar
.
push
([
this
.
replaceAllAction
],
{
icon
:
true
,
label
:
false
});
}
}
triggerReplaceAll
():
TPromise
<
any
>
{
triggerReplaceAll
():
TPromise
<
any
>
{
...
@@ -205,7 +210,7 @@ export class SearchWidget extends Widget {
...
@@ -205,7 +210,7 @@ export class SearchWidget extends Widget {
}
}
private
onToggleReplaceButton
():
void
{
private
onToggleReplaceButton
():
void
{
dom
.
toggleClass
(
this
.
replace
Input
Container
,
'
disabled
'
);
dom
.
toggleClass
(
this
.
replaceContainer
,
'
disabled
'
);
dom
.
toggleClass
(
this
.
toggleReplaceButton
.
getElement
(),
'
collapse
'
);
dom
.
toggleClass
(
this
.
toggleReplaceButton
.
getElement
(),
'
collapse
'
);
dom
.
toggleClass
(
this
.
toggleReplaceButton
.
getElement
(),
'
expand
'
);
dom
.
toggleClass
(
this
.
toggleReplaceButton
.
getElement
(),
'
expand
'
);
this
.
updateReplaceActiveState
();
this
.
updateReplaceActiveState
();
...
@@ -325,7 +330,7 @@ export class SearchWidget extends Widget {
...
@@ -325,7 +330,7 @@ export class SearchWidget extends Widget {
public
dispose
():
void
{
public
dispose
():
void
{
this
.
setReplaceAllActionState
(
false
);
this
.
setReplaceAllActionState
(
false
);
this
.
replaceAllAction
.
searchWidget
=
null
;
this
.
replaceAllAction
.
searchWidget
=
null
;
this
.
replaceActionBar
=
null
;
super
.
dispose
();
super
.
dispose
();
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录