Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
aa2e6637
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,发现更多精彩内容 >>
提交
aa2e6637
编写于
1月 08, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify toggle selection find checkbox
上级
8d5db4b7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
18 deletion
+42
-18
src/vs/base/browser/ui/widget.ts
src/vs/base/browser/ui/widget.ts
+4
-0
src/vs/editor/contrib/find/browser/findWidget.ts
src/vs/editor/contrib/find/browser/findWidget.ts
+38
-18
未找到文件。
src/vs/base/browser/ui/widget.ts
浏览文件 @
aa2e6637
...
@@ -35,4 +35,8 @@ export abstract class Widget extends Disposable {
...
@@ -35,4 +35,8 @@ export abstract class Widget extends Disposable {
protected
onfocus
(
domNode
:
HTMLElement
,
listener
:(
e
:
Event
)
=>
void
):
void
{
protected
onfocus
(
domNode
:
HTMLElement
,
listener
:(
e
:
Event
)
=>
void
):
void
{
this
.
_register
(
DomUtils
.
addDisposableListener
(
domNode
,
DomUtils
.
EventType
.
FOCUS
,
listener
));
this
.
_register
(
DomUtils
.
addDisposableListener
(
domNode
,
DomUtils
.
EventType
.
FOCUS
,
listener
));
}
}
protected
onchange
(
domNode
:
HTMLElement
,
listener
:(
e
:
Event
)
=>
void
):
void
{
this
.
_register
(
DomUtils
.
addDisposableListener
(
domNode
,
DomUtils
.
EventType
.
CHANGE
,
listener
));
}
}
}
src/vs/editor/contrib/find/browser/findWidget.ts
浏览文件 @
aa2e6637
...
@@ -60,7 +60,7 @@ export class FindWidget extends Widget implements EditorBrowser.IOverlayWidget {
...
@@ -60,7 +60,7 @@ export class FindWidget extends Widget implements EditorBrowser.IOverlayWidget {
private
_toggleReplaceBtn
:
SimpleButton
;
private
_toggleReplaceBtn
:
SimpleButton
;
private
_prevBtn
:
SimpleButton
;
private
_prevBtn
:
SimpleButton
;
private
_nextBtn
:
SimpleButton
;
private
_nextBtn
:
SimpleButton
;
private
_toggleSelectionFind
:
Checkbox
;
private
_toggleSelectionFind
:
Simple
Checkbox
;
private
_closeBtn
:
SimpleButton
;
private
_closeBtn
:
SimpleButton
;
private
_replaceBtn
:
SimpleButton
;
private
_replaceBtn
:
SimpleButton
;
private
_replaceAllBtn
:
SimpleButton
;
private
_replaceAllBtn
:
SimpleButton
;
...
@@ -166,9 +166,9 @@ export class FindWidget extends Widget implements EditorBrowser.IOverlayWidget {
...
@@ -166,9 +166,9 @@ export class FindWidget extends Widget implements EditorBrowser.IOverlayWidget {
}
}
if
(
e
.
searchScope
)
{
if
(
e
.
searchScope
)
{
if
(
this
.
_state
.
searchScope
)
{
if
(
this
.
_state
.
searchScope
)
{
this
.
_toggleSelectionFind
.
check
box
.
check
ed
=
true
;
this
.
_toggleSelectionFind
.
checked
=
true
;
}
else
{
}
else
{
this
.
_toggleSelectionFind
.
check
box
.
check
ed
=
false
;
this
.
_toggleSelectionFind
.
checked
=
false
;
}
}
this
.
_updateToggleSelectionFindButton
();
this
.
_updateToggleSelectionFindButton
();
}
}
...
@@ -364,15 +364,18 @@ export class FindWidget extends Widget implements EditorBrowser.IOverlayWidget {
...
@@ -364,15 +364,18 @@ export class FindWidget extends Widget implements EditorBrowser.IOverlayWidget {
findPart
.
appendChild
(
this
.
_nextBtn
.
domNode
);
findPart
.
appendChild
(
this
.
_nextBtn
.
domNode
);
// Toggle selection button
// Toggle selection button
this
.
_toggleSelectionFind
=
this
.
_register
(
new
Checkbox
(
findPart
,
NLS_TOGGLE_SELECTION_FIND_TITLE
));
this
.
_toggleSelectionFind
=
this
.
_register
(
new
SimpleCheckbox
({
this
.
_toggleSelectionFind
.
disable
();
parent
:
findPart
,
this
.
_register
(
DomUtils
.
addStandardDisposableListener
(
this
.
_toggleSelectionFind
.
checkbox
,
'
change
'
,
(
e
)
=>
{
title
:
NLS_TOGGLE_SELECTION_FIND_TITLE
,
if
(
this
.
_toggleSelectionFind
.
checkbox
.
checked
)
{
onChange
:
()
=>
{
this
.
_reseedFindScope
();
if
(
this
.
_toggleSelectionFind
.
checked
)
{
}
else
{
this
.
_reseedFindScope
();
this
.
_state
.
change
({
searchScope
:
null
},
true
);
}
else
{
this
.
_state
.
change
({
searchScope
:
null
},
true
);
}
}
}
}));
}));
this
.
_toggleSelectionFind
.
disable
();
this
.
_codeEditor
.
addListener
(
EditorCommon
.
EventType
.
CursorSelectionChanged
,
()
=>
{
this
.
_codeEditor
.
addListener
(
EditorCommon
.
EventType
.
CursorSelectionChanged
,
()
=>
{
this
.
_updateToggleSelectionFindButton
();
this
.
_updateToggleSelectionFindButton
();
...
@@ -413,7 +416,7 @@ export class FindWidget extends Widget implements EditorBrowser.IOverlayWidget {
...
@@ -413,7 +416,7 @@ export class FindWidget extends Widget implements EditorBrowser.IOverlayWidget {
return
;
return
;
}
}
if
(
!
this
.
_toggleSelectionFind
.
check
box
.
check
ed
)
{
if
(
!
this
.
_toggleSelectionFind
.
checked
)
{
let
selection
=
this
.
_codeEditor
.
getSelection
();
let
selection
=
this
.
_codeEditor
.
getSelection
();
if
(
selection
.
startLineNumber
===
selection
.
endLineNumber
)
{
if
(
selection
.
startLineNumber
===
selection
.
endLineNumber
)
{
...
@@ -559,24 +562,33 @@ export class FindWidget extends Widget implements EditorBrowser.IOverlayWidget {
...
@@ -559,24 +562,33 @@ export class FindWidget extends Widget implements EditorBrowser.IOverlayWidget {
}
}
}
}
export
class
Checkbox
extends
Widget
{
interface
ISimpleCheckboxOpts
{
parent
:
HTMLElement
;
title
:
string
;
onChange
:
()
=>
void
;
}
class
SimpleCheckbox
extends
Widget
{
private
static
_COUNTER
=
0
;
private
static
_COUNTER
=
0
;
private
_opts
:
ISimpleCheckboxOpts
;
private
_domNode
:
HTMLElement
;
private
_domNode
:
HTMLElement
;
private
_checkbox
:
HTMLInputElement
;
private
_checkbox
:
HTMLInputElement
;
private
_label
:
HTMLLabelElement
;
private
_label
:
HTMLLabelElement
;
constructor
(
parent
:
HTMLElement
,
title
:
string
)
{
constructor
(
opts
:
ISimpleCheckboxOpts
)
{
super
();
super
();
this
.
_opts
=
opts
;
this
.
_domNode
=
document
.
createElement
(
'
div
'
);
this
.
_domNode
=
document
.
createElement
(
'
div
'
);
this
.
_domNode
.
className
=
'
monaco-checkbox
'
;
this
.
_domNode
.
className
=
'
monaco-checkbox
'
;
this
.
_domNode
.
title
=
title
;
this
.
_domNode
.
title
=
t
his
.
_opts
.
t
itle
;
this
.
_checkbox
=
document
.
createElement
(
'
input
'
);
this
.
_checkbox
=
document
.
createElement
(
'
input
'
);
this
.
_checkbox
.
type
=
'
checkbox
'
;
this
.
_checkbox
.
type
=
'
checkbox
'
;
this
.
_checkbox
.
className
=
'
checkbox
'
;
this
.
_checkbox
.
className
=
'
checkbox
'
;
this
.
_checkbox
.
id
=
'
checkbox-
'
+
Checkbox
.
_COUNTER
++
;
this
.
_checkbox
.
id
=
'
checkbox-
'
+
Simple
Checkbox
.
_COUNTER
++
;
this
.
_label
=
document
.
createElement
(
'
label
'
);
this
.
_label
=
document
.
createElement
(
'
label
'
);
this
.
_label
.
className
=
'
label
'
;
this
.
_label
.
className
=
'
label
'
;
...
@@ -586,15 +598,23 @@ export class Checkbox extends Widget {
...
@@ -586,15 +598,23 @@ export class Checkbox extends Widget {
this
.
_domNode
.
appendChild
(
this
.
_checkbox
);
this
.
_domNode
.
appendChild
(
this
.
_checkbox
);
this
.
_domNode
.
appendChild
(
this
.
_label
);
this
.
_domNode
.
appendChild
(
this
.
_label
);
parent
.
appendChild
(
this
.
_domNode
);
this
.
_opts
.
parent
.
appendChild
(
this
.
_domNode
);
this
.
onchange
(
this
.
_checkbox
,
(
e
)
=>
{
this
.
_opts
.
onChange
();
});
}
}
public
get
domNode
():
HTMLElement
{
public
get
domNode
():
HTMLElement
{
return
this
.
_domNode
;
return
this
.
_domNode
;
}
}
public
get
checkbox
():
HTMLInputElement
{
public
get
checked
():
boolean
{
return
this
.
_checkbox
;
return
this
.
_checkbox
.
checked
;
}
public
set
checked
(
newValue
:
boolean
)
{
this
.
_checkbox
.
checked
=
newValue
;
}
}
public
focus
():
void
{
public
focus
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录