Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
dd5ab7d8
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,发现更多精彩内容 >>
提交
dd5ab7d8
编写于
1月 15, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vs loader in webview
上级
15d93779
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
5 deletion
+16
-5
src/vs/workbench/contrib/notebook/browser/contentWidget.ts
src/vs/workbench/contrib/notebook/browser/contentWidget.ts
+11
-2
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
+5
-3
未找到文件。
src/vs/workbench/contrib/notebook/browser/contentWidget.ts
浏览文件 @
dd5ab7d8
...
...
@@ -9,6 +9,9 @@ import * as DOM from 'vs/base/browser/dom';
import
*
as
UUID
from
'
vs/base/common/uuid
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/browser/notebookService
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
WebviewResourceScheme
}
from
'
vs/workbench/contrib/webview/common/resourceLoader
'
;
export
interface
IDimentionMessage
{
...
...
@@ -64,7 +67,7 @@ export class BackLayerWebView extends Disposable {
public
mapping
:
Map
<
string
,
{
cell
:
ViewCell
,
offset
:
number
,
top
:
number
}
>
=
new
Map
();
public
outputMapping
:
Map
<
string
,
boolean
>
=
new
Map
();
constructor
(
public
webviewService
:
IWebviewService
,
public
notebookService
:
INotebookService
,
public
notebookHandler
:
NotebookHandler
)
{
constructor
(
public
webviewService
:
IWebviewService
,
public
notebookService
:
INotebookService
,
public
notebookHandler
:
NotebookHandler
,
public
environmentSerice
:
IEnvironmentService
)
{
super
();
this
.
element
=
document
.
createElement
(
'
div
'
);
...
...
@@ -73,6 +76,8 @@ export class BackLayerWebView extends Disposable {
this
.
element
.
style
.
position
=
'
absolute
'
;
this
.
element
.
style
.
margin
=
'
0px 0 0px 24px
'
;
const
loader
=
URI
.
parse
(
environmentSerice
.
appRoot
+
'
/out/vs/loader.js
'
).
with
({
scheme
:
WebviewResourceScheme
});
let
content
=
/* html */
`
<html lang="en">
<head>
...
...
@@ -87,6 +92,10 @@ export class BackLayerWebView extends Disposable {
</style>
</head>
<body style="overflow: hidden;">
<script>
self.require = {};
</script>
<script src="
${
loader
}
"></script>
<div id='container' class="widgetarea" style="position: absolute;width:100%;"></div>
<script>
(function () {
...
...
@@ -243,7 +252,7 @@ export class BackLayerWebView extends Disposable {
enableFindWidget
:
false
,
},
{
allowScripts
:
true
,
localResourceRoots
:
this
.
notebookService
.
getNotebookProviderResourceRoots
()
localResourceRoots
:
[...
this
.
notebookService
.
getNotebookProviderResourceRoots
(),
URI
.
parse
(
this
.
environmentSerice
.
appRoot
)]
});
webview
.
html
=
content
;
return
webview
;
...
...
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
浏览文件 @
dd5ab7d8
...
...
@@ -29,6 +29,7 @@ import { BareFontInfo } from 'vs/editor/common/config/fontInfo';
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
getZoomLevel
}
from
'
vs/base/browser/browser
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
const
$
=
DOM
.
$
;
const
NOTEBOOK_EDITOR_VIEW_STATE_PREFERENCE_KEY
=
'
NotebookEditorViewState
'
;
...
...
@@ -63,7 +64,8 @@ export class NotebookEditor extends BaseEditor implements NotebookHandler {
@
IWebviewService
private
webviewService
:
IWebviewService
,
@
INotebookService
private
notebookService
:
INotebookService
,
@
IEditorGroupsService
editorGroupService
:
IEditorGroupsService
,
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
,
@
IEnvironmentService
private
readonly
environmentSerice
:
IEnvironmentService
)
{
super
(
NotebookEditor
.
ID
,
telemetryService
,
themeService
,
storageService
);
...
...
@@ -141,7 +143,7 @@ export class NotebookEditor extends BaseEditor implements NotebookHandler {
}
);
this
.
webview
=
new
BackLayerWebView
(
this
.
webviewService
,
this
.
notebookService
,
this
);
this
.
webview
=
new
BackLayerWebView
(
this
.
webviewService
,
this
.
notebookService
,
this
,
this
.
environmentSerice
);
this
.
list
.
view
.
rowsContainer
.
appendChild
(
this
.
webview
.
element
);
this
.
_register
(
this
.
list
);
}
...
...
@@ -236,7 +238,7 @@ export class NotebookEditor extends BaseEditor implements NotebookHandler {
if
(
this
.
webview
)
{
this
.
webview
?.
clearContentWidgets
();
}
else
{
this
.
webview
=
new
BackLayerWebView
(
this
.
webviewService
,
this
.
notebookService
,
this
);
this
.
webview
=
new
BackLayerWebView
(
this
.
webviewService
,
this
.
notebookService
,
this
,
this
.
environmentSerice
);
this
.
list
?.
view
.
rowsContainer
.
insertAdjacentElement
(
'
afterbegin
'
,
this
.
webview
!
.
element
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录