Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f79540dc
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,发现更多精彩内容 >>
提交
f79540dc
编写于
9月 08, 2020
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add show method to webview view
Fixes #106085
上级
93a0c99f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
29 addition
and
1 deletion
+29
-1
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+9
-0
src/vs/workbench/api/browser/mainThreadWebviewViews.ts
src/vs/workbench/api/browser/mainThreadWebviewViews.ts
+5
-0
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+2
-0
src/vs/workbench/api/common/extHostWebviewView.ts
src/vs/workbench/api/common/extHostWebviewView.ts
+5
-0
src/vs/workbench/contrib/webviewView/browser/webviewViewPane.ts
.../workbench/contrib/webviewView/browser/webviewViewPane.ts
+6
-1
src/vs/workbench/contrib/webviewView/browser/webviewViewService.ts
...rkbench/contrib/webviewView/browser/webviewViewService.ts
+2
-0
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
f79540dc
...
...
@@ -2095,6 +2095,15 @@ declare module 'vscode' {
* Note that hiding a view using the context menu instead disposes of the view and fires `onDidDispose`.
*/
readonly
onDidChangeVisibility
:
Event
<
void
>
;
/**
* Reveal the view in the UI.
*
* If the view is collapsed, this will expand it.
*
* @param preserveFocus When `true` the view will not take focus.
*/
show
(
preserveFocus
?:
boolean
):
void
;
}
interface
WebviewViewResolveContext
<
T
=
unknown
>
{
...
...
src/vs/workbench/api/browser/mainThreadWebviewViews.ts
浏览文件 @
f79540dc
...
...
@@ -38,6 +38,11 @@ export class MainThreadWebviewsViews extends Disposable implements extHostProtoc
webviewView
.
description
=
value
;
}
public
$show
(
handle
:
extHostProtocol
.
WebviewHandle
,
preserveFocus
:
boolean
):
void
{
const
webviewView
=
this
.
getWebviewView
(
handle
);
webviewView
.
show
(
preserveFocus
);
}
public
$registerWebviewViewProvider
(
viewType
:
string
,
options
?:
{
retainContextWhenHidden
?:
boolean
}):
void
{
if
(
this
.
_webviewViewProviders
.
has
(
viewType
))
{
throw
new
Error
(
`View provider for
${
viewType
}
already registered`
);
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
f79540dc
...
...
@@ -641,6 +641,8 @@ export interface MainThreadWebviewViewsShape extends IDisposable {
$setWebviewViewTitle
(
handle
:
WebviewHandle
,
value
:
string
|
undefined
):
void
;
$setWebviewViewDescription
(
handle
:
WebviewHandle
,
value
:
string
|
undefined
):
void
;
$show
(
handle
:
WebviewHandle
,
preserveFocus
:
boolean
):
void
;
}
export
interface
WebviewPanelViewStateData
{
...
...
src/vs/workbench/api/common/extHostWebviewView.ts
浏览文件 @
f79540dc
...
...
@@ -99,6 +99,11 @@ class ExtHostWebviewView extends Disposable implements vscode.WebviewView {
this
.
#
onDidChangeVisibility
.
fire
();
}
public
show
(
preserveFocus
?:
boolean
):
void
{
this
.
assertNotDisposed
();
this
.
#
proxy
.
$show
(
this
.
#
handle
,
!!
preserveFocus
);
}
private
assertNotDisposed
()
{
if
(
this
.
#
isDisposed
)
{
throw
new
Error
(
'
Webview is disposed
'
);
...
...
src/vs/workbench/contrib/webviewView/browser/webviewViewPane.ts
浏览文件 @
f79540dc
...
...
@@ -21,7 +21,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import
{
ViewPane
}
from
'
vs/workbench/browser/parts/views/viewPaneContainer
'
;
import
{
IViewletViewOptions
}
from
'
vs/workbench/browser/parts/views/viewsViewlet
'
;
import
{
Memento
,
MementoObject
}
from
'
vs/workbench/common/memento
'
;
import
{
IViewDescriptorService
}
from
'
vs/workbench/common/views
'
;
import
{
IViewDescriptorService
,
IViewsService
}
from
'
vs/workbench/common/views
'
;
import
{
IWebviewService
,
WebviewOverlay
}
from
'
vs/workbench/contrib/webview/browser/webview
'
;
import
{
IWebviewViewService
,
WebviewView
}
from
'
vs/workbench/contrib/webviewView/browser/webviewViewService
'
;
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
...
...
@@ -57,6 +57,7 @@ export class WebviewViewPane extends ViewPane {
@
IProgressService
private
readonly
progressService
:
IProgressService
,
@
IWebviewService
private
readonly
webviewService
:
IWebviewService
,
@
IWebviewViewService
private
readonly
webviewViewService
:
IWebviewViewService
,
@
IViewsService
private
readonly
viewService
:
IViewsService
,
)
{
super
({
...
options
,
titleMenuId
:
MenuId
.
ViewTitle
},
keybindingService
,
contextMenuService
,
configurationService
,
contextKeyService
,
viewDescriptorService
,
instantiationService
,
openerService
,
themeService
,
telemetryService
);
...
...
@@ -168,6 +169,10 @@ export class WebviewViewPane extends ViewPane {
get
description
():
string
|
undefined
{
return
self
.
titleDescription
;
},
set
description
(
value
:
string
|
undefined
)
{
self
.
updateTitleDescription
(
value
);
},
show
:
(
preserveFocus
)
=>
{
this
.
viewService
.
openView
(
this
.
id
,
!
preserveFocus
);
}
};
await
this
.
webviewViewService
.
resolve
(
this
.
id
,
webviewView
,
source
.
token
);
...
...
src/vs/workbench/contrib/webviewView/browser/webviewViewService.ts
浏览文件 @
f79540dc
...
...
@@ -19,6 +19,8 @@ export interface WebviewView {
readonly
onDidChangeVisibility
:
Event
<
boolean
>
;
readonly
onDispose
:
Event
<
void
>
;
show
(
preserveFocus
:
boolean
):
void
;
}
export
interface
IWebviewViewResolver
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录