Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
721886ce
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,发现更多精彩内容 >>
提交
721886ce
编写于
10月 16, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow registerWebviewEditorProvider to pass in a set of initial webview options
Fixes #82128
上级
881e9264
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
23 addition
and
11 deletion
+23
-11
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+1
-0
src/vs/workbench/api/browser/mainThreadWebview.ts
src/vs/workbench/api/browser/mainThreadWebview.ts
+2
-1
src/vs/workbench/api/common/extHost.api.impl.ts
src/vs/workbench/api/common/extHost.api.impl.ts
+2
-2
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-1
src/vs/workbench/api/common/extHostWebview.ts
src/vs/workbench/api/common/extHostWebview.ts
+2
-1
src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts
...ch/contrib/webview/browser/dynamicWebviewEditorOverlay.ts
+14
-5
src/vs/workbench/contrib/webview/browser/webview.ts
src/vs/workbench/contrib/webview/browser/webview.ts
+1
-1
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
721886ce
...
...
@@ -1090,6 +1090,7 @@ declare module 'vscode' {
export
function
registerWebviewEditorProvider
(
viewType
:
string
,
provider
:
WebviewEditorProvider
,
options
?:
WebviewPanelOptions
):
Disposable
;
}
...
...
src/vs/workbench/api/browser/mainThreadWebview.ts
浏览文件 @
721886ce
...
...
@@ -258,7 +258,7 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
this
.
_revivers
.
delete
(
viewType
);
}
public
$registerEditorProvider
(
viewType
:
string
,
extensionId
:
ExtensionIdentifier
,
extensionLocation
:
UriComponents
):
void
{
public
$registerEditorProvider
(
viewType
:
string
,
extensionId
:
ExtensionIdentifier
,
extensionLocation
:
UriComponents
,
options
:
modes
.
IWebviewPanelOptions
):
void
{
if
(
this
.
_editorProviders
.
has
(
viewType
))
{
throw
new
Error
(
`Provider for
${
viewType
}
already registered`
);
}
...
...
@@ -274,6 +274,7 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
this
.
_webviewInputs
.
add
(
handle
,
webviewInput
);
this
.
hookupWebviewEventDelegate
(
handle
,
webviewInput
);
webviewInput
.
webview
.
options
=
options
;
webviewInput
.
webview
.
extension
=
extension
;
if
(
webviewInput
instanceof
CustomFileEditorInput
)
{
...
...
src/vs/workbench/api/common/extHost.api.impl.ts
浏览文件 @
721886ce
...
...
@@ -530,9 +530,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
registerWebviewPanelSerializer
:
(
viewType
:
string
,
serializer
:
vscode
.
WebviewPanelSerializer
)
=>
{
return
extHostWebviews
.
registerWebviewPanelSerializer
(
extension
,
viewType
,
serializer
);
},
registerWebviewEditorProvider
:
(
viewType
:
string
,
provider
:
vscode
.
WebviewEditorProvider
)
=>
{
registerWebviewEditorProvider
:
(
viewType
:
string
,
provider
:
vscode
.
WebviewEditorProvider
,
options
?:
vscode
.
WebviewPanelOptions
)
=>
{
checkProposedApiEnabled
(
extension
);
return
extHostWebviews
.
registerWebviewEditorProvider
(
extension
,
viewType
,
provider
);
return
extHostWebviews
.
registerWebviewEditorProvider
(
extension
,
viewType
,
provider
,
options
);
},
registerDecorationProvider
(
provider
:
vscode
.
DecorationProvider
)
{
checkProposedApiEnabled
(
extension
);
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
721886ce
...
...
@@ -556,7 +556,7 @@ export interface MainThreadWebviewsShape extends IDisposable {
$registerSerializer
(
viewType
:
string
):
void
;
$unregisterSerializer
(
viewType
:
string
):
void
;
$registerEditorProvider
(
viewType
:
string
,
extensionId
:
ExtensionIdentifier
,
extensionLocation
:
UriComponents
):
void
;
$registerEditorProvider
(
viewType
:
string
,
extensionId
:
ExtensionIdentifier
,
extensionLocation
:
UriComponents
,
options
:
modes
.
IWebviewPanelOptions
):
void
;
$unregisterEditorProvider
(
viewType
:
string
):
void
;
}
...
...
src/vs/workbench/api/common/extHostWebview.ts
浏览文件 @
721886ce
...
...
@@ -318,13 +318,14 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
extension
:
IExtensionDescription
,
viewType
:
string
,
provider
:
vscode
.
WebviewEditorProvider
,
options
?:
vscode
.
WebviewPanelOptions
,
):
vscode
.
Disposable
{
if
(
this
.
_editorProviders
.
has
(
viewType
))
{
throw
new
Error
(
`Editor provider for '
${
viewType
}
' already registered`
);
}
this
.
_editorProviders
.
set
(
viewType
,
{
extension
,
provider
,
});
this
.
_proxy
.
$registerEditorProvider
(
viewType
,
extension
.
identifier
,
extension
.
extensionLocation
);
this
.
_proxy
.
$registerEditorProvider
(
viewType
,
extension
.
identifier
,
extension
.
extensionLocation
,
options
||
{}
);
return
new
Disposable
(()
=>
{
this
.
_editorProviders
.
delete
(
viewType
);
...
...
src/vs/workbench/contrib/webview/browser/dynamicWebviewEditorOverlay.ts
浏览文件 @
721886ce
...
...
@@ -26,17 +26,23 @@ export class DynamicWebviewEditorOverlay extends Disposable implements WebviewEd
private
_state
:
string
|
undefined
=
undefined
;
private
_extension
:
WebviewExtensionDescription
|
undefined
;
private
_contentOptions
:
WebviewContentOptions
;
private
_options
:
WebviewOptions
;
private
_owner
:
any
=
undefined
;
public
constructor
(
private
readonly
id
:
string
,
public
readonly
o
ptions
:
WebviewOptions
,
private
_c
ontentOptions
:
WebviewContentOptions
,
initialO
ptions
:
WebviewOptions
,
initialC
ontentOptions
:
WebviewContentOptions
,
@
IWorkbenchLayoutService
private
readonly
_layoutService
:
IWorkbenchLayoutService
,
@
IWebviewService
private
readonly
_webviewService
:
IWebviewService
)
{
super
();
this
.
_options
=
initialOptions
;
this
.
_contentOptions
=
initialContentOptions
;
this
.
_register
(
toDisposable
(()
=>
this
.
container
.
remove
()));
}
...
...
@@ -64,7 +70,7 @@ export class DynamicWebviewEditorOverlay extends Disposable implements WebviewEd
}
this
.
_owner
=
undefined
;
this
.
container
.
style
.
visibility
=
'
hidden
'
;
if
(
!
this
.
options
.
retainContextWhenHidden
)
{
if
(
!
this
.
_
options
.
retainContextWhenHidden
)
{
this
.
_webview
.
clear
();
this
.
_webviewEvents
.
clear
();
}
...
...
@@ -85,12 +91,12 @@ export class DynamicWebviewEditorOverlay extends Disposable implements WebviewEd
private
show
()
{
if
(
!
this
.
_webview
.
value
)
{
const
webview
=
this
.
_webviewService
.
createWebview
(
this
.
id
,
this
.
options
,
this
.
_contentOptions
);
const
webview
=
this
.
_webviewService
.
createWebview
(
this
.
id
,
this
.
_
options
,
this
.
_contentOptions
);
this
.
_webview
.
value
=
webview
;
webview
.
state
=
this
.
_state
;
webview
.
html
=
this
.
_html
;
webview
.
extension
=
this
.
_extension
;
if
(
this
.
options
.
tryRestoreScrollPosition
)
{
if
(
this
.
_
options
.
tryRestoreScrollPosition
)
{
webview
.
initialScrollProgress
=
this
.
_initialScrollProgress
;
}
this
.
_webview
.
value
.
mountTo
(
this
.
container
);
...
...
@@ -136,6 +142,9 @@ export class DynamicWebviewEditorOverlay extends Disposable implements WebviewEd
this
.
withWebview
(
webview
=>
webview
.
state
=
value
);
}
public
get
options
():
WebviewOptions
{
return
this
.
_options
;
}
public
set
options
(
value
:
WebviewOptions
)
{
this
.
_options
=
value
;
}
public
get
contentOptions
():
WebviewContentOptions
{
return
this
.
_contentOptions
;
}
public
set
contentOptions
(
value
:
WebviewContentOptions
)
{
this
.
_contentOptions
=
value
;
...
...
src/vs/workbench/contrib/webview/browser/webview.ts
浏览文件 @
721886ce
...
...
@@ -90,7 +90,7 @@ export interface WebviewElement extends Webview {
export
interface
WebviewEditorOverlay
extends
Webview
{
readonly
container
:
HTMLElement
;
readonly
options
:
WebviewOptions
;
options
:
WebviewOptions
;
claim
(
owner
:
any
):
void
;
release
(
owner
:
any
):
void
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录