Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c14e30ae
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,发现更多精彩内容 >>
提交
c14e30ae
编写于
4月 05, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Show error when webview restore fails
上级
753b18dd
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
23 addition
and
10 deletion
+23
-10
extensions/markdown-language-features/src/features/previewManager.ts
...markdown-language-features/src/features/previewManager.ts
+1
-2
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+1
-3
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
+18
-2
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostWebview.ts
src/vs/workbench/api/node/extHostWebview.ts
+2
-2
未找到文件。
extensions/markdown-language-features/src/features/previewManager.ts
浏览文件 @
c14e30ae
...
...
@@ -91,7 +91,7 @@ export class MarkdownPreviewManager implements vscode.WebviewSerializer {
public
async
deserializeWebview
(
webview
:
vscode
.
Webview
,
state
:
any
):
Promise
<
boolean
>
{
):
Promise
<
void
>
{
const
preview
=
await
MarkdownPreview
.
revive
(
webview
,
state
,
...
...
@@ -101,7 +101,6 @@ export class MarkdownPreviewManager implements vscode.WebviewSerializer {
this
.
topmostLineMonitor
);
this
.
registerPreview
(
preview
);
return
true
;
}
public
async
serializeWebview
(
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
c14e30ae
...
...
@@ -658,10 +658,8 @@ declare module 'vscode' {
*
* @param webview Webview to restore. The serializer should take ownership of this webview.
* @param state Persisted state.
*
* @return Was deserialization successful?
*/
deserializeWebview
(
webview
:
Webview
,
state
:
any
):
Thenable
<
boolean
>
;
deserializeWebview
(
webview
:
Webview
,
state
:
any
):
Thenable
<
void
>
;
}
namespace
window
{
...
...
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
浏览文件 @
c14e30ae
...
...
@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
localize
}
from
'
vs/nls
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
*
as
map
from
'
vs/base/common/map
'
;
import
URI
from
'
vs/base/common/uri
'
;
...
...
@@ -132,7 +133,8 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
}
reviveWebview
(
webview
:
WebviewEditorInput
):
TPromise
<
void
>
{
return
this
.
_extensionService
.
activateByEvent
(
`onView:
${
webview
.
state
.
viewType
}
`
).
then
(()
=>
{
const
viewType
=
webview
.
state
.
viewType
;
return
this
.
_extensionService
.
activateByEvent
(
`onView:
${
viewType
}
`
).
then
(()
=>
{
const
handle
=
'
revival-
'
+
MainThreadWebviews
.
revivalPool
++
;
this
.
_webviews
.
set
(
handle
,
webview
);
...
...
@@ -148,7 +150,9 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
};
return
this
.
_proxy
.
$deserializeWebview
(
handle
,
webview
.
state
.
viewType
,
webview
.
state
.
state
,
webview
.
position
,
webview
.
options
)
.
then
(()
=>
{
});
.
then
(
undefined
,
()
=>
{
webview
.
html
=
MainThreadWebviews
.
getDeserializationFailedContents
(
viewType
);
});
});
}
...
...
@@ -231,4 +235,16 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
this
.
_openerService
.
open
(
link
);
}
}
private
static
getDeserializationFailedContents
(
viewType
:
string
)
{
return
`<!DOCTYPE html>
<html>
<head>
<base href="https://code.visualstudio.com/raw/">
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; script-src 'none'; style-src vscode-core-resource: https: 'unsafe-inline'; child-src 'none'; frame-src 'none';">
</head>
<body>
${
localize
(
'
errorMessage
'
,
"
An error occurred while restoring view:{0}
"
,
viewType
)}
</body>
</html>`
;
}
}
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
c14e30ae
...
...
@@ -366,7 +366,7 @@ export interface ExtHostWebviewsShape {
$onDidChangeActiveWeview
(
handle
:
WebviewHandle
|
undefined
):
void
;
$onDidDisposeWeview
(
handle
:
WebviewHandle
):
Thenable
<
void
>
;
$onDidChangePosition
(
handle
:
WebviewHandle
,
newPosition
:
EditorPosition
):
void
;
$deserializeWebview
(
newWebviewHandle
:
WebviewHandle
,
viewType
:
string
,
state
:
any
,
position
:
EditorPosition
,
options
:
vscode
.
WebviewOptions
):
Thenable
<
boolean
>
;
$deserializeWebview
(
newWebviewHandle
:
WebviewHandle
,
viewType
:
string
,
state
:
any
,
position
:
EditorPosition
,
options
:
vscode
.
WebviewOptions
):
Thenable
<
void
>
;
$serializeWebview
(
webviewHandle
:
WebviewHandle
):
Thenable
<
any
>
;
}
...
...
src/vs/workbench/api/node/extHostWebview.ts
浏览文件 @
c14e30ae
...
...
@@ -237,10 +237,10 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
state
:
any
,
position
:
Position
,
options
:
vscode
.
WebviewOptions
):
Thenable
<
boolean
>
{
):
Thenable
<
void
>
{
const
serializer
=
this
.
_serializers
.
get
(
viewType
);
if
(
!
serializer
)
{
return
TPromise
.
as
(
false
);
return
TPromise
.
wrapError
(
new
Error
(
`No serializer found for '
${
viewType
}
'`
)
);
}
const
revivedWebview
=
new
ExtHostWebview
(
webviewHandle
,
this
.
_proxy
,
viewType
,
typeConverters
.
toViewColumn
(
position
),
options
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录