Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d2ae19e7
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,发现更多精彩内容 >>
提交
d2ae19e7
编写于
3月 26, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #93475. Restrict list view styler to itself.
上级
8932a57a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
127 addition
and
5 deletion
+127
-5
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
+4
-3
src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts
...rkbench/contrib/notebook/browser/view/notebookCellList.ts
+123
-2
未找到文件。
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
浏览文件 @
d2ae19e7
...
...
@@ -198,6 +198,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
multipleSelectionSupport
:
false
,
enableKeyboardNavigation
:
true
,
additionalScrollHeight
:
0
,
styleController
:
(
_suffix
:
string
)
=>
{
return
this
.
list
!
;
},
overrideStyles
:
{
listBackground
:
editorBackground
,
listActiveSelectionBackground
:
editorBackground
,
...
...
@@ -574,16 +575,16 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
moveCellDown
(
cell
:
ICellViewModel
):
void
{
const
index
=
this
.
notebookViewModel
!
.
getViewCellIndex
(
cell
);
const
newIdx
=
index
+
1
;
this
.
moveCellToIndex
(
cell
,
index
,
newIdx
);
this
.
moveCellToIndex
(
index
,
newIdx
);
}
moveCellUp
(
cell
:
ICellViewModel
):
void
{
const
index
=
this
.
notebookViewModel
!
.
getViewCellIndex
(
cell
);
const
newIdx
=
index
-
1
;
this
.
moveCellToIndex
(
cell
,
index
,
newIdx
);
this
.
moveCellToIndex
(
index
,
newIdx
);
}
private
moveCellToIndex
(
cell
:
ICellViewModel
,
index
:
number
,
newIdx
:
number
):
void
{
private
moveCellToIndex
(
index
:
number
,
newIdx
:
number
):
void
{
if
(
!
this
.
notebookViewModel
!
.
moveCellToIdx
(
index
,
newIdx
,
true
))
{
return
;
}
...
...
src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts
浏览文件 @
d2ae19e7
...
...
@@ -19,8 +19,9 @@ import { Range } from 'vs/editor/common/core/range';
import
{
CellRevealType
,
CellRevealPosition
,
CursorAtBoundary
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
IDisposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel
'
;
import
{
IStyleController
,
IListStyles
}
from
'
vs/base/browser/ui/list/listWidget
'
;
export
class
NotebookCellList
extends
WorkbenchList
<
CellViewModel
>
implements
IDisposable
{
export
class
NotebookCellList
extends
WorkbenchList
<
CellViewModel
>
implements
IDisposable
,
IStyleController
{
get
onWillScroll
():
Event
<
ScrollEvent
>
{
return
this
.
view
.
onWillScroll
;
}
get
rowsContainer
():
HTMLElement
{
...
...
@@ -28,7 +29,7 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
}
private
_previousSelectedElements
:
CellViewModel
[]
=
[];
private
_localDisposableStore
=
new
DisposableStore
();
private
styleElement
?:
HTMLStyleElement
;
constructor
(
private
listUser
:
string
,
container
:
HTMLElement
,
...
...
@@ -345,6 +346,126 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
}
}
style
(
styles
:
IListStyles
)
{
const
selectorSuffix
=
this
.
view
.
domId
;
if
(
!
this
.
styleElement
)
{
this
.
styleElement
=
DOM
.
createStyleSheet
(
this
.
view
.
domNode
);
}
const
suffix
=
selectorSuffix
&&
`.
${
selectorSuffix
}
`
;
const
content
:
string
[]
=
[];
if
(
styles
.
listBackground
)
{
if
(
styles
.
listBackground
.
isOpaque
())
{
content
.
push
(
`.monaco-list
${
suffix
}
> div.monaco-scrollable-element > .monaco-list-rows { background:
${
styles
.
listBackground
}
; }`
);
}
else
if
(
!
isMacintosh
)
{
// subpixel AA doesn't exist in macOS
console
.
warn
(
`List with id '
${
selectorSuffix
}
' was styled with a non-opaque background color. This will break sub-pixel antialiasing.`
);
}
}
if
(
styles
.
listFocusBackground
)
{
content
.
push
(
`.monaco-list
${
suffix
}
:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color:
${
styles
.
listFocusBackground
}
; }`
);
content
.
push
(
`.monaco-list
${
suffix
}
:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color:
${
styles
.
listFocusBackground
}
; }`
);
// overwrite :hover style in this case!
}
if
(
styles
.
listFocusForeground
)
{
content
.
push
(
`.monaco-list
${
suffix
}
:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { color:
${
styles
.
listFocusForeground
}
; }`
);
}
if
(
styles
.
listActiveSelectionBackground
)
{
content
.
push
(
`.monaco-list
${
suffix
}
:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color:
${
styles
.
listActiveSelectionBackground
}
; }`
);
content
.
push
(
`.monaco-list
${
suffix
}
:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color:
${
styles
.
listActiveSelectionBackground
}
; }`
);
// overwrite :hover style in this case!
}
if
(
styles
.
listActiveSelectionForeground
)
{
content
.
push
(
`.monaco-list
${
suffix
}
:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color:
${
styles
.
listActiveSelectionForeground
}
; }`
);
}
if
(
styles
.
listFocusAndSelectionBackground
)
{
content
.
push
(
`
.monaco-drag-image,
.monaco-list
${
suffix
}
:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { background-color:
${
styles
.
listFocusAndSelectionBackground
}
; }
`
);
}
if
(
styles
.
listFocusAndSelectionForeground
)
{
content
.
push
(
`
.monaco-drag-image,
.monaco-list
${
suffix
}
:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { color:
${
styles
.
listFocusAndSelectionForeground
}
; }
`
);
}
if
(
styles
.
listInactiveFocusBackground
)
{
content
.
push
(
`.monaco-list
${
suffix
}
> div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color:
${
styles
.
listInactiveFocusBackground
}
; }`
);
content
.
push
(
`.monaco-list
${
suffix
}
> div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color:
${
styles
.
listInactiveFocusBackground
}
; }`
);
// overwrite :hover style in this case!
}
if
(
styles
.
listInactiveSelectionBackground
)
{
content
.
push
(
`.monaco-list
${
suffix
}
> div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color:
${
styles
.
listInactiveSelectionBackground
}
; }`
);
content
.
push
(
`.monaco-list
${
suffix
}
> div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color:
${
styles
.
listInactiveSelectionBackground
}
; }`
);
// overwrite :hover style in this case!
}
if
(
styles
.
listInactiveSelectionForeground
)
{
content
.
push
(
`.monaco-list
${
suffix
}
> div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color:
${
styles
.
listInactiveSelectionForeground
}
; }`
);
}
if
(
styles
.
listHoverBackground
)
{
content
.
push
(
`.monaco-list
${
suffix
}
:not(.drop-target) > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { background-color:
${
styles
.
listHoverBackground
}
; }`
);
}
if
(
styles
.
listHoverForeground
)
{
content
.
push
(
`.monaco-list
${
suffix
}
> div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { color:
${
styles
.
listHoverForeground
}
; }`
);
}
if
(
styles
.
listSelectionOutline
)
{
content
.
push
(
`.monaco-list
${
suffix
}
> div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { outline: 1px dotted
${
styles
.
listSelectionOutline
}
; outline-offset: -1px; }`
);
}
if
(
styles
.
listFocusOutline
)
{
content
.
push
(
`
.monaco-drag-image,
.monaco-list
${
suffix
}
:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px solid
${
styles
.
listFocusOutline
}
; outline-offset: -1px; }
`
);
}
if
(
styles
.
listInactiveFocusOutline
)
{
content
.
push
(
`.monaco-list
${
suffix
}
> div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px dotted
${
styles
.
listInactiveFocusOutline
}
; outline-offset: -1px; }`
);
}
if
(
styles
.
listHoverOutline
)
{
content
.
push
(
`.monaco-list
${
suffix
}
> div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover { outline: 1px dashed
${
styles
.
listHoverOutline
}
; outline-offset: -1px; }`
);
}
if
(
styles
.
listDropBackground
)
{
content
.
push
(
`
.monaco-list
${
suffix
}
.drop-target,
.monaco-list
${
suffix
}
> div.monaco-scrollable-element > .monaco-list-rows.drop-target,
.monaco-list
${
suffix
}
> div.monaco-scrollable-element > .monaco-list-row.drop-target { background-color:
${
styles
.
listDropBackground
}
!important; color: inherit !important; }
`
);
}
if
(
styles
.
listFilterWidgetBackground
)
{
content
.
push
(
`.monaco-list-type-filter { background-color:
${
styles
.
listFilterWidgetBackground
}
}`
);
}
if
(
styles
.
listFilterWidgetOutline
)
{
content
.
push
(
`.monaco-list-type-filter { border: 1px solid
${
styles
.
listFilterWidgetOutline
}
; }`
);
}
if
(
styles
.
listFilterWidgetNoMatchesOutline
)
{
content
.
push
(
`.monaco-list-type-filter.no-matches { border: 1px solid
${
styles
.
listFilterWidgetNoMatchesOutline
}
; }`
);
}
if
(
styles
.
listMatchesShadow
)
{
content
.
push
(
`.monaco-list-type-filter { box-shadow: 1px 1px 1px
${
styles
.
listMatchesShadow
}
; }`
);
}
const
newStyles
=
content
.
join
(
'
\n
'
);
if
(
newStyles
!==
this
.
styleElement
.
innerHTML
)
{
this
.
styleElement
.
innerHTML
=
newStyles
;
}
}
dispose
()
{
this
.
_localDisposableStore
.
dispose
();
super
.
dispose
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录