Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
21e082da
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,发现更多精彩内容 >>
提交
21e082da
编写于
3月 31, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #94088.
上级
8f82b87b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
70 addition
and
11 deletion
+70
-11
src/vs/workbench/contrib/notebook/browser/contrib/notebookActions.ts
...bench/contrib/notebook/browser/contrib/notebookActions.ts
+1
-1
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
+3
-0
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
+5
-0
src/vs/workbench/contrib/notebook/electron-browser/notebook.contribution.ts
...ontrib/notebook/electron-browser/notebook.contribution.ts
+43
-0
src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts
src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts
+4
-0
src/vs/workbench/contrib/webview/electron-browser/webview.contribution.ts
.../contrib/webview/electron-browser/webview.contribution.ts
+1
-0
src/vs/workbench/contrib/webview/electron-browser/webviewCommands.ts
...bench/contrib/webview/electron-browser/webviewCommands.ts
+10
-10
src/vs/workbench/workbench.desktop.main.ts
src/vs/workbench/workbench.desktop.main.ts
+3
-0
未找到文件。
src/vs/workbench/contrib/notebook/browser/contrib/notebookActions.ts
浏览文件 @
21e082da
...
...
@@ -366,7 +366,7 @@ registerAction2(class extends Action2 {
}
});
function
getActiveNotebookEditor
(
editorService
:
IEditorService
):
INotebookEditor
|
undefined
{
export
function
getActiveNotebookEditor
(
editorService
:
IEditorService
):
INotebookEditor
|
undefined
{
// TODO can `isNotebookEditor` be on INotebookEditor to avoid a circular dependency?
const
activeEditorPane
=
editorService
.
activeEditorPane
as
any
|
undefined
;
return
activeEditorPane
?.
isNotebookEditor
?
activeEditorPane
:
undefined
;
...
...
src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts
浏览文件 @
21e082da
...
...
@@ -18,6 +18,7 @@ import { NOTEBOOK_EDITABLE_CONTEXT_KEY } from 'vs/workbench/contrib/notebook/bro
import
{
OutputRenderer
}
from
'
vs/workbench/contrib/notebook/browser/view/output/outputRenderer
'
;
import
{
CellViewModel
,
IModelDecorationsChangeAccessor
,
NotebookViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel
'
;
import
{
CellKind
,
IOutput
,
IRenderOutput
,
NotebookCellMetadata
,
NotebookDocumentMetadata
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
Webview
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
export
const
KEYBINDING_CONTEXT_NOTEBOOK_FIND_WIDGET_FOCUSED
=
new
RawContextKey
<
boolean
>
(
'
notebookFindWidgetFocused
'
,
false
);
...
...
@@ -88,6 +89,8 @@ export interface INotebookEditor {
isNotebookEditor
:
boolean
;
getInnerWebview
():
Webview
|
undefined
;
/**
* Focus the notebook editor cell list
*/
...
...
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
浏览文件 @
21e082da
...
...
@@ -43,6 +43,7 @@ import { CellViewModel, IModelDecorationsChangeAccessor, INotebookEditorViewStat
import
{
CellKind
,
CellUri
,
IOutput
}
from
'
vs/workbench/contrib/notebook/common/notebookCommon
'
;
import
{
getExtraColor
}
from
'
vs/workbench/contrib/welcome/walkThrough/common/walkThroughUtils
'
;
import
{
IEditorGroup
,
IEditorGroupsService
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
Webview
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
const
$
=
DOM
.
$
;
const
NOTEBOOK_EDITOR_VIEW_STATE_PREFERENCE_KEY
=
'
NotebookEditorViewState
'
;
...
...
@@ -235,6 +236,10 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
return
this
.
control
;
}
getInnerWebview
():
Webview
|
undefined
{
return
this
.
webview
?.
webview
;
}
onHide
()
{
this
.
editorFocus
?.
set
(
false
);
if
(
this
.
webview
)
{
...
...
src/vs/workbench/contrib/notebook/electron-browser/notebook.contribution.ts
0 → 100644
浏览文件 @
21e082da
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
registerAction2
}
from
'
vs/platform/actions/common/actions
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
*
as
webviewCommands
from
'
vs/workbench/contrib/webview/electron-browser/webviewCommands
'
;
import
{
NotebookEditor
}
from
'
vs/workbench/contrib/notebook/browser/notebookEditor
'
;
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ElectronWebviewBasedWebview
}
from
'
vs/workbench/contrib/webview/electron-browser/webviewElement
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
getActiveNotebookEditor
}
from
'
vs/workbench/contrib/notebook/browser/contrib/notebookActions
'
;
function
getActiveElectronBasedWebviewDelegate
(
accessor
:
ServicesAccessor
):
ElectronWebviewBasedWebview
|
undefined
{
const
editorService
=
accessor
.
get
(
IEditorService
);
const
editor
=
getActiveNotebookEditor
(
editorService
);
const
webview
=
editor
?.
getInnerWebview
();
if
(
webview
&&
webview
instanceof
ElectronWebviewBasedWebview
)
{
return
webview
;
}
return
;
}
function
registerNotebookCommands
(
editorId
:
string
):
void
{
const
contextKeyExpr
=
ContextKeyExpr
.
and
(
ContextKeyExpr
.
equals
(
'
activeEditor
'
,
editorId
),
ContextKeyExpr
.
not
(
'
editorFocus
'
)
/* https://github.com/Microsoft/vscode/issues/58668 */
)
!
;
// These commands are only needed on MacOS where we have to disable the menu bar commands
if
(
isMacintosh
)
{
registerAction2
(
class
extends
webviewCommands
.
CopyWebviewEditorCommand
{
constructor
()
{
super
(
contextKeyExpr
,
getActiveElectronBasedWebviewDelegate
);
}
});
registerAction2
(
class
extends
webviewCommands
.
PasteWebviewEditorCommand
{
constructor
()
{
super
(
contextKeyExpr
,
getActiveElectronBasedWebviewDelegate
);
}
});
registerAction2
(
class
extends
webviewCommands
.
CutWebviewEditorCommand
{
constructor
()
{
super
(
contextKeyExpr
,
getActiveElectronBasedWebviewDelegate
);
}
});
registerAction2
(
class
extends
webviewCommands
.
UndoWebviewEditorCommand
{
constructor
()
{
super
(
contextKeyExpr
,
getActiveElectronBasedWebviewDelegate
);
}
});
registerAction2
(
class
extends
webviewCommands
.
RedoWebviewEditorCommand
{
constructor
()
{
super
(
contextKeyExpr
,
getActiveElectronBasedWebviewDelegate
);
}
});
}
}
registerNotebookCommands
(
NotebookEditor
.
ID
);
src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts
浏览文件 @
21e082da
...
...
@@ -20,6 +20,7 @@ import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
import
{
NotebookTextModel
}
from
'
vs/workbench/contrib/notebook/common/model/notebookTextModel
'
;
import
{
NotebookCellTextModel
}
from
'
vs/workbench/contrib/notebook/common/model/notebookCellTextModel
'
;
import
{
NotebookEventDispatcher
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher
'
;
import
{
Webview
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
export
class
TestCell
implements
ICell
{
uri
:
URI
;
...
...
@@ -80,6 +81,9 @@ export class TestNotebookEditor implements INotebookEditor {
constructor
(
)
{
}
getInnerWebview
():
Webview
|
undefined
{
throw
new
Error
(
'
Method not implemented.
'
);
}
executeNotebookCell
(
cell
:
ICellViewModel
):
Promise
<
void
>
{
throw
new
Error
(
'
Method not implemented.
'
);
...
...
src/vs/workbench/contrib/webview/electron-browser/webview.contribution.ts
浏览文件 @
21e082da
...
...
@@ -37,3 +37,4 @@ function registerWebViewCommands(editorId: string): void {
}
registerWebViewCommands
(
WebviewEditor
.
ID
);
registerWebViewCommands
(
'
workbench.editor.notebook
'
);
src/vs/workbench/contrib/webview/electron-browser/webviewCommands.ts
浏览文件 @
21e082da
...
...
@@ -42,7 +42,7 @@ export class CopyWebviewEditorCommand extends Action2 {
public
static
readonly
ID
=
'
editor.action.webvieweditor.copy
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
editor.action.webvieweditor.copy
'
,
"
Copy2
"
);
constructor
(
contextKeyExpr
:
ContextKeyExpression
)
{
constructor
(
contextKeyExpr
:
ContextKeyExpression
,
readonly
getActiveElectronBasedWebviewDelegate
:
(
accessor
:
ServicesAccessor
)
=>
ElectronWebviewBasedWebview
|
undefined
=
getActiveElectronBasedWebview
)
{
super
({
id
:
CopyWebviewEditorCommand
.
ID
,
title
:
CopyWebviewEditorCommand
.
LABEL
,
...
...
@@ -55,7 +55,7 @@ export class CopyWebviewEditorCommand extends Action2 {
}
public
run
(
accessor
:
ServicesAccessor
):
void
{
getActiveElectronBasedWebview
(
accessor
)?.
copy
();
this
.
getActiveElectronBasedWebviewDelegate
(
accessor
)?.
copy
();
}
}
...
...
@@ -63,7 +63,7 @@ export class PasteWebviewEditorCommand extends Action2 {
public
static
readonly
ID
=
'
editor.action.webvieweditor.paste
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
editor.action.webvieweditor.paste
'
,
'
Paste
'
);
constructor
(
contextKeyExpr
:
ContextKeyExpression
)
{
constructor
(
contextKeyExpr
:
ContextKeyExpression
,
readonly
getActiveElectronBasedWebviewDelegate
:
(
accessor
:
ServicesAccessor
)
=>
ElectronWebviewBasedWebview
|
undefined
=
getActiveElectronBasedWebview
)
{
super
({
id
:
PasteWebviewEditorCommand
.
ID
,
title
:
PasteWebviewEditorCommand
.
LABEL
,
...
...
@@ -76,7 +76,7 @@ export class PasteWebviewEditorCommand extends Action2 {
}
public
run
(
accessor
:
ServicesAccessor
):
void
{
getActiveElectronBasedWebview
(
accessor
)?.
paste
();
this
.
getActiveElectronBasedWebviewDelegate
(
accessor
)?.
paste
();
}
}
...
...
@@ -84,7 +84,7 @@ export class CutWebviewEditorCommand extends Action2 {
public
static
readonly
ID
=
'
editor.action.webvieweditor.cut
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
editor.action.webvieweditor.cut
'
,
'
Cut
'
);
constructor
(
contextKeyExpr
:
ContextKeyExpression
)
{
constructor
(
contextKeyExpr
:
ContextKeyExpression
,
readonly
getActiveElectronBasedWebviewDelegate
:
(
accessor
:
ServicesAccessor
)
=>
ElectronWebviewBasedWebview
|
undefined
=
getActiveElectronBasedWebview
)
{
super
({
id
:
CutWebviewEditorCommand
.
ID
,
title
:
CutWebviewEditorCommand
.
LABEL
,
...
...
@@ -97,7 +97,7 @@ export class CutWebviewEditorCommand extends Action2 {
}
public
run
(
accessor
:
ServicesAccessor
):
void
{
getActiveElectronBasedWebview
(
accessor
)?.
cut
();
this
.
getActiveElectronBasedWebviewDelegate
(
accessor
)?.
cut
();
}
}
...
...
@@ -105,7 +105,7 @@ export class UndoWebviewEditorCommand extends Action2 {
public
static
readonly
ID
=
'
editor.action.webvieweditor.undo
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
editor.action.webvieweditor.undo
'
,
"
Undo
"
);
constructor
(
contextKeyExpr
:
ContextKeyExpression
)
{
constructor
(
contextKeyExpr
:
ContextKeyExpression
,
readonly
getActiveElectronBasedWebviewDelegate
:
(
accessor
:
ServicesAccessor
)
=>
ElectronWebviewBasedWebview
|
undefined
=
getActiveElectronBasedWebview
)
{
super
({
id
:
UndoWebviewEditorCommand
.
ID
,
title
:
UndoWebviewEditorCommand
.
LABEL
,
...
...
@@ -118,7 +118,7 @@ export class UndoWebviewEditorCommand extends Action2 {
}
public
run
(
accessor
:
ServicesAccessor
):
void
{
getActiveElectronBasedWebview
(
accessor
)?.
undo
();
this
.
getActiveElectronBasedWebviewDelegate
(
accessor
)?.
undo
();
}
}
...
...
@@ -126,7 +126,7 @@ export class RedoWebviewEditorCommand extends Action2 {
public
static
readonly
ID
=
'
editor.action.webvieweditor.redo
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
editor.action.webvieweditor.redo
'
,
"
Redo
"
);
constructor
(
contextKeyExpr
:
ContextKeyExpression
)
{
constructor
(
contextKeyExpr
:
ContextKeyExpression
,
readonly
getActiveElectronBasedWebviewDelegate
:
(
accessor
:
ServicesAccessor
)
=>
ElectronWebviewBasedWebview
|
undefined
=
getActiveElectronBasedWebview
)
{
super
({
id
:
RedoWebviewEditorCommand
.
ID
,
title
:
RedoWebviewEditorCommand
.
LABEL
,
...
...
@@ -141,7 +141,7 @@ export class RedoWebviewEditorCommand extends Action2 {
}
public
run
(
accessor
:
ServicesAccessor
):
void
{
getActiveElectronBasedWebview
(
accessor
)?.
redo
();
this
.
getActiveElectronBasedWebviewDelegate
(
accessor
)?.
redo
();
}
}
...
...
src/vs/workbench/workbench.desktop.main.ts
浏览文件 @
21e082da
...
...
@@ -107,6 +107,9 @@ import 'vs/workbench/contrib/debug/electron-browser/extensionHostDebugService';
// Webview
import
'
vs/workbench/contrib/webview/electron-browser/webview.contribution
'
;
// Notebook
import
'
vs/workbench/contrib/notebook/electron-browser/notebook.contribution
'
;
// Extensions Management
import
'
vs/workbench/contrib/extensions/electron-browser/extensions.contribution
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录