Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
44fe366b
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,发现更多精彩内容 >>
提交
44fe366b
编写于
5月 04, 2020
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish markdown dragging
#96308
上级
49877b3d
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
49 addition
and
18 deletion
+49
-18
src/vs/workbench/contrib/notebook/browser/media/notebook.css
src/vs/workbench/contrib/notebook/browser/media/notebook.css
+18
-7
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
+3
-2
src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
...h/contrib/notebook/browser/view/renderers/cellRenderer.ts
+27
-9
src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts
...h/contrib/notebook/browser/view/renderers/markdownCell.ts
+1
-0
未找到文件。
src/vs/workbench/contrib/notebook/browser/media/notebook.css
浏览文件 @
44fe366b
...
...
@@ -22,7 +22,8 @@
} */
.monaco-workbench
.part.editor
>
.content
.notebook-editor
.cell-list-container
.overflowingContentWidgets
>
div
{
z-index
:
600
!important
;
/* @rebornix: larger than the editor title bar */
z-index
:
600
!important
;
/* @rebornix: larger than the editor title bar */
}
.monaco-workbench
.part.editor
>
.content
.notebook-editor
.cell-list-container
.monaco-list-rows
{
...
...
@@ -74,7 +75,20 @@
}
.monaco-workbench
.part.editor
>
.content
.notebook-editor
>
.cell-list-container
>
.monaco-list
>
.monaco-scrollable-element
>
.monaco-list-rows
>
.monaco-list-row.cell-drag-image
.cell-editor-part
{
width
:
100%
;
width
:
calc
(
100%
-
32px
);
/* minus left gutter */
}
.monaco-workbench
.part.editor
>
.content
.notebook-editor
>
.cell-list-container
>
.monaco-list
>
.monaco-scrollable-element
>
.monaco-list-rows
>
.monaco-list-row.cell-drag-image
.cell-editor-container
>
div
>
div
{
/* Rendered code content - show a single unwrapped line */
height
:
20px
;
overflow
:
hidden
;
white-space
:
pre-wrap
;
}
.monaco-workbench
.part.editor
>
.content
.notebook-editor
>
.cell-list-container
>
.monaco-list
>
.monaco-scrollable-element
>
.monaco-list-rows
>
.monaco-list-row.cell-drag-image.markdown-cell-row
.cell.markdown
{
white-space
:
nowrap
;
overflow
:
hidden
;
}
.monaco-workbench
.part.editor
>
.content
.notebook-editor
>
.cell-list-container
>
.monaco-list
>
.monaco-scrollable-element
>
.monaco-list-rows
>
.monaco-list-row
.cell
{
...
...
@@ -184,7 +198,8 @@
position
:
absolute
;
height
:
26px
;
right
:
36px
;
top
:
-14px
;
/* this lines up the bottom toolbar border with the current line when on line 01 */
top
:
-14px
;
/* this lines up the bottom toolbar border with the current line when on line 01 */
z-index
:
30
;
}
...
...
@@ -605,10 +620,6 @@
cursor
:
pointer
;
}
.monaco-workbench
.part.editor
>
.content
.notebook-editor
>
.cell-list-container
>
.monaco-list
>
.monaco-scrollable-element
>
.monaco-list-rows
>
.monaco-list-row.markdown-cell-row
.cell-editor-part
{
width
:
100%
;
}
/** Theming */
/* .monaco-workbench .part.editor > .content .notebook-editor .cell.markdown pre {
...
...
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
浏览文件 @
44fe366b
...
...
@@ -13,7 +13,7 @@ import { Event } from 'vs/base/common/event';
import
{
DisposableStore
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ScrollEvent
}
from
'
vs/base/common/scrollable
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
CodeEditorWidget
}
from
'
vs/editor/browser/widget/codeEditorWidget
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
BareFontInfo
}
from
'
vs/editor/common/config/fontInfo
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
IPosition
}
from
'
vs/editor/common/core/position
'
;
...
...
@@ -420,6 +420,7 @@ export interface MarkdownCellRenderTemplate extends BaseCellRenderTemplate {
editorPart
:
HTMLElement
;
editorContainer
:
HTMLElement
;
foldingIndicator
:
HTMLElement
;
currentEditor
?:
ICodeEditor
;
}
export
interface
CodeCellRenderTemplate
extends
BaseCellRenderTemplate
{
...
...
@@ -429,7 +430,7 @@ export interface CodeCellRenderTemplate extends BaseCellRenderTemplate {
runButtonContainer
:
HTMLElement
;
executionOrderLabel
:
HTMLElement
;
outputContainer
:
HTMLElement
;
editor
:
CodeEditorWidget
;
editor
:
ICodeEditor
;
progressBar
:
ProgressBar
;
}
...
...
src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
浏览文件 @
44fe366b
...
...
@@ -353,7 +353,7 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR
const
codeInnerContent
=
DOM
.
append
(
container
,
$
(
'
.cell.code
'
));
const
editorPart
=
DOM
.
append
(
codeInnerContent
,
$
(
'
.cell-editor-part
'
));
const
editorContainer
=
DOM
.
append
(
editorPart
,
$
(
'
.
markdown
-editor-container
'
));
const
editorContainer
=
DOM
.
append
(
editorPart
,
$
(
'
.
cell
-editor-container
'
));
editorPart
.
style
.
display
=
'
none
'
;
const
innerContent
=
DOM
.
append
(
container
,
$
(
'
.cell.markdown
'
));
...
...
@@ -385,16 +385,36 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR
}
private
getDragImage
(
templateData
:
MarkdownCellRenderTemplate
):
HTMLElement
{
if
(
templateData
.
currentRenderedCell
!
.
editState
===
CellEditState
.
Editing
)
{
return
this
.
_getEditDragImage
(
templateData
);
}
else
{
return
this
.
_getMarkdownDragImage
(
templateData
);
}
}
private
_getMarkdownDragImage
(
templateData
:
MarkdownCellRenderTemplate
):
HTMLElement
{
const
dragImageContainer
=
DOM
.
$
(
'
.cell-drag-image.monaco-list-row.focused.markdown-cell-row
'
);
dragImageContainer
.
innerHTML
=
templateData
.
container
.
innerHTML
;
// Remove all rendered content nodes after the
const
markdownContent
=
dragImageContainer
.
querySelector
(
'
.cell.markdown
'
)
!
;
const
contentNodes
=
markdownContent
.
children
[
0
].
children
;
for
(
let
i
=
contentNodes
.
length
-
1
;
i
>=
1
;
i
--
)
{
contentNodes
.
item
(
i
)
!
.
remove
();
}
return
dragImageContainer
;
}
private
_getEditDragImage
(
templateData
:
MarkdownCellRenderTemplate
):
HTMLElement
{
return
new
CodeCellDragImageRenderer
().
getDragImage
(
templateData
,
templateData
.
currentEditor
!
,
'
markdown
'
);
}
renderElement
(
element
:
MarkdownCellViewModel
,
index
:
number
,
templateData
:
MarkdownCellRenderTemplate
,
height
:
number
|
undefined
):
void
{
this
.
commonRenderElement
(
element
,
index
,
templateData
);
templateData
.
currentRenderedCell
=
element
;
templateData
.
currentEditor
=
undefined
;
templateData
.
editorPart
!
.
style
.
display
=
'
none
'
;
templateData
.
cellContainer
.
innerHTML
=
''
;
let
renderedHTML
=
element
.
getHTML
();
...
...
@@ -520,8 +540,6 @@ export class CellDragAndDropController {
templateData
.
disposables
.
add
(
domEvent
(
container
,
DOM
.
EventType
.
DRAG_OVER
)(
event
=>
{
event
.
preventDefault
();
const
location
=
this
.
getDropInsertLocation
(
templateData
,
event
);
DOM
.
toggleClass
(
container
,
DRAGOVER_TOP_CLASS
,
location
===
'
above
'
);
DOM
.
toggleClass
(
container
,
DRAGOVER_BOTTOM_CLASS
,
location
===
'
below
'
);
...
...
@@ -672,8 +690,8 @@ class EditorTextRenderer {
}
class
CodeCellDragImageRenderer
{
getDragImage
(
templateData
:
CodeCellRenderTemplate
):
HTMLElement
{
let
dragImage
=
this
.
_getDragImage
(
templateData
);
getDragImage
(
templateData
:
BaseCellRenderTemplate
,
editor
:
ICodeEditor
,
type
:
'
code
'
|
'
markdown
'
):
HTMLElement
{
let
dragImage
=
this
.
_getDragImage
(
templateData
,
editor
,
type
);
if
(
!
dragImage
)
{
// TODO@roblourens I don't think this can happen
dragImage
=
document
.
createElement
(
'
div
'
);
...
...
@@ -683,8 +701,8 @@ class CodeCellDragImageRenderer {
return
dragImage
;
}
private
_getDragImage
(
templateData
:
CodeCellRenderTemplate
):
HTMLElement
|
null
{
const
dragImageContainer
=
DOM
.
$
(
'
.cell-drag-image.monaco-list-row.focused.code-cell-row
'
);
private
_getDragImage
(
templateData
:
BaseCellRenderTemplate
,
editor
:
ICodeEditor
,
type
:
'
code
'
|
'
markdown
'
):
HTMLElement
|
null
{
const
dragImageContainer
=
DOM
.
$
(
`.cell-drag-image.monaco-list-row.focused.
${
type
}
-cell-row`
);
dragImageContainer
.
innerHTML
=
templateData
.
container
.
innerHTML
;
const
editorContainer
=
dragImageContainer
.
querySelector
(
'
.cell-editor-container
'
);
...
...
@@ -697,7 +715,7 @@ class CodeCellDragImageRenderer {
focusIndicator
.
style
.
height
=
'
40px
'
;
}
const
richEditorText
=
new
EditorTextRenderer
().
getRichText
(
templateData
.
editor
,
new
Range
(
1
,
1
,
1
,
1000
));
const
richEditorText
=
new
EditorTextRenderer
().
getRichText
(
editor
,
new
Range
(
1
,
1
,
1
,
1000
));
if
(
!
richEditorText
)
{
return
null
;
}
...
...
@@ -811,7 +829,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
toJSON
:
()
=>
{
return
{};
}
};
this
.
dndController
.
addListeners
(
templateData
,
()
=>
new
CodeCellDragImageRenderer
().
getDragImage
(
templateData
));
this
.
dndController
.
addListeners
(
templateData
,
()
=>
new
CodeCellDragImageRenderer
().
getDragImage
(
templateData
,
templateData
.
editor
,
'
code
'
));
return
templateData
;
}
...
...
src/vs/workbench/contrib/notebook/browser/view/renderers/markdownCell.ts
浏览文件 @
44fe366b
...
...
@@ -87,6 +87,7 @@ export class StatefullMarkdownCell extends Disposable {
height
:
editorHeight
}
},
{});
templateData
.
currentEditor
=
this
.
editor
;
const
cts
=
new
CancellationTokenSource
();
this
.
_register
({
dispose
()
{
cts
.
dispose
(
true
);
}
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录