Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6224a65e
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,发现更多精彩内容 >>
提交
6224a65e
编写于
4月 21, 2020
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Preserve focus when duplicating cells
上级
fa28db2b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
19 deletion
+15
-19
src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts
...workbench/contrib/notebook/browser/contrib/coreActions.ts
+11
-8
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
+1
-1
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
+2
-9
src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts
src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts
+1
-1
未找到文件。
src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts
浏览文件 @
6224a65e
...
...
@@ -179,9 +179,10 @@ registerAction2(class extends Action2 {
// Try to select below, fall back on inserting
const
nextCell
=
editor
.
viewModel
?.
viewCells
[
idx
+
1
];
if
(
nextCell
)
{
editor
.
focusNotebookCell
(
nextCell
,
false
);
editor
.
focusNotebookCell
(
nextCell
,
activeCell
.
editState
===
CellEditState
.
Editing
);
}
else
{
await
editor
.
insertNotebookCell
(
activeCell
,
CellKind
.
Code
,
'
below
'
);
const
newCell
=
editor
.
insertNotebookCell
(
activeCell
,
CellKind
.
Code
,
'
below
'
);
editor
.
focusNotebookCell
(
newCell
,
true
);
}
}
});
...
...
@@ -211,7 +212,8 @@ registerAction2(class extends Action2 {
return
;
}
await
editor
.
insertNotebookCell
(
activeCell
,
CellKind
.
Code
,
'
below
'
);
const
newCell
=
editor
.
insertNotebookCell
(
activeCell
,
CellKind
.
Code
,
'
below
'
);
editor
.
focusNotebookCell
(
newCell
,
true
);
}
});
...
...
@@ -410,7 +412,7 @@ async function changeActiveCellToKind(kind: CellKind, accessor: ServicesAccessor
}
const
text
=
activeCell
.
getText
();
await
editor
.
insertNotebookCell
(
activeCell
,
kind
,
'
below
'
,
text
);
editor
.
insertNotebookCell
(
activeCell
,
kind
,
'
below
'
,
text
);
const
idx
=
editor
.
viewModel
?.
getCellIndex
(
activeCell
);
if
(
typeof
idx
!==
'
number
'
)
{
return
;
...
...
@@ -421,7 +423,7 @@ async function changeActiveCellToKind(kind: CellKind, accessor: ServicesAccessor
return
;
}
editor
.
focusNotebookCell
(
newCell
,
true
);
editor
.
focusNotebookCell
(
newCell
,
activeCell
.
editState
===
CellEditState
.
Editing
);
editor
.
deleteNotebookCell
(
activeCell
);
}
...
...
@@ -471,8 +473,8 @@ abstract class InsertCellCommand extends Action2 {
}
}
const
newCell
=
await
context
.
notebookEditor
.
insertNotebookCell
(
context
.
cell
,
this
.
kind
,
this
.
direction
);
await
context
.
notebookEditor
.
focusNotebookCell
(
newCell
,
true
);
const
newCell
=
context
.
notebookEditor
.
insertNotebookCell
(
context
.
cell
,
this
.
kind
,
this
.
direction
);
context
.
notebookEditor
.
focusNotebookCell
(
newCell
,
true
);
}
}
...
...
@@ -690,7 +692,8 @@ async function moveCell(context: INotebookCellActionContext, direction: 'up' | '
async
function
copyCell
(
context
:
INotebookCellActionContext
,
direction
:
'
up
'
|
'
down
'
):
Promise
<
void
>
{
const
text
=
context
.
cell
.
getText
();
const
newCellDirection
=
direction
===
'
up
'
?
'
above
'
:
'
below
'
;
await
context
.
notebookEditor
.
insertNotebookCell
(
context
.
cell
,
context
.
cell
.
cellKind
,
newCellDirection
,
text
);
const
newCell
=
context
.
notebookEditor
.
insertNotebookCell
(
context
.
cell
,
context
.
cell
.
cellKind
,
newCellDirection
,
text
);
context
.
notebookEditor
.
focusNotebookCell
(
newCell
,
true
);
}
registerAction2
(
class
extends
Action2
{
...
...
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
浏览文件 @
6224a65e
...
...
@@ -150,7 +150,7 @@ export interface INotebookEditor {
/**
* Insert a new cell around `cell`
*/
insertNotebookCell
(
cell
:
ICellViewModel
,
type
:
CellKind
,
direction
:
'
above
'
|
'
below
'
,
initialText
?:
string
):
Promise
<
CellViewModel
>
;
insertNotebookCell
(
cell
:
ICellViewModel
,
type
:
CellKind
,
direction
:
'
above
'
|
'
below
'
,
initialText
?:
string
):
CellViewModel
;
/**
* Delete a cell from the notebook
...
...
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
浏览文件 @
6224a65e
...
...
@@ -673,25 +673,18 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
return
new
Promise
(
resolve
=>
{
r
=
resolve
;
});
}
async
insertNotebookCell
(
cell
:
ICellViewModel
,
type
:
CellKind
,
direction
:
'
above
'
|
'
below
'
,
initialText
:
string
=
''
):
Promise
<
CellViewModel
>
{
insertNotebookCell
(
cell
:
ICellViewModel
,
type
:
CellKind
,
direction
:
'
above
'
|
'
below
'
,
initialText
:
string
=
''
):
CellViewModel
{
const
newLanguages
=
this
.
notebookViewModel
!
.
languages
;
const
language
=
newLanguages
&&
newLanguages
.
length
?
newLanguages
[
0
]
:
'
markdown
'
;
const
index
=
this
.
notebookViewModel
!
.
getCellIndex
(
cell
);
const
insertIndex
=
direction
===
'
above
'
?
index
:
index
+
1
;
const
newCell
=
this
.
notebookViewModel
!
.
createCell
(
insertIndex
,
initialText
.
split
(
/
\r?\n
/g
),
language
,
type
,
true
);
this
.
list
?.
focusElement
(
newCell
);
if
(
type
===
CellKind
.
Markdown
)
{
newCell
.
editState
=
CellEditState
.
Editing
;
}
let
r
:
(
cell
:
CellViewModel
)
=>
void
;
DOM
.
scheduleAtNextAnimationFrame
(()
=>
{
this
.
list
?.
revealElementInCenterIfOutsideViewport
(
cell
);
r
(
newCell
);
});
return
new
Promise
(
resolve
=>
{
r
=
resolve
;
});
return
newCell
;
}
async
deleteNotebookCell
(
cell
:
ICellViewModel
):
Promise
<
boolean
>
{
...
...
src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts
浏览文件 @
6224a65e
...
...
@@ -160,7 +160,7 @@ export class TestNotebookEditor implements INotebookEditor {
revealInCenterIfOutsideViewport
(
cell
:
CellViewModel
):
void
{
throw
new
Error
(
'
Method not implemented.
'
);
}
async
insertNotebookCell
(
cell
:
CellViewModel
,
type
:
CellKind
,
direction
:
'
above
'
|
'
below
'
):
Promise
<
CellViewModel
>
{
insertNotebookCell
(
cell
:
CellViewModel
,
type
:
CellKind
,
direction
:
'
above
'
|
'
below
'
):
CellViewModel
{
throw
new
Error
(
'
Method not implemented.
'
);
}
deleteNotebookCell
(
cell
:
CellViewModel
):
Promise
<
boolean
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录