Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6e51ec0e
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,发现更多精彩内容 >>
提交
6e51ec0e
编写于
9月 28, 2020
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up tabindex hacking to control tab behavior on settings editor #106897
上级
97ff2827
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
56 addition
and
19 deletion
+56
-19
src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts
.../workbench/contrib/preferences/browser/settingsEditor2.ts
+10
-5
src/vs/workbench/contrib/preferences/browser/settingsTree.ts
src/vs/workbench/contrib/preferences/browser/settingsTree.ts
+13
-12
src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts
...rkbench/contrib/preferences/browser/settingsTreeModels.ts
+33
-2
未找到文件。
src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts
浏览文件 @
6e51ec0e
...
...
@@ -42,7 +42,7 @@ import { IEditorMemento, IEditorOpenContext, IEditorPane } from 'vs/workbench/co
import
{
attachSuggestEnabledInputBoxStyler
,
SuggestEnabledInput
}
from
'
vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput
'
;
import
{
SettingsTarget
,
SettingsTargetsWidget
}
from
'
vs/workbench/contrib/preferences/browser/preferencesWidgets
'
;
import
{
commonlyUsedData
,
tocData
}
from
'
vs/workbench/contrib/preferences/browser/settingsLayout
'
;
import
{
AbstractSettingRenderer
,
ISettingLinkClickEvent
,
ISettingOverrideClickEvent
,
resolveExtensionsSettings
,
resolveSettingsTree
,
SettingsTree
,
SettingTreeRenderers
,
updateSettingTreeTabOrder
}
from
'
vs/workbench/contrib/preferences/browser/settingsTree
'
;
import
{
AbstractSettingRenderer
,
ISettingLinkClickEvent
,
ISettingOverrideClickEvent
,
resolveExtensionsSettings
,
resolveSettingsTree
,
SettingsTree
,
SettingTreeRenderers
}
from
'
vs/workbench/contrib/preferences/browser/settingsTree
'
;
import
{
ISettingsEditorViewState
,
parseQuery
,
SearchResultIdx
,
SearchResultModel
,
SettingsTreeElement
,
SettingsTreeGroupChild
,
SettingsTreeGroupElement
,
SettingsTreeModel
,
SettingsTreeSettingElement
}
from
'
vs/workbench/contrib/preferences/browser/settingsTreeModels
'
;
import
{
settingsTextInputBorder
}
from
'
vs/workbench/contrib/preferences/browser/settingsWidgets
'
;
import
{
createTOCIterator
,
TOCTree
,
TOCTreeModel
}
from
'
vs/workbench/contrib/preferences/browser/tocTree
'
;
...
...
@@ -677,7 +677,6 @@ export class SettingsEditor2 extends EditorPane {
}
this
.
settingsTreeScrollTop
=
this
.
settingsTree
.
scrollTop
;
updateSettingTreeTabOrder
(
this
.
settingsTreeContainer
);
// setTimeout because calling setChildren on the settingsTree can trigger onDidScroll, so it fires when
// setChildren has called on the settings tree but not the toc tree yet, so their rendered elements are out of sync
...
...
@@ -702,11 +701,17 @@ export class SettingsEditor2 extends EditorPane {
return
;
}
if
(
this
.
treeFocusedElement
)
{
this
.
treeFocusedElement
.
tabbable
=
false
;
}
this
.
treeFocusedElement
=
element
;
this
.
settingsTree
.
setSelection
(
element
?
[
element
]
:
[]);
// Wait for rendering to complete
setTimeout
(()
=>
updateSettingTreeTabOrder
(
this
.
settingsTreeContainer
),
0
);
if
(
this
.
treeFocusedElement
)
{
this
.
treeFocusedElement
.
tabbable
=
true
;
}
this
.
settingsTree
.
setSelection
(
element
?
[
element
]
:
[]);
}));
}
...
...
src/vs/workbench/contrib/preferences/browser/settingsTree.ts
浏览文件 @
6e51ec0e
...
...
@@ -481,17 +481,6 @@ function addChildrenToTabOrder(node: Element): void {
});
}
export
function
updateSettingTreeTabOrder
(
container
:
Element
):
void
{
const
allRows
=
[...
container
.
querySelectorAll
(
AbstractSettingRenderer
.
ALL_ROWS_SELECTOR
)];
const
focusedRow
=
allRows
.
find
(
row
=>
row
.
classList
.
contains
(
'
focused
'
));
allRows
.
forEach
(
removeChildrenFromTabOrder
);
if
(
isDefined
(
focusedRow
))
{
addChildrenToTabOrder
(
focusedRow
);
}
}
export
abstract
class
AbstractSettingRenderer
extends
Disposable
implements
ITreeRenderer
<
SettingsTreeElement
,
never
,
any
>
{
/** To override */
abstract
get
templateId
():
string
;
...
...
@@ -525,7 +514,6 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
private
readonly
_onDidChangeIgnoredSettings
=
this
.
_register
(
new
Emitter
<
void
>
());
readonly
onDidChangeIgnoredSettings
:
Event
<
void
>
=
this
.
_onDidChangeIgnoredSettings
.
event
;
// Put common injections back here
constructor
(
private
readonly
settingActions
:
IAction
[],
private
readonly
disposableActionFactory
:
(
setting
:
ISetting
)
=>
IAction
[],
...
...
@@ -744,6 +732,19 @@ export abstract class AbstractSettingRenderer extends Disposable implements ITre
template
.
elementDisposables
.
add
(
this
.
onDidChangeIgnoredSettings
(()
=>
{
update
();
}));
this
.
updateSettingTabbable
(
element
,
template
);
template
.
elementDisposables
.
add
(
element
.
onDidChangeTabbable
(()
=>
{
this
.
updateSettingTabbable
(
element
,
template
);
}));
}
private
updateSettingTabbable
(
element
:
SettingsTreeSettingElement
,
template
:
ISettingItemTemplate
|
ISettingBoolItemTemplate
):
void
{
if
(
element
.
tabbable
)
{
addChildrenToTabOrder
(
template
.
containerElement
);
}
else
{
removeChildrenFromTabOrder
(
template
.
containerElement
);
}
}
private
renderSettingMarkdown
(
element
:
SettingsTreeSettingElement
,
text
:
string
,
disposeables
:
DisposableStore
):
HTMLElement
{
...
...
src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts
浏览文件 @
6e51ec0e
...
...
@@ -16,6 +16,8 @@ import { IExtensionSetting, ISearchResult, ISetting, SettingValueType } from 'vs
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
FOLDER_SCOPES
,
WORKSPACE_SCOPES
,
REMOTE_MACHINE_SCOPES
,
LOCAL_MACHINE_SCOPES
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
IJSONSchema
}
from
'
vs/base/common/jsonSchema
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
export
const
ONLINE_SERVICES_SETTING_TAG
=
'
usesOnlineServices
'
;
...
...
@@ -26,13 +28,27 @@ export interface ISettingsEditorViewState {
filterToCategory
?:
SettingsTreeGroupElement
;
}
export
abstract
class
SettingsTreeElement
{
export
abstract
class
SettingsTreeElement
extends
Disposable
{
id
:
string
;
parent
?:
SettingsTreeGroupElement
;
private
_tabbable
=
false
;
protected
readonly
_onDidChangeTabbable
=
new
Emitter
<
void
>
();
readonly
onDidChangeTabbable
=
this
.
_onDidChangeTabbable
.
event
;
constructor
(
_id
:
string
)
{
super
();
this
.
id
=
_id
;
}
get
tabbable
():
boolean
{
return
this
.
_tabbable
;
}
set
tabbable
(
value
:
boolean
)
{
this
.
_tabbable
=
value
;
this
.
_onDidChangeTabbable
.
fire
();
}
}
export
type
SettingsTreeGroupChild
=
(
SettingsTreeGroupElement
|
SettingsTreeSettingElement
|
SettingsTreeNewExtensionsElement
);
...
...
@@ -293,16 +309,31 @@ export class SettingsTreeModel {
const
newRoot
=
this
.
createSettingsTreeGroupElement
(
newTocRoot
);
if
(
newRoot
.
children
[
0
]
instanceof
SettingsTreeGroupElement
)
{
(
<
SettingsTreeGroupElement
>
newRoot
.
children
[
0
]).
isFirstGroup
=
true
;
// TODO
(
<
SettingsTreeGroupElement
>
newRoot
.
children
[
0
]).
isFirstGroup
=
true
;
}
if
(
this
.
_root
)
{
this
.
disposeChildren
(
this
.
_root
.
children
);
this
.
_root
.
children
=
newRoot
.
children
;
}
else
{
this
.
_root
=
newRoot
;
}
}
private
disposeChildren
(
children
:
SettingsTreeGroupChild
[])
{
for
(
let
child
of
children
)
{
this
.
recursiveDispose
(
child
);
}
}
private
recursiveDispose
(
element
:
SettingsTreeElement
)
{
if
(
element
instanceof
SettingsTreeGroupElement
)
{
this
.
disposeChildren
(
element
.
children
);
}
element
.
dispose
();
}
getElementsByName
(
name
:
string
):
SettingsTreeSettingElement
[]
|
null
{
return
withUndefinedAsNull
(
this
.
_treeElementsBySettingName
.
get
(
name
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录