Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
348a4ce2
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,发现更多精彩内容 >>
提交
348a4ce2
编写于
7月 30, 2020
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix cell drop indicator position, and moving cell when dropping over itself
上级
3f15af11
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
14 deletion
+19
-14
src/vs/workbench/contrib/notebook/browser/media/notebook.css
src/vs/workbench/contrib/notebook/browser/media/notebook.css
+0
-6
src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts
...orkbench/contrib/notebook/browser/notebookEditorWidget.ts
+11
-5
src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
...h/contrib/notebook/browser/view/renderers/cellRenderer.ts
+8
-3
未找到文件。
src/vs/workbench/contrib/notebook/browser/media/notebook.css
浏览文件 @
348a4ce2
...
...
@@ -464,12 +464,6 @@
cursor
:
pointer
;
}
.monaco-workbench
.notebookOverlay
.monaco-list
.monaco-list-row
:hover
.cell-focus-indicator
,
.monaco-workbench
.notebookOverlay
.monaco-list
.monaco-list-row.cell-output-hover
.cell-focus-indicator
,
.monaco-workbench
.notebookOverlay
.monaco-list
.monaco-list-row.focused
.cell-focus-indicator
{
opacity
:
1
;
}
.monaco-workbench
.notebookOverlay
.monaco-list-row
.cell-editor-part
:before
{
z-index
:
20
;
content
:
""
;
...
...
src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts
浏览文件 @
348a4ce2
...
...
@@ -1200,7 +1200,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
return
null
;
}
const
newIdx
=
index
+
1
;
const
newIdx
=
index
+
2
;
// This is the adjustment for the index before the cell has been "removed" from its original index
return
this
.
_moveCellToIndex
(
index
,
newIdx
);
}
...
...
@@ -1231,10 +1231,6 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
const
relativeToIndex
=
this
.
_notebookViewModel
!
.
getCellIndex
(
relativeToCell
);
let
newIdx
=
direction
===
'
above
'
?
relativeToIndex
:
relativeToIndex
+
1
;
if
(
originalIdx
<
newIdx
)
{
newIdx
--
;
}
return
this
.
_moveCellToIndex
(
originalIdx
,
newIdx
);
}
...
...
@@ -1247,7 +1243,17 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
return
this
.
_moveCellToIndex
(
originalIdx
,
index
);
}
/**
* @param index The current index of the cell
* @param newIdx The desired index, in an index scheme for the state of the tree before the current cell has been "removed".
* @example to move the cell from index 0 down one spot, call with (0, 2)
*/
private
async
_moveCellToIndex
(
index
:
number
,
newIdx
:
number
):
Promise
<
ICellViewModel
|
null
>
{
if
(
index
<
newIdx
)
{
// The cell is moving "down", it will free up one index spot and consume a new one
newIdx
--
;
}
if
(
index
===
newIdx
)
{
return
null
;
}
...
...
src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.ts
浏览文件 @
348a4ce2
...
...
@@ -622,9 +622,9 @@ export class CellDragAndDropController extends Disposable {
const
dropDirection
=
this
.
getDropInsertDirection
(
event
);
const
insertionIndicatorAbsolutePos
=
dropDirection
===
'
above
'
?
event
.
cellTop
:
event
.
cellTop
+
event
.
cellHeight
;
const
insertionIndicatorTop
=
insertionIndicatorAbsolutePos
-
this
.
list
.
scrollTop
;
const
insertionIndicatorTop
=
insertionIndicatorAbsolutePos
-
this
.
list
.
scrollTop
+
BOTTOM_CELL_TOOLBAR_HEIGHT
/
2
;
if
(
insertionIndicatorTop
>=
0
)
{
this
.
listInsertionIndicator
.
style
.
top
=
`
${
insertionIndicator
AbsolutePos
-
this
.
list
.
scroll
Top
}
px`
;
this
.
listInsertionIndicator
.
style
.
top
=
`
${
insertionIndicatorTop
}
px`
;
this
.
setInsertIndicatorVisibility
(
true
);
}
else
{
this
.
setInsertIndicatorVisibility
(
false
);
...
...
@@ -637,6 +637,11 @@ export class CellDragAndDropController extends Disposable {
private
onCellDrop
(
event
:
CellDragEvent
):
void
{
const
draggedCell
=
this
.
currentDraggedCell
!
;
if
(
this
.
isScrolling
||
this
.
currentDraggedCell
===
event
.
draggedOverCell
)
{
return
;
}
let
draggedCells
:
ICellViewModel
[]
=
[
draggedCell
];
if
(
draggedCell
.
cellKind
===
CellKind
.
Markdown
)
{
...
...
@@ -655,7 +660,7 @@ export class CellDragAndDropController extends Disposable {
const
dropDirection
=
this
.
getDropInsertDirection
(
event
);
const
insertionIndicatorAbsolutePos
=
dropDirection
===
'
above
'
?
event
.
cellTop
:
event
.
cellTop
+
event
.
cellHeight
;
const
insertionIndicatorTop
=
insertionIndicatorAbsolutePos
-
this
.
list
.
scrollTop
;
const
insertionIndicatorTop
=
insertionIndicatorAbsolutePos
-
this
.
list
.
scrollTop
+
BOTTOM_CELL_TOOLBAR_HEIGHT
/
2
;
const
editorHeight
=
this
.
notebookEditor
.
getDomNode
().
getBoundingClientRect
().
height
;
if
(
insertionIndicatorTop
<
0
||
insertionIndicatorTop
>
editorHeight
)
{
// Ignore drop, insertion point is off-screen
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录