Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7de343c2
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,发现更多精彩内容 >>
提交
7de343c2
编写于
2月 14, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move notebookActions to separate module.
上级
1adc63c0
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
283 addition
and
284 deletion
+283
-284
src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts
...rkbench/contrib/notebook/browser/notebook.contribution.ts
+11
-237
src/vs/workbench/contrib/notebook/browser/notebookActions.ts
src/vs/workbench/contrib/notebook/browser/notebookActions.ts
+225
-0
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
+7
-8
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
+4
-4
src/vs/workbench/contrib/notebook/browser/notebookEditorInput.ts
...workbench/contrib/notebook/browser/notebookEditorInput.ts
+1
-0
src/vs/workbench/contrib/notebook/browser/notebookRegistry.ts
...vs/workbench/contrib/notebook/browser/notebookRegistry.ts
+4
-4
src/vs/workbench/contrib/notebook/browser/output/outputRenderer.ts
...rkbench/contrib/notebook/browser/output/outputRenderer.ts
+2
-2
src/vs/workbench/contrib/notebook/browser/output/transforms/errorTransform.ts
...trib/notebook/browser/output/transforms/errorTransform.ts
+2
-2
src/vs/workbench/contrib/notebook/browser/output/transforms/richTransform.ts
...ntrib/notebook/browser/output/transforms/richTransform.ts
+2
-2
src/vs/workbench/contrib/notebook/browser/output/transforms/streamTransform.ts
...rib/notebook/browser/output/transforms/streamTransform.ts
+2
-2
src/vs/workbench/contrib/notebook/browser/renderers/cellRenderer.ts
...kbench/contrib/notebook/browser/renderers/cellRenderer.ts
+4
-4
src/vs/workbench/contrib/notebook/browser/renderers/codeCell.ts
.../workbench/contrib/notebook/browser/renderers/codeCell.ts
+7
-7
src/vs/workbench/contrib/notebook/browser/renderers/contentWidget.ts
...bench/contrib/notebook/browser/renderers/contentWidget.ts
+4
-4
src/vs/workbench/contrib/notebook/browser/renderers/markdownCell.ts
...kbench/contrib/notebook/browser/renderers/markdownCell.ts
+8
-8
未找到文件。
src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts
浏览文件 @
7de343c2
...
...
@@ -3,29 +3,20 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
IEditorOptions
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
EditorDescriptor
,
Extensions
as
EditorExtensions
,
IEditorRegistry
}
from
'
vs/workbench/browser/editor
'
;
import
{
NotebookEditor
,
NOTEBOOK_EDITOR_FOCUSED
}
from
'
vs/workbench/contrib/notebook/browser/notebookEditor
'
;
import
{
NotebookEditorInput
}
from
'
vs/workbench/contrib/notebook/browser/notebookEditorInput
'
;
import
{
IEditorService
,
IOpenEditorOverride
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
Extensions
as
WorkbenchExtensions
,
IWorkbenchContribution
,
IWorkbenchContributionsRegistry
}
from
'
vs/workbench/common/contributions
'
;
import
{
IEditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
IEditorOptions
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IEditorGroup
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
NotebookEditor
}
from
'
vs/workbench/contrib/notebook/browser/notebookEditor
'
;
import
{
NotebookEditorInput
}
from
'
vs/workbench/contrib/notebook/browser/notebookEditorInput
'
;
import
{
INotebookService
,
NotebookService
}
from
'
vs/workbench/contrib/notebook/browser/notebookService
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
as
WorkbenchActionExtensions
}
from
'
vs/workbench/common/actions
'
;
import
{
IActiveCodeEditor
,
isDiffEditor
,
isCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
SyncActionDescriptor
,
MenuRegistry
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
InputFocusedContextKey
,
InputFocusedContext
}
from
'
vs/platform/contextkey/common/contextkeys
'
;
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
NotebookHandler
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
IEditorGroup
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
IEditorService
,
IOpenEditorOverride
}
from
'
vs/workbench/services/editor/common/editorService
'
;
// Output renderers registration
...
...
@@ -33,6 +24,9 @@ import 'vs/workbench/contrib/notebook/browser/output/transforms/streamTransform'
import
'
vs/workbench/contrib/notebook/browser/output/transforms/errorTransform
'
;
import
'
vs/workbench/contrib/notebook/browser/output/transforms/richTransform
'
;
// Actions
import
'
vs/workbench/contrib/notebook/browser/notebookActions
'
;
Registry
.
as
<
IEditorRegistry
>
(
EditorExtensions
.
Editors
).
registerEditor
(
EditorDescriptor
.
create
(
...
...
@@ -45,140 +39,6 @@ Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
]
);
export
class
ExecuteNotebookCellAction
extends
Action
{
static
readonly
ID
=
'
workbench.action.executeNotebookCell
'
;
static
readonly
LABEL
=
'
Execute Notebook Cell
'
;
constructor
(
id
:
string
,
label
:
string
,
@
IEditorService
private
readonly
editorService
:
IEditorService
,
@
INotebookService
private
readonly
notebookService
:
INotebookService
)
{
super
(
id
,
label
);
}
async
run
():
Promise
<
void
>
{
let
resource
=
this
.
editorService
.
activeEditor
?.
getResource
();
if
(
resource
)
{
let
notebookProviders
=
this
.
notebookService
.
getContributedNotebook
(
resource
!
);
if
(
notebookProviders
.
length
>
0
)
{
let
viewType
=
notebookProviders
[
0
].
id
;
this
.
notebookService
.
executeNotebookActiveCell
(
viewType
,
resource
);
}
}
}
}
export
class
ExecuteNotebookAction
extends
Action
{
static
readonly
ID
=
'
workbench.action.executeNotebook
'
;
static
readonly
LABEL
=
'
Execute Notebook
'
;
constructor
(
id
:
string
,
label
:
string
,
@
IEditorService
private
readonly
editorService
:
IEditorService
,
@
INotebookService
private
readonly
notebookService
:
INotebookService
)
{
super
(
id
,
label
);
}
async
run
():
Promise
<
void
>
{
let
resource
=
this
.
editorService
.
activeEditor
?.
getResource
();
if
(
resource
)
{
let
notebookProviders
=
this
.
notebookService
.
getContributedNotebook
(
resource
!
);
if
(
notebookProviders
.
length
>
0
)
{
let
viewType
=
notebookProviders
[
0
].
id
;
this
.
notebookService
.
executeNotebook
(
viewType
,
resource
);
}
}
}
}
export
class
QuitNotebookEditAction
extends
Action
{
static
readonly
ID
=
'
workbench.action.quitNotebookEdit
'
;
static
readonly
LABEL
=
'
Quit Notebook Cell Editing
'
;
constructor
(
id
:
string
,
label
:
string
,
@
IEditorService
private
readonly
editorService
:
IEditorService
,
@
INotebookService
private
readonly
notebookService
:
INotebookService
)
{
super
(
id
,
label
);
}
async
run
():
Promise
<
void
>
{
let
resource
=
this
.
editorService
.
activeEditor
?.
getResource
();
let
editorControl
=
this
.
editorService
.
activeControl
;
if
(
resource
&&
editorControl
)
{
let
notebookProviders
=
this
.
notebookService
.
getContributedNotebook
(
resource
!
);
if
(
notebookProviders
.
length
>
0
)
{
let
editorViewType
=
((
editorControl
!
as
any
)
as
NotebookHandler
).
viewType
;
let
viewType
=
notebookProviders
[
0
].
id
;
if
(
viewType
===
editorViewType
)
{
let
activeCell
=
((
editorControl
!
as
any
)
as
NotebookHandler
).
getActiveCell
();
if
(
activeCell
)
{
((
editorControl
!
as
any
)
as
NotebookHandler
).
focusNotebookCell
(
activeCell
,
false
);
}
}
}
}
}
}
export
class
EditNotebookCellAction
extends
Action
{
static
readonly
ID
=
'
workbench.action.editNotebookActiveCell
'
;
static
readonly
LABEL
=
'
Edit Notebook Active Cell
'
;
constructor
(
id
:
string
,
label
:
string
,
@
IEditorService
private
readonly
editorService
:
IEditorService
,
@
INotebookService
private
readonly
notebookService
:
INotebookService
)
{
super
(
id
,
label
);
}
async
run
():
Promise
<
void
>
{
let
resource
=
this
.
editorService
.
activeEditor
?.
getResource
();
let
editorControl
=
this
.
editorService
.
activeControl
;
if
(
resource
&&
editorControl
)
{
let
notebookProviders
=
this
.
notebookService
.
getContributedNotebook
(
resource
!
);
if
(
notebookProviders
.
length
>
0
)
{
let
editorViewType
=
((
editorControl
!
as
any
)
as
NotebookHandler
).
viewType
;
let
viewType
=
notebookProviders
[
0
].
id
;
if
(
viewType
===
editorViewType
)
{
let
activeCell
=
((
editorControl
!
as
any
)
as
NotebookHandler
).
getActiveCell
();
if
(
activeCell
)
{
((
editorControl
!
as
any
)
as
NotebookHandler
).
editNotebookCell
(
undefined
,
activeCell
);
}
}
}
}
}
}
export
class
NotebookContribution
implements
IWorkbenchContribution
{
private
_resourceMapping
:
Map
<
string
,
NotebookEditorInput
>
=
new
Map
<
string
,
NotebookEditorInput
>
();
...
...
@@ -190,8 +50,6 @@ export class NotebookContribution implements IWorkbenchContribution {
)
{
this
.
editorService
.
overrideOpenEditor
((
editor
,
options
,
group
)
=>
this
.
onEditorOpening
(
editor
,
options
,
group
));
this
.
registerCommands
();
this
.
editorService
.
onDidActiveEditorChange
(()
=>
{
if
(
this
.
editorService
.
activeEditor
&&
this
.
editorService
.
activeEditor
!
instanceof
NotebookEditorInput
)
{
let
editorInput
=
this
.
editorService
.
activeEditor
!
as
NotebookEditorInput
;
...
...
@@ -229,93 +87,9 @@ export class NotebookContribution implements IWorkbenchContribution {
return
{
override
:
this
.
editorService
.
openEditor
(
input
,
options
,
group
)
};
}
private
registerCommands
()
{
const
workbenchActionsRegistry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
WorkbenchActionExtensions
.
WorkbenchActions
);
workbenchActionsRegistry
.
registerWorkbenchAction
(
SyncActionDescriptor
.
create
(
ExecuteNotebookAction
,
ExecuteNotebookAction
.
ID
,
ExecuteNotebookAction
.
LABEL
),
'
Execute Notebook
'
,
'
Notebook
'
);
MenuRegistry
.
appendMenuItem
(
MenuId
.
EditorTitle
,
{
command
:
{
id
:
'
workbench.action.executeNotebook
'
,
title
:
'
Execute Notebook (Run all cells)
'
,
icon
:
{
id
:
'
codicon/debug-start
'
}
},
order
:
-
1
,
group
:
'
navigation
'
,
when
:
NOTEBOOK_EDITOR_FOCUSED
});
workbenchActionsRegistry
.
registerWorkbenchAction
(
SyncActionDescriptor
.
create
(
ExecuteNotebookCellAction
,
ExecuteNotebookCellAction
.
ID
,
ExecuteNotebookCellAction
.
LABEL
),
'
Execute Notebook Cell
'
,
'
Notebook
'
);
MenuRegistry
.
appendMenuItem
(
MenuId
.
EditorTitle
,
{
command
:
{
id
:
'
workbench.action.executeNotebookCell
'
,
title
:
'
Execute Notebook Cell
'
,
icon
:
{
id
:
'
codicon/debug-continue
'
}
},
order
:
-
1
,
group
:
'
navigation
'
,
when
:
NOTEBOOK_EDITOR_FOCUSED
});
}
}
const
workbenchContributionsRegistry
=
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
);
workbenchContributionsRegistry
.
registerWorkbenchContribution
(
NotebookContribution
,
LifecyclePhase
.
Starting
);
registerSingleton
(
INotebookService
,
NotebookService
);
const
registry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
WorkbenchActionExtensions
.
WorkbenchActions
);
registry
.
registerWorkbenchAction
(
SyncActionDescriptor
.
create
(
EditNotebookCellAction
,
EditNotebookCellAction
.
ID
,
EditNotebookCellAction
.
LABEL
,
{
primary
:
KeyCode
.
Enter
,
},
ContextKeyExpr
.
and
(
NOTEBOOK_EDITOR_FOCUSED
,
ContextKeyExpr
.
not
(
InputFocusedContextKey
)),
),
'
Edit Notebook Active Cell;
'
,
'
Notebook
'
);
registry
.
registerWorkbenchAction
(
SyncActionDescriptor
.
create
(
QuitNotebookEditAction
,
QuitNotebookEditAction
.
ID
,
QuitNotebookEditAction
.
LABEL
,
{
primary
:
KeyCode
.
Escape
,
},
ContextKeyExpr
.
and
(
NOTEBOOK_EDITOR_FOCUSED
,
InputFocusedContext
),
// TODO: It's set to `EditorContrib - 5` to ensure all editor escape commands to work
// but, how about core?
KeybindingWeight
.
EditorContrib
-
5
),
'
Edit Notebook Active Cell;
'
,
'
Notebook
'
);
export
function
getActiveEditor
(
editorService
:
IEditorService
):
IActiveCodeEditor
|
null
{
let
activeTextEditorWidget
=
editorService
.
activeTextEditorWidget
;
if
(
isDiffEditor
(
activeTextEditorWidget
))
{
if
(
activeTextEditorWidget
.
getOriginalEditor
().
hasTextFocus
())
{
activeTextEditorWidget
=
activeTextEditorWidget
.
getOriginalEditor
();
}
else
{
activeTextEditorWidget
=
activeTextEditorWidget
.
getModifiedEditor
();
}
}
if
(
!
isCodeEditor
(
activeTextEditorWidget
)
||
!
activeTextEditorWidget
.
hasModel
())
{
return
null
;
}
return
activeTextEditorWidget
;
}
src/vs/workbench/contrib/notebook/browser/notebookActions.ts
0 → 100644
浏览文件 @
7de343c2
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
SyncActionDescriptor
,
MenuRegistry
,
MenuId
}
from
'
vs/platform/actions/common/actions
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
InputFocusedContext
,
InputFocusedContextKey
}
from
'
vs/platform/contextkey/common/contextkeys
'
;
import
{
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Extensions
as
WorkbenchActionExtensions
,
IWorkbenchActionRegistry
}
from
'
vs/workbench/common/actions
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/browser/notebookService
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
NOTEBOOK_EDITOR_FOCUSED
,
NotebookEditor
}
from
'
vs/workbench/contrib/notebook/browser/notebookEditor
'
;
export
class
ExecuteNotebookCellAction
extends
Action
{
static
readonly
ID
=
'
workbench.action.executeNotebookCell
'
;
static
readonly
LABEL
=
'
Execute Notebook Cell
'
;
constructor
(
id
:
string
,
label
:
string
,
@
IEditorService
private
readonly
editorService
:
IEditorService
,
@
INotebookService
private
readonly
notebookService
:
INotebookService
)
{
super
(
id
,
label
);
}
async
run
():
Promise
<
void
>
{
let
resource
=
this
.
editorService
.
activeEditor
?.
getResource
();
if
(
resource
)
{
let
notebookProviders
=
this
.
notebookService
.
getContributedNotebook
(
resource
!
);
if
(
notebookProviders
.
length
>
0
)
{
let
viewType
=
notebookProviders
[
0
].
id
;
this
.
notebookService
.
executeNotebookActiveCell
(
viewType
,
resource
);
}
}
}
}
export
class
ExecuteNotebookAction
extends
Action
{
static
readonly
ID
=
'
workbench.action.executeNotebook
'
;
static
readonly
LABEL
=
'
Execute Notebook
'
;
constructor
(
id
:
string
,
label
:
string
,
@
IEditorService
private
readonly
editorService
:
IEditorService
,
@
INotebookService
private
readonly
notebookService
:
INotebookService
)
{
super
(
id
,
label
);
}
async
run
():
Promise
<
void
>
{
let
resource
=
this
.
editorService
.
activeEditor
?.
getResource
();
if
(
resource
)
{
let
notebookProviders
=
this
.
notebookService
.
getContributedNotebook
(
resource
!
);
if
(
notebookProviders
.
length
>
0
)
{
let
viewType
=
notebookProviders
[
0
].
id
;
this
.
notebookService
.
executeNotebook
(
viewType
,
resource
);
}
}
}
}
export
class
QuitNotebookEditAction
extends
Action
{
static
readonly
ID
=
'
workbench.action.quitNotebookEdit
'
;
static
readonly
LABEL
=
'
Quit Notebook Cell Editing
'
;
constructor
(
id
:
string
,
label
:
string
,
@
IEditorService
private
readonly
editorService
:
IEditorService
,
@
INotebookService
private
readonly
notebookService
:
INotebookService
)
{
super
(
id
,
label
);
}
async
run
():
Promise
<
void
>
{
let
resource
=
this
.
editorService
.
activeEditor
?.
getResource
();
let
editorControl
=
this
.
editorService
.
activeControl
;
if
(
resource
&&
editorControl
)
{
let
notebookProviders
=
this
.
notebookService
.
getContributedNotebook
(
resource
!
);
if
(
notebookProviders
.
length
>
0
)
{
let
editorViewType
=
(
editorControl
!
as
NotebookEditor
).
viewType
;
let
viewType
=
notebookProviders
[
0
].
id
;
if
(
viewType
===
editorViewType
)
{
let
activeCell
=
(
editorControl
!
as
NotebookEditor
).
getActiveCell
();
if
(
activeCell
)
{
(
editorControl
!
as
NotebookEditor
).
focusNotebookCell
(
activeCell
,
false
);
}
}
}
}
}
}
export
class
EditNotebookCellAction
extends
Action
{
static
readonly
ID
=
'
workbench.action.editNotebookActiveCell
'
;
static
readonly
LABEL
=
'
Edit Notebook Active Cell
'
;
constructor
(
id
:
string
,
label
:
string
,
@
IEditorService
private
readonly
editorService
:
IEditorService
,
@
INotebookService
private
readonly
notebookService
:
INotebookService
)
{
super
(
id
,
label
);
}
async
run
():
Promise
<
void
>
{
let
resource
=
this
.
editorService
.
activeEditor
?.
getResource
();
let
editorControl
=
this
.
editorService
.
activeControl
;
if
(
resource
&&
editorControl
)
{
let
notebookProviders
=
this
.
notebookService
.
getContributedNotebook
(
resource
!
);
if
(
notebookProviders
.
length
>
0
)
{
let
editorViewType
=
(
editorControl
!
as
NotebookEditor
).
viewType
;
let
viewType
=
notebookProviders
[
0
].
id
;
if
(
viewType
===
editorViewType
)
{
let
activeCell
=
(
editorControl
!
as
NotebookEditor
).
getActiveCell
();
if
(
activeCell
)
{
(
editorControl
!
as
NotebookEditor
).
editNotebookCell
(
undefined
,
activeCell
);
}
}
}
}
}
}
const
registry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
WorkbenchActionExtensions
.
WorkbenchActions
);
registry
.
registerWorkbenchAction
(
SyncActionDescriptor
.
create
(
EditNotebookCellAction
,
EditNotebookCellAction
.
ID
,
EditNotebookCellAction
.
LABEL
,
{
primary
:
KeyCode
.
Enter
,
},
ContextKeyExpr
.
and
(
NOTEBOOK_EDITOR_FOCUSED
,
ContextKeyExpr
.
not
(
InputFocusedContextKey
)),
),
'
Edit Notebook Active Cell;
'
,
'
Notebook
'
);
registry
.
registerWorkbenchAction
(
SyncActionDescriptor
.
create
(
QuitNotebookEditAction
,
QuitNotebookEditAction
.
ID
,
QuitNotebookEditAction
.
LABEL
,
{
primary
:
KeyCode
.
Escape
,
},
ContextKeyExpr
.
and
(
NOTEBOOK_EDITOR_FOCUSED
,
InputFocusedContext
),
// TODO: It's set to `EditorContrib - 5` to ensure all editor escape commands to work
// but, how about core?
KeybindingWeight
.
EditorContrib
-
5
),
'
Edit Notebook Active Cell;
'
,
'
Notebook
'
);
registry
.
registerWorkbenchAction
(
SyncActionDescriptor
.
create
(
ExecuteNotebookAction
,
ExecuteNotebookAction
.
ID
,
ExecuteNotebookAction
.
LABEL
),
'
Execute Notebook
'
,
'
Notebook
'
);
registry
.
registerWorkbenchAction
(
SyncActionDescriptor
.
create
(
ExecuteNotebookCellAction
,
ExecuteNotebookCellAction
.
ID
,
ExecuteNotebookCellAction
.
LABEL
),
'
Execute Notebook Cell
'
,
'
Notebook
'
);
MenuRegistry
.
appendMenuItem
(
MenuId
.
EditorTitle
,
{
command
:
{
id
:
'
workbench.action.executeNotebook
'
,
title
:
'
Execute Notebook (Run all cells)
'
,
icon
:
{
id
:
'
codicon/debug-start
'
}
},
order
:
-
1
,
group
:
'
navigation
'
,
when
:
NOTEBOOK_EDITOR_FOCUSED
});
MenuRegistry
.
appendMenuItem
(
MenuId
.
EditorTitle
,
{
command
:
{
id
:
'
workbench.action.executeNotebookCell
'
,
title
:
'
Execute Notebook Cell
'
,
icon
:
{
id
:
'
codicon/debug-continue
'
}
},
order
:
-
1
,
group
:
'
navigation
'
,
when
:
NOTEBOOK_EDITOR_FOCUSED
});
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
浏览文件 @
7de343c2
...
...
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
{
IMouseWheelEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
BareFontInfo
}
from
'
vs/editor/common/config/fontInfo
'
;
...
...
@@ -11,18 +10,18 @@ import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/renderers/cellViewModel
'
;
import
{
OutputRenderer
}
from
'
vs/workbench/contrib/notebook/browser/output/outputRenderer
'
;
export
interface
NotebookHandle
r
{
export
interface
INotebookEdito
r
{
viewType
:
string
|
undefined
;
insertEmptyNotebookCell
(
listI
ndex
:
number
|
undefined
,
cell
:
CellViewModel
,
type
:
'
markdown
'
|
'
code
'
,
direction
:
'
above
'
|
'
below
'
):
Promise
<
void
>
;
deleteNotebookCell
(
listI
ndex
:
number
|
undefined
,
cell
:
CellViewModel
):
void
;
editNotebookCell
(
listI
ndex
:
number
|
undefined
,
cell
:
CellViewModel
):
void
;
saveNotebookCell
(
listI
ndex
:
number
|
undefined
,
cell
:
CellViewModel
):
void
;
insertEmptyNotebookCell
(
i
ndex
:
number
|
undefined
,
cell
:
CellViewModel
,
type
:
'
markdown
'
|
'
code
'
,
direction
:
'
above
'
|
'
below
'
):
Promise
<
void
>
;
deleteNotebookCell
(
i
ndex
:
number
|
undefined
,
cell
:
CellViewModel
):
void
;
editNotebookCell
(
i
ndex
:
number
|
undefined
,
cell
:
CellViewModel
):
void
;
saveNotebookCell
(
i
ndex
:
number
|
undefined
,
cell
:
CellViewModel
):
void
;
focusNotebookCell
(
cell
:
CellViewModel
,
focusEditor
:
boolean
):
void
;
getActiveCell
():
CellViewModel
|
undefined
;
layout
Element
(
cell
:
CellViewModel
,
height
:
number
):
void
;
layout
NotebookCell
(
cell
:
CellViewModel
,
height
:
number
):
void
;
createContentWidget
(
cell
:
CellViewModel
,
index
:
number
,
shadowContent
:
string
,
offset
:
number
):
void
;
disposeViewCell
(
cell
:
CellViewModel
):
void
;
trigger
Whee
l
(
event
:
IMouseWheelEvent
):
void
;
trigger
Scrol
l
(
event
:
IMouseWheelEvent
):
void
;
getFontInfo
():
BareFontInfo
|
undefined
;
getListDimension
():
DOM
.
Dimension
|
null
;
getOutputRenderer
():
OutputRenderer
;
...
...
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
浏览文件 @
7de343c2
...
...
@@ -34,7 +34,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import
{
IContextKeyService
,
IContextKey
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
INotebook
,
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
NotebookHandle
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
INotebookEdito
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
OutputRenderer
}
from
'
vs/workbench/contrib/notebook/browser/output/outputRenderer
'
;
const
$
=
DOM
.
$
;
...
...
@@ -46,7 +46,7 @@ interface INotebookEditorViewState {
editingCells
:
{
[
key
:
number
]:
boolean
};
}
export
class
NotebookEditor
extends
BaseEditor
implements
NotebookHandle
r
{
export
class
NotebookEditor
extends
BaseEditor
implements
INotebookEdito
r
{
static
readonly
ID
:
string
=
'
workbench.editor.notebook
'
;
private
rootElement
!
:
HTMLElement
;
private
body
!
:
HTMLElement
;
...
...
@@ -185,7 +185,7 @@ export class NotebookEditor extends BaseEditor implements NotebookHandler {
return
this
.
dimension
;
}
trigger
Whee
l
(
event
:
IMouseWheelEvent
)
{
trigger
Scrol
l
(
event
:
IMouseWheelEvent
)
{
this
.
list
?.
triggerScrollFromMouseWheelEvent
(
event
);
}
...
...
@@ -339,7 +339,7 @@ export class NotebookEditor extends BaseEditor implements NotebookHandler {
});
}
layout
Element
(
cell
:
CellViewModel
,
height
:
number
)
{
layout
NotebookCell
(
cell
:
CellViewModel
,
height
:
number
)
{
let
relayout
=
(
cell
:
CellViewModel
,
height
:
number
)
=>
{
let
index
=
this
.
model
!
.
getNotebook
().
cells
.
indexOf
(
cell
.
cell
);
if
(
index
>=
0
)
{
...
...
src/vs/workbench/contrib/notebook/browser/notebookEditorInput.ts
浏览文件 @
7de343c2
...
...
@@ -47,6 +47,7 @@ export class NotebookEditorModel extends EditorModel {
return
this
.
_notebook
;
}
// TODO, remove file based notebook from core
let
content
=
this
.
textModel
.
getValue
();
this
.
_notebook
=
JSON
.
parse
(
content
);
return
this
.
_notebook
!
;
...
...
src/vs/workbench/contrib/notebook/browser/notebookRegistry.ts
浏览文件 @
7de343c2
...
...
@@ -5,9 +5,9 @@
import
{
IOutputTransformContribution
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
BrandedService
,
IConstructorSignature1
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
NotebookHandle
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
INotebookEdito
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
export
type
IOutputTransformCtor
=
IConstructorSignature1
<
NotebookHandle
r
,
IOutputTransformContribution
>
;
export
type
IOutputTransformCtor
=
IConstructorSignature1
<
INotebookEdito
r
,
IOutputTransformContribution
>
;
export
interface
IOutputTransformDescription
{
id
:
string
;
...
...
@@ -21,7 +21,7 @@ export namespace NotebookRegistry {
}
}
export
function
registerOutputTransform
<
Services
extends
BrandedService
[]
>
(
id
:
string
,
types
:
string
[],
ctor
:
{
new
(
handler
:
NotebookHandle
r
,
...
services
:
Services
):
IOutputTransformContribution
}):
void
{
export
function
registerOutputTransform
<
Services
extends
BrandedService
[]
>
(
id
:
string
,
types
:
string
[],
ctor
:
{
new
(
handler
:
INotebookEdito
r
,
...
services
:
Services
):
IOutputTransformContribution
}):
void
{
NotebookRegistryImpl
.
INSTANCE
.
registerOutputTransform
(
id
,
types
,
ctor
);
}
...
...
@@ -35,7 +35,7 @@ class NotebookRegistryImpl {
this
.
outputTransforms
=
[];
}
public
registerOutputTransform
<
Services
extends
BrandedService
[]
>
(
id
:
string
,
types
:
string
[],
ctor
:
{
new
(
handler
:
NotebookHandle
r
,
...
services
:
Services
):
IOutputTransformContribution
}):
void
{
public
registerOutputTransform
<
Services
extends
BrandedService
[]
>
(
id
:
string
,
types
:
string
[],
ctor
:
{
new
(
handler
:
INotebookEdito
r
,
...
services
:
Services
):
IOutputTransformContribution
}):
void
{
this
.
outputTransforms
.
push
({
id
:
id
,
types
:
types
,
ctor
:
ctor
as
IOutputTransformCtor
});
}
...
...
src/vs/workbench/contrib/notebook/browser/output/outputRenderer.ts
浏览文件 @
7de343c2
...
...
@@ -7,14 +7,14 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
IOutputTransformContribution
,
IOutput
,
IRenderOutput
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
NotebookRegistry
}
from
'
vs/workbench/contrib/notebook/browser/notebookRegistry
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
NotebookHandle
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
INotebookEdito
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
export
class
OutputRenderer
{
protected
readonly
_contributions
:
{
[
key
:
string
]:
IOutputTransformContribution
;
};
protected
readonly
_mimeTypeMapping
:
{
[
key
:
string
]:
IOutputTransformContribution
;
};
constructor
(
private
readonly
notebookHandler
:
NotebookHandle
r
,
private
readonly
notebookHandler
:
INotebookEdito
r
,
private
readonly
instantiationService
:
IInstantiationService
)
{
this
.
_contributions
=
{};
...
...
src/vs/workbench/contrib/notebook/browser/output/transforms/errorTransform.ts
浏览文件 @
7de343c2
...
...
@@ -9,11 +9,11 @@ import * as DOM from 'vs/base/browser/dom';
import
{
RGBA
,
Color
}
from
'
vs/base/common/color
'
;
import
{
ansiColorIdentifiers
}
from
'
vs/workbench/contrib/terminal/common/terminalColorRegistry
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
NotebookHandle
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
INotebookEdito
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
class
ErrorTransform
implements
IOutputTransformContribution
{
constructor
(
public
handler
:
NotebookHandle
r
,
public
handler
:
INotebookEdito
r
,
@
IThemeService
private
readonly
themeService
:
IThemeService
)
{
}
...
...
src/vs/workbench/contrib/notebook/browser/output/transforms/richTransform.ts
浏览文件 @
7de343c2
...
...
@@ -6,7 +6,7 @@
import
{
IOutputTransformContribution
,
IRenderOutput
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
registerOutputTransform
}
from
'
vs/workbench/contrib/notebook/browser/notebookRegistry
'
;
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
{
NotebookHandle
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
INotebookEdito
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
isArray
}
from
'
vs/base/common/types
'
;
import
*
as
marked
from
'
vs/base/common/marked/marked
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -20,7 +20,7 @@ class RichRenderer implements IOutputTransformContribution {
private
_mdRenderer
:
marked
.
Renderer
=
new
marked
.
Renderer
({
gfm
:
true
});;
constructor
(
public
handler
:
NotebookHandle
r
,
public
handler
:
INotebookEdito
r
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
,
@
IModelService
private
readonly
modelService
:
IModelService
,
@
IModeService
private
readonly
modeService
:
IModeService
...
...
src/vs/workbench/contrib/notebook/browser/output/transforms/streamTransform.ts
浏览文件 @
7de343c2
...
...
@@ -5,11 +5,11 @@
import
{
IOutputTransformContribution
,
IRenderOutput
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
registerOutputTransform
}
from
'
vs/workbench/contrib/notebook/browser/notebookRegistry
'
;
import
{
NotebookHandle
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
INotebookEdito
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
class
StreamRenderer
implements
IOutputTransformContribution
{
constructor
(
handler
:
NotebookHandle
r
handler
:
INotebookEdito
r
)
{
}
...
...
src/vs/workbench/contrib/notebook/browser/renderers/cellRenderer.ts
浏览文件 @
7de343c2
...
...
@@ -22,7 +22,7 @@ import { CellViewModel } from './cellViewModel';
import
{
CodeCell
}
from
'
vs/workbench/contrib/notebook/browser/renderers/codeCell
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
CellRenderTemplate
,
NotebookHandle
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
CellRenderTemplate
,
INotebookEdito
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
export
class
NotebookCellListDelegate
implements
IListVirtualDelegate
<
CellViewModel
>
{
private
_lineHeight
:
number
;
...
...
@@ -58,7 +58,7 @@ class AbstractCellRenderer {
protected
editorOptions
:
IEditorOptions
;
constructor
(
protected
handler
:
NotebookHandle
r
,
protected
handler
:
INotebookEdito
r
,
private
contextMenuService
:
IContextMenuService
,
private
configurationService
:
IConfigurationService
,
language
:
string
...
...
@@ -186,7 +186,7 @@ export class MarkdownCellRenderer extends AbstractCellRenderer implements IListR
private
disposables
:
Map
<
CellViewModel
,
DisposableStore
>
=
new
Map
();
constructor
(
handler
:
NotebookHandle
r
,
handler
:
INotebookEdito
r
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IContextMenuService
contextMenuService
:
IContextMenuService
...
...
@@ -268,7 +268,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
private
disposables
:
Map
<
CellViewModel
,
DisposableStore
>
=
new
Map
();
constructor
(
protected
handler
:
NotebookHandle
r
,
protected
handler
:
INotebookEdito
r
,
@
IContextMenuService
contextMenuService
:
IContextMenuService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
,
...
...
src/vs/workbench/contrib/notebook/browser/renderers/codeCell.ts
浏览文件 @
7de343c2
...
...
@@ -11,11 +11,11 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
CellRenderTemplate
,
NotebookHandle
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
CellRenderTemplate
,
INotebookEdito
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
export
class
CodeCell
extends
Disposable
{
constructor
(
handler
:
NotebookHandle
r
,
handler
:
INotebookEdito
r
,
viewCell
:
CellViewModel
,
templateData
:
CellRenderTemplate
,
themeService
:
IThemeService
,
...
...
@@ -88,9 +88,9 @@ export class CodeCell extends Disposable {
if
(
viewCell
.
outputs
.
length
)
{
let
outputHeight
=
templateData
.
outputContainer
!
.
clientHeight
;
handler
.
layout
Element
(
viewCell
,
e
.
contentHeight
+
32
+
outputHeight
);
handler
.
layout
NotebookCell
(
viewCell
,
e
.
contentHeight
+
32
+
outputHeight
);
}
else
{
handler
.
layout
Element
(
viewCell
,
e
.
contentHeight
+
16
);
handler
.
layout
NotebookCell
(
viewCell
,
e
.
contentHeight
+
16
);
}
}
}
...
...
@@ -124,7 +124,7 @@ export class CodeCell extends Disposable {
let
height
=
elementSizeObserver
.
getHeight
();
if
(
clientHeight
!==
height
)
{
viewCell
.
dynamicHeight
=
totalHeight
+
32
+
height
;
handler
.
layout
Element
(
viewCell
,
totalHeight
+
32
+
height
);
handler
.
layout
NotebookCell
(
viewCell
,
totalHeight
+
32
+
height
);
}
elementSizeObserver
.
dispose
();
...
...
@@ -132,7 +132,7 @@ export class CodeCell extends Disposable {
});
elementSizeObserver
.
startObserving
();
viewCell
.
dynamicHeight
=
totalHeight
+
32
+
clientHeight
;
handler
.
layout
Element
(
viewCell
,
totalHeight
+
32
+
clientHeight
);
handler
.
layout
NotebookCell
(
viewCell
,
totalHeight
+
32
+
clientHeight
);
this
.
_register
(
elementSizeObserver
);
}
...
...
@@ -166,7 +166,7 @@ export class CodeCell extends Disposable {
let
height
=
elementSizeObserver
.
getHeight
();
if
(
clientHeight
!==
height
)
{
viewCell
.
dynamicHeight
=
totalHeight
+
32
+
height
;
handler
.
layout
Element
(
viewCell
,
totalHeight
+
32
+
height
);
handler
.
layout
NotebookCell
(
viewCell
,
totalHeight
+
32
+
height
);
}
elementSizeObserver
.
dispose
();
...
...
src/vs/workbench/contrib/notebook/browser/renderers/contentWidget.ts
浏览文件 @
7de343c2
...
...
@@ -14,7 +14,7 @@ import { URI } from 'vs/base/common/uri';
import
{
WebviewResourceScheme
}
from
'
vs/workbench/contrib/webview/common/resourceLoader
'
;
import
*
as
path
from
'
vs/base/common/path
'
;
import
{
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
NotebookHandle
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
INotebookEdito
r
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
export
interface
IDimentionMessage
{
type
:
'
dimension
'
;
...
...
@@ -75,7 +75,7 @@ export class BackLayerWebView extends Disposable {
public
outputMapping
:
Map
<
string
,
boolean
>
=
new
Map
();
public
preloadsCache
:
Map
<
string
,
boolean
>
=
new
Map
();
constructor
(
public
webviewService
:
IWebviewService
,
public
notebookService
:
INotebookService
,
public
notebookHandler
:
NotebookHandle
r
,
public
environmentSerice
:
IEnvironmentService
)
{
constructor
(
public
webviewService
:
IWebviewService
,
public
notebookService
:
INotebookService
,
public
notebookHandler
:
INotebookEdito
r
,
public
environmentSerice
:
IEnvironmentService
)
{
super
();
this
.
element
=
document
.
createElement
(
'
div
'
);
...
...
@@ -242,7 +242,7 @@ export class BackLayerWebView extends Disposable {
this
.
webview
.
mountTo
(
this
.
element
);
this
.
_register
(
this
.
webview
.
onDidWheel
(
e
=>
{
this
.
notebookHandler
.
trigger
Whee
l
(
e
);
this
.
notebookHandler
.
trigger
Scrol
l
(
e
);
}));
this
.
_register
(
this
.
webview
.
onMessage
((
data
:
IMessage
)
=>
{
...
...
@@ -255,7 +255,7 @@ export class BackLayerWebView extends Disposable {
const
lineHeight
=
this
.
notebookHandler
.
getFontInfo
()?.
lineHeight
??
18
;
const
totalHeight
=
lineNum
*
lineHeight
;
cell
.
dynamicHeight
=
totalHeight
+
32
/* code cell padding */
+
outputHeight
;
this
.
notebookHandler
.
layout
Element
(
cell
,
totalHeight
+
32
/* code cell padding */
+
outputHeight
);
this
.
notebookHandler
.
layout
NotebookCell
(
cell
,
totalHeight
+
32
/* code cell padding */
+
outputHeight
);
}
}
else
if
(
data
.
type
===
'
scroll-ack
'
)
{
// const date = new Date();
...
...
src/vs/workbench/contrib/notebook/browser/renderers/markdownCell.ts
浏览文件 @
7de343c2
...
...
@@ -10,7 +10,7 @@ import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
getResizesObserver
}
from
'
vs/workbench/contrib/notebook/browser/renderers/sizeObserver
'
;
import
{
CELL_MARGIN
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
NotebookHandle
r
,
CellRenderTemplate
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
INotebookEdito
r
,
CellRenderTemplate
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
export
class
StatefullMarkdownCell
extends
Disposable
{
private
editor
:
CodeEditorWidget
|
null
=
null
;
...
...
@@ -20,7 +20,7 @@ export class StatefullMarkdownCell extends Disposable {
private
localDisposables
:
DisposableStore
;
constructor
(
handler
:
NotebookHandle
r
,
handler
:
INotebookEdito
r
,
viewCell
:
CellViewModel
,
templateData
:
CellRenderTemplate
,
editorOptions
:
IEditorOptions
,
...
...
@@ -84,7 +84,7 @@ export class StatefullMarkdownCell extends Disposable {
this
.
cellContainer
.
appendChild
(
renderedHTML
);
}
handler
.
layout
Element
(
viewCell
,
realContentHeight
+
32
+
clientHeight
);
handler
.
layout
NotebookCell
(
viewCell
,
realContentHeight
+
32
+
clientHeight
);
}));
this
.
localDisposables
.
add
(
this
.
editor
.
onDidContentSizeChange
(
e
=>
{
...
...
@@ -98,7 +98,7 @@ export class StatefullMarkdownCell extends Disposable {
}
);
const
clientHeight
=
this
.
cellContainer
.
clientHeight
;
handler
.
layout
Element
(
viewCell
,
e
.
contentHeight
+
32
+
clientHeight
);
handler
.
layout
NotebookCell
(
viewCell
,
e
.
contentHeight
+
32
+
clientHeight
);
}
}));
...
...
@@ -126,20 +126,20 @@ export class StatefullMarkdownCell extends Disposable {
this
.
cellContainer
.
appendChild
(
renderedHTML
);
this
.
localDisposables
.
add
(
markdownRenderer
.
onDidUpdateRender
(()
=>
{
const
clientHeight
=
this
.
cellContainer
.
clientHeight
;
handler
.
layout
Element
(
viewCell
,
clientHeight
);
handler
.
layout
NotebookCell
(
viewCell
,
clientHeight
);
}));
}
}
const
clientHeight
=
this
.
cellContainer
.
clientHeight
;
handler
.
layout
Element
(
viewCell
,
totalHeight
+
32
+
clientHeight
);
handler
.
layout
NotebookCell
(
viewCell
,
totalHeight
+
32
+
clientHeight
);
this
.
editor
.
focus
();
}
else
{
if
(
this
.
editor
)
{
// switch from editing mode
this
.
editingContainer
!
.
style
.
display
=
'
none
'
;
const
clientHeight
=
this
.
cellContainer
.
clientHeight
;
handler
.
layout
Element
(
viewCell
,
clientHeight
);
handler
.
layout
NotebookCell
(
viewCell
,
clientHeight
);
}
else
{
// first time, readonly mode
this
.
editingContainer
!
.
style
.
display
=
'
none
'
;
...
...
@@ -153,7 +153,7 @@ export class StatefullMarkdownCell extends Disposable {
this
.
localDisposables
.
add
(
markdownRenderer
.
onDidUpdateRender
(()
=>
{
const
clientHeight
=
this
.
cellContainer
.
clientHeight
;
handler
.
layout
Element
(
viewCell
,
clientHeight
);
handler
.
layout
NotebookCell
(
viewCell
,
clientHeight
);
}));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录