Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
f9b6df5d
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,发现更多精彩内容 >>
提交
f9b6df5d
编写于
7月 22, 2020
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make cell insertion toolbar more compact
Fix #101633
上级
bae379e9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
26 addition
and
47 deletion
+26
-47
src/vs/workbench/contrib/notebook/browser/constants.ts
src/vs/workbench/contrib/notebook/browser/constants.ts
+2
-1
src/vs/workbench/contrib/notebook/browser/media/notebook.css
src/vs/workbench/contrib/notebook/browser/media/notebook.css
+5
-13
src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts
...orkbench/contrib/notebook/browser/notebookEditorWidget.ts
+6
-12
src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
...h/contrib/notebook/browser/view/renderers/cellRenderer.ts
+6
-16
src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.ts
...h/contrib/notebook/browser/viewModel/codeCellViewModel.ts
+2
-2
src/vs/workbench/contrib/notebook/browser/viewModel/markdownCellViewModel.ts
...ntrib/notebook/browser/viewModel/markdownCellViewModel.ts
+5
-3
未找到文件。
src/vs/workbench/contrib/notebook/browser/constants.ts
浏览文件 @
f9b6df5d
...
...
@@ -13,7 +13,8 @@ export const CELL_RUN_GUTTER = 28;
export
const
CODE_CELL_LEFT_MARGIN
=
32
;
export
const
EDITOR_TOOLBAR_HEIGHT
=
0
;
export
const
BOTTOM_CELL_TOOLBAR_HEIGHT
=
28
;
export
const
BOTTOM_CELL_TOOLBAR_HEIGHT
=
18
;
export
const
BOTTOM_CELL_TOOLBAR_OFFSET
=
12
;
export
const
CELL_STATUSBAR_HEIGHT
=
22
;
// Margin above editor
...
...
src/vs/workbench/contrib/notebook/browser/media/notebook.css
浏览文件 @
f9b6df5d
...
...
@@ -488,6 +488,9 @@
.monaco-workbench
.notebookOverlay
>
.cell-list-container
>
.monaco-list
>
.monaco-scrollable-element
>
.monaco-list-rows
>
.monaco-list-row
.cell-bottom-toolbar-container
{
position
:
absolute
;
display
:
flex
;
justify-content
:
center
;
z-index
:
30
;
/* over the focus outline on the editor */
width
:
100%
;
opacity
:
0
;
transition
:
opacity
0.2s
ease-in-out
;
cursor
:
auto
;
...
...
@@ -531,19 +534,8 @@
align-items
:
center
;
}
.monaco-workbench
.notebookOverlay
>
.cell-list-container
>
.monaco-list
>
.monaco-scrollable-element
>
.monaco-list-rows
>
.monaco-list-row
.cell-bottom-toolbar-container
.separator
{
height
:
1px
;
flex-grow
:
1
;
align-self
:
center
;
}
.monaco-workbench
.notebookOverlay
>
.cell-list-container
>
.monaco-list
>
.monaco-scrollable-element
>
.monaco-list-rows
>
.monaco-list-row
.cell-bottom-toolbar-container
.action-item
:first-child::after
{
content
:
' '
;
display
:
block
;
height
:
1px
;
width
:
16px
;
align-self
:
center
;
margin
:
0px
8px
;
.monaco-workbench
.notebookOverlay
>
.cell-list-container
>
.monaco-list
>
.monaco-scrollable-element
>
.monaco-list-rows
>
.monaco-list-row
.cell-bottom-toolbar-container
.action-item
:first-child
{
margin-right
:
16px
;
}
.monaco-workbench
.notebookOverlay
>
.cell-list-container
>
.monaco-list
>
.monaco-scrollable-element
>
.monaco-list-rows
>
.monaco-list-row
.cell-bottom-toolbar-container
span
.codicon
{
...
...
src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts
浏览文件 @
f9b6df5d
...
...
@@ -1669,13 +1669,13 @@ registerThemingParticipant((theme, collector) => {
collector
.
addRule
(
`.notebookOverlay .cell-statusbar-container { border-top: solid 1px
${
editorBackgroundColor
}
; }`
);
collector
.
addRule
(
`.notebookOverlay .monaco-list-row > .monaco-toolbar { background-color:
${
editorBackgroundColor
}
; }`
);
collector
.
addRule
(
`.notebookOverlay .monaco-list-row.cell-drag-image { background-color:
${
editorBackgroundColor
}
; }`
);
collector
.
addRule
(
`.notebookOverlay .cell-bottom-toolbar-container .action-item { background-color:
${
editorBackgroundColor
}
}`
);
}
const
cellToolbarSeperator
=
theme
.
getColor
(
CELL_TOOLBAR_SEPERATOR
);
if
(
cellToolbarSeperator
)
{
collector
.
addRule
(
`.notebookOverlay .cell-bottom-toolbar-container .separator { background-color:
${
cellToolbarSeperator
}
}`
);
collector
.
addRule
(
`.notebookOverlay .cell-bottom-toolbar-container .action-item:first-child::after { background-color:
${
cellToolbarSeperator
}
}`
);
collector
.
addRule
(
`.notebookOverlay .monaco-list-row > .monaco-toolbar { border: solid 1px
${
cellToolbarSeperator
}
; }`
);
collector
.
addRule
(
`.notebookOverlay .cell-bottom-toolbar-container .action-item { border: solid 1px
${
cellToolbarSeperator
}
}`
);
}
const
focusedCellBackgroundColor
=
theme
.
getColor
(
focusedCellBackground
);
...
...
@@ -1712,14 +1712,10 @@ registerThemingParticipant((theme, collector) => {
collector
.
addRule
(
`.notebookOverlay .monaco-list-row.cell-editor-focus .cell-editor-part:before { outline: solid 1px
${
focusedEditorBorderColorColor
}
; }`
);
}
const
editorBorderColor
=
theme
.
getColor
(
notebookCellBorder
);
if
(
editorBorderColor
)
{
collector
.
addRule
(
`.notebookOverlay .monaco-list-row .cell-editor-part:before { outline: solid 1px
${
editorBorderColor
}
; }`
);
}
const
headingBorderColor
=
theme
.
getColor
(
notebookCellBorder
);
if
(
headingBorderColor
)
{
collector
.
addRule
(
`.notebookOverlay .cell.markdown h1 { border-color:
${
headingBorderColor
}
; }`
);
const
cellBorderColor
=
theme
.
getColor
(
notebookCellBorder
);
if
(
cellBorderColor
)
{
collector
.
addRule
(
`.notebookOverlay .cell.markdown h1 { border-color:
${
cellBorderColor
}
; }`
);
collector
.
addRule
(
`.notebookOverlay .monaco-list-row .cell-editor-part:before { outline: solid 1px
${
cellBorderColor
}
; }`
);
}
const
cellStatusSuccessIcon
=
theme
.
getColor
(
cellStatusIconSuccess
);
...
...
@@ -1770,10 +1766,8 @@ registerThemingParticipant((theme, collector) => {
collector
.
addRule
(
`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row > div.cell.code { margin-left:
${
CODE_CELL_LEFT_MARGIN
}
px; }`
);
collector
.
addRule
(
`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row { padding-top:
${
EDITOR_TOP_MARGIN
}
px; }`
);
collector
.
addRule
(
`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row { padding-bottom:
${
CELL_BOTTOM_MARGIN
}
px; }`
);
collector
.
addRule
(
`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row .cell-bottom-toolbar-container { margin-top:
${
CELL_BOTTOM_MARGIN
}
px; }`
);
collector
.
addRule
(
`.notebookOverlay .output { margin: 0px
${
CELL_MARGIN
}
px 0px
${
CODE_CELL_LEFT_MARGIN
+
CELL_RUN_GUTTER
}
px; }`
);
collector
.
addRule
(
`.notebookOverlay .output { width: calc(100% -
${
CODE_CELL_LEFT_MARGIN
+
CELL_RUN_GUTTER
+
(
CELL_MARGIN
*
2
)}
px); }`
);
collector
.
addRule
(
`.notebookOverlay .cell-bottom-toolbar-container { width: calc(100% -
${
CELL_MARGIN
*
2
+
CELL_RUN_GUTTER
}
px); margin: 0px
${
CELL_MARGIN
*
2
}
px 0px
${
CELL_MARGIN
+
CELL_RUN_GUTTER
}
px; }`
);
collector
.
addRule
(
`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row > div.cell.markdown { padding-left:
${
CELL_RUN_GUTTER
}
px; }`
);
collector
.
addRule
(
`.notebookOverlay .cell .run-button-container { width:
${
CELL_RUN_GUTTER
}
px; }`
);
...
...
src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
浏览文件 @
f9b6df5d
...
...
@@ -205,9 +205,6 @@ abstract class AbstractCellRenderer {
}
});
toolbar
.
getContainer
().
style
.
height
=
`
${
BOTTOM_CELL_TOOLBAR_HEIGHT
}
px`
;
container
.
style
.
height
=
`
${
BOTTOM_CELL_TOOLBAR_HEIGHT
}
px`
;
const
cellMenu
=
this
.
instantiationService
.
createInstance
(
CellMenus
);
const
menu
=
disposables
.
add
(
cellMenu
.
getCellInsertionMenu
(
contextKeyService
));
...
...
@@ -221,15 +218,13 @@ abstract class AbstractCellRenderer {
templateData
.
betweenCellToolbar
.
context
=
context
;
const
container
=
templateData
.
bottomCellContainer
;
if
(
element
instanceof
CodeCellViewModel
)
{
const
bottomToolbarOffset
=
element
.
layoutInfo
.
bottomToolbarOffset
;
container
.
style
.
top
=
`
${
bottomToolbarOffset
}
px`
;
templateData
.
elementDisposables
.
add
(
element
.
onDidChangeLayout
(()
=>
{
const
bottomToolbarOffset
=
element
.
layoutInfo
.
bottomToolbarOffset
;
container
.
style
.
top
=
`
${
bottomToolbarOffset
}
px`
;
templateData
.
elementDisposables
.
add
(
element
.
onDidChangeLayout
(()
=>
{
const
bottomToolbarOffset
=
element
.
layoutInfo
.
bottomToolbarOffset
;
container
.
style
.
top
=
`
${
bottomToolbarOffset
}
px`
;
}));
}
}));
}
protected
createToolbar
(
container
:
HTMLElement
):
ToolBar
{
...
...
@@ -352,9 +347,7 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR
const
foldingIndicator
=
DOM
.
append
(
focusIndicator
,
DOM
.
$
(
'
.notebook-folding-indicator
'
));
const
bottomCellContainer
=
DOM
.
append
(
container
,
$
(
'
.cell-bottom-toolbar-container
'
));
DOM
.
append
(
bottomCellContainer
,
$
(
'
.separator
'
));
const
betweenCellToolbar
=
disposables
.
add
(
this
.
createBetweenCellToolbar
(
bottomCellContainer
,
disposables
,
contextKeyService
));
DOM
.
append
(
bottomCellContainer
,
$
(
'
.separator
'
));
const
statusBar
=
this
.
instantiationService
.
createInstance
(
CellEditorStatusBar
,
editorPart
);
const
titleMenu
=
disposables
.
add
(
this
.
cellMenus
.
getCellTitleMenu
(
contextKeyService
));
...
...
@@ -947,11 +940,8 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
const
focusSinkElement
=
DOM
.
append
(
container
,
$
(
'
.cell-editor-focus-sink
'
));
focusSinkElement
.
setAttribute
(
'
tabindex
'
,
'
0
'
);
const
bottomCellContainer
=
DOM
.
append
(
container
,
$
(
'
.cell-bottom-toolbar-container
'
));
DOM
.
append
(
bottomCellContainer
,
$
(
'
.separator
'
));
const
betweenCellToolbar
=
this
.
createBetweenCellToolbar
(
bottomCellContainer
,
disposables
,
contextKeyService
);
DOM
.
append
(
bottomCellContainer
,
$
(
'
.separator
'
));
const
focusIndicatorBottom
=
DOM
.
append
(
container
,
$
(
'
.cell-focus-indicator.cell-focus-indicator-bottom
'
));
const
betweenCellToolbar
=
this
.
createBetweenCellToolbar
(
bottomCellContainer
,
disposables
,
contextKeyService
);
const
titleMenu
=
disposables
.
add
(
this
.
cellMenus
.
getCellTitleMenu
(
contextKeyService
));
...
...
src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.ts
浏览文件 @
f9b6df5d
...
...
@@ -8,7 +8,7 @@ import * as UUID from 'vs/base/common/uuid';
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
*
as
model
from
'
vs/editor/common/model
'
;
import
{
PrefixSumComputer
}
from
'
vs/editor/common/viewModel/prefixSumComputer
'
;
import
{
BOTTOM_CELL_TOOLBAR_HEIGHT
,
CELL_MARGIN
,
CELL_RUN_GUTTER
,
CELL_STATUSBAR_HEIGHT
,
EDITOR_BOTTOM_PADDING
,
EDITOR_TOOLBAR_HEIGHT
,
EDITOR_TOP_MARGIN
,
EDITOR_TOP_PADDING
,
CELL_BOTTOM_MARGIN
,
CODE_CELL_LEFT_MARGIN
}
from
'
vs/workbench/contrib/notebook/browser/constants
'
;
import
{
BOTTOM_CELL_TOOLBAR_HEIGHT
,
CELL_MARGIN
,
CELL_RUN_GUTTER
,
CELL_STATUSBAR_HEIGHT
,
EDITOR_BOTTOM_PADDING
,
EDITOR_TOOLBAR_HEIGHT
,
EDITOR_TOP_MARGIN
,
EDITOR_TOP_PADDING
,
CELL_BOTTOM_MARGIN
,
CODE_CELL_LEFT_MARGIN
,
BOTTOM_CELL_TOOLBAR_OFFSET
}
from
'
vs/workbench/contrib/notebook/browser/constants
'
;
import
{
CellEditState
,
CellFindMatch
,
CodeCellLayoutChangeEvent
,
CodeCellLayoutInfo
,
ICellViewModel
,
NotebookLayoutInfo
,
CodeCellLayoutState
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
NotebookCellTextModel
}
from
'
vs/workbench/contrib/notebook/common/model/notebookCellTextModel
'
;
import
{
CellKind
,
NotebookCellOutputsSplice
,
INotebookSearchOptions
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
...
...
@@ -122,7 +122,7 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod
const
indicatorHeight
=
editorHeight
+
CELL_STATUSBAR_HEIGHT
+
outputTotalHeight
;
const
outputContainerOffset
=
EDITOR_TOOLBAR_HEIGHT
+
EDITOR_TOP_MARGIN
+
editorHeight
+
CELL_STATUSBAR_HEIGHT
;
const
bottomToolbarOffset
=
totalHeight
-
BOTTOM_CELL_TOOLBAR_HEIGHT
;
const
bottomToolbarOffset
=
totalHeight
-
BOTTOM_CELL_TOOLBAR_HEIGHT
-
BOTTOM_CELL_TOOLBAR_OFFSET
;
const
editorWidth
=
state
.
outerWidth
!==
undefined
?
this
.
computeEditorWidth
(
state
.
outerWidth
)
:
this
.
_layoutInfo
?.
editorWidth
;
this
.
_layoutInfo
=
{
...
...
src/vs/workbench/contrib/notebook/browser/viewModel/markdownCellViewModel.ts
浏览文件 @
f9b6df5d
...
...
@@ -8,7 +8,7 @@ import { Emitter, Event } from 'vs/base/common/event';
import
*
as
UUID
from
'
vs/base/common/uuid
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
*
as
model
from
'
vs/editor/common/model
'
;
import
{
BOTTOM_CELL_TOOLBAR_HEIGHT
,
CELL_MARGIN
,
CELL_STATUSBAR_HEIGHT
,
EDITOR_TOP_MARGIN
,
CELL_BOTTOM_MARGIN
,
CODE_CELL_LEFT_MARGIN
}
from
'
vs/workbench/contrib/notebook/browser/constants
'
;
import
{
BOTTOM_CELL_TOOLBAR_HEIGHT
,
CELL_MARGIN
,
CELL_STATUSBAR_HEIGHT
,
EDITOR_TOP_MARGIN
,
CELL_BOTTOM_MARGIN
,
CODE_CELL_LEFT_MARGIN
,
BOTTOM_CELL_TOOLBAR_OFFSET
}
from
'
vs/workbench/contrib/notebook/browser/constants
'
;
import
{
CellFindMatch
,
ICellViewModel
,
MarkdownCellLayoutChangeEvent
,
MarkdownCellLayoutInfo
,
NotebookLayoutInfo
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
MarkdownRenderer
}
from
'
vs/workbench/contrib/notebook/browser/view/renderers/mdRenderer
'
;
import
{
BaseCellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel
'
;
...
...
@@ -93,13 +93,14 @@ export class MarkdownCellViewModel extends BaseCellViewModel implements ICellVie
layoutChange
(
state
:
MarkdownCellLayoutChangeEvent
)
{
// recompute
const
editorWidth
=
state
.
outerWidth
!==
undefined
?
this
.
computeEditorWidth
(
state
.
outerWidth
)
:
this
.
_layoutInfo
.
editorWidth
;
const
totalHeight
=
state
.
totalHeight
===
undefined
?
this
.
_layoutInfo
.
totalHeight
:
state
.
totalHeight
;
this
.
_layoutInfo
=
{
fontInfo
:
state
.
font
||
this
.
_layoutInfo
.
fontInfo
,
editorWidth
,
editorHeight
:
this
.
_editorHeight
,
bottomToolbarOffset
:
BOTTOM_CELL_TOOLBAR_HEIGH
T
,
totalHeight
:
state
.
totalHeight
===
undefined
?
this
.
_layoutInfo
.
totalHeight
:
state
.
totalHeight
bottomToolbarOffset
:
totalHeight
-
BOTTOM_CELL_TOOLBAR_HEIGHT
-
BOTTOM_CELL_TOOLBAR_OFFSE
T
,
totalHeight
};
this
.
_onDidChangeLayout
.
fire
(
state
);
...
...
@@ -115,6 +116,7 @@ export class MarkdownCellViewModel extends BaseCellViewModel implements ICellVie
totalHeight
:
totalHeight
,
editorHeight
:
this
.
_editorHeight
};
this
.
layoutChange
({});
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录