Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
d24ad98e
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,发现更多精彩内容 >>
提交
d24ad98e
编写于
2月 19, 2021
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Convert to switch/case
This makes the logic more clear
上级
8b72fdc3
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
121 addition
and
74 deletion
+121
-74
src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts
...ntrib/notebook/browser/view/renderers/backLayerWebView.ts
+121
-74
未找到文件。
src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts
浏览文件 @
d24ad98e
...
...
@@ -755,8 +755,14 @@ var requirejs = (function() {
return
;
}
if
(
data
.
__vscode_notebook_message
)
{
if
(
data
.
type
===
'
dimension
'
)
{
if
(
!
data
.
__vscode_notebook_message
)
{
this
.
_onMessage
.
fire
({
message
:
data
});
return
;
}
switch
(
data
.
type
)
{
case
'
dimension
'
:
{
if
(
data
.
isOutput
)
{
const
height
=
data
.
data
.
height
;
const
outputHeight
=
height
;
...
...
@@ -770,7 +776,10 @@ var requirejs = (function() {
const
cellId
=
data
.
id
.
substr
(
0
,
data
.
id
.
length
-
'
_preview
'
.
length
);
this
.
notebookEditor
.
updateMarkdownCellHeight
(
cellId
,
data
.
data
.
height
,
!!
data
.
init
);
}
}
else
if
(
data
.
type
===
'
mouseenter
'
)
{
break
;
}
case
'
mouseenter
'
:
{
const
resolvedResult
=
this
.
resolveOutputId
(
data
.
id
);
if
(
resolvedResult
)
{
const
latestCell
=
this
.
notebookEditor
.
getCellByInfo
(
resolvedResult
.
cellInfo
);
...
...
@@ -778,7 +787,10 @@ var requirejs = (function() {
latestCell
.
outputIsHovered
=
true
;
}
}
}
else
if
(
data
.
type
===
'
mouseleave
'
)
{
break
;
}
case
'
mouseleave
'
:
{
const
resolvedResult
=
this
.
resolveOutputId
(
data
.
id
);
if
(
resolvedResult
)
{
const
latestCell
=
this
.
notebookEditor
.
getCellByInfo
(
resolvedResult
.
cellInfo
);
...
...
@@ -786,17 +798,26 @@ var requirejs = (function() {
latestCell
.
outputIsHovered
=
false
;
}
}
}
else
if
(
data
.
type
===
'
scroll-ack
'
)
{
break
;
}
case
'
scroll-ack
'
:
{
// const date = new Date();
// const top = data.data.top;
// console.log('ack top ', top, ' version: ', data.version, ' - ', date.getMinutes() + ':' + date.getSeconds() + ':' + date.getMilliseconds());
}
else
if
(
data
.
type
===
'
did-scroll-wheel
'
)
{
break
;
}
case
'
did-scroll-wheel
'
:
{
this
.
notebookEditor
.
triggerScroll
({
...
data
.
payload
,
preventDefault
:
()
=>
{
},
stopPropagation
:
()
=>
{
}
});
}
else
if
(
data
.
type
===
'
focus-editor
'
)
{
break
;
}
case
'
focus-editor
'
:
{
const
resolvedResult
=
this
.
resolveOutputId
(
data
.
id
);
if
(
resolvedResult
)
{
const
latestCell
=
this
.
notebookEditor
.
getCellByInfo
(
resolvedResult
.
cellInfo
);
...
...
@@ -810,42 +831,68 @@ var requirejs = (function() {
this
.
notebookEditor
.
focusNotebookCell
(
latestCell
,
'
editor
'
);
}
}
}
else
if
(
data
.
type
===
'
clicked-data-url
'
)
{
break
;
}
case
'
clicked-data-url
'
:
{
this
.
_onDidClickDataLink
(
data
);
}
else
if
(
data
.
type
===
'
customRendererMessage
'
)
{
break
;
}
case
'
customRendererMessage
'
:
{
this
.
_onMessage
.
fire
({
message
:
data
.
message
,
forRenderer
:
data
.
rendererId
});
}
else
if
(
data
.
type
===
'
focusMarkdownPreview
'
)
{
break
;
}
case
'
focusMarkdownPreview
'
:
{
const
cell
=
this
.
notebookEditor
.
getCellById
(
data
.
cellId
);
if
(
cell
)
{
this
.
notebookEditor
.
focusNotebookCell
(
cell
,
'
container
'
);
}
}
else
if
(
data
.
type
===
'
toggleMarkdownPreview
'
)
{
break
;
}
case
'
toggleMarkdownPreview
'
:
{
this
.
notebookEditor
.
setMarkdownCellEditState
(
data
.
cellId
,
CellEditState
.
Editing
);
}
else
if
(
data
.
type
===
'
mouseEnterMarkdownPreview
'
)
{
break
;
}
case
'
mouseEnterMarkdownPreview
'
:
{
const
cell
=
this
.
notebookEditor
.
getCellById
(
data
.
cellId
);
if
(
cell
instanceof
MarkdownCellViewModel
)
{
cell
.
cellIsHovered
=
true
;
}
}
else
if
(
data
.
type
===
'
mouseLeaveMarkdownPreview
'
)
{
break
;
}
case
'
mouseLeaveMarkdownPreview
'
:
{
const
cell
=
this
.
notebookEditor
.
getCellById
(
data
.
cellId
);
if
(
cell
instanceof
MarkdownCellViewModel
)
{
cell
.
cellIsHovered
=
false
;
}
}
else
if
(
data
.
type
===
'
cell-drag-start
'
)
{
break
;
}
case
'
cell-drag-start
'
:
{
this
.
notebookEditor
.
markdownCellDragStart
(
data
.
cellId
,
data
.
position
);
}
else
if
(
data
.
type
===
'
cell-drag
'
)
{
break
;
}
case
'
cell-drag
'
:
{
this
.
notebookEditor
.
markdownCellDrag
(
data
.
cellId
,
data
.
position
);
}
else
if
(
data
.
type
===
'
cell-drag-end
'
)
{
break
;
}
case
'
cell-drag-end
'
:
{
this
.
notebookEditor
.
markdownCellDragEnd
(
data
.
cellId
,
{
clientY
:
data
.
position
.
clientY
,
ctrlKey
:
data
.
ctrlKey
,
altKey
:
data
.
altKey
,
});
break
;
}
return
;
}
this
.
_onMessage
.
fire
({
message
:
data
});
}));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录