Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
68afee90
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
68afee90
编写于
6月 13, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow updating webview settings after creation
Fixes #51733
上级
612806b8
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
44 addition
and
13 deletion
+44
-13
extensions/markdown-language-features/src/features/preview.ts
...nsions/markdown-language-features/src/features/preview.ts
+8
-2
extensions/markdown-language-features/src/features/previewManager.ts
...markdown-language-features/src/features/previewManager.ts
+2
-1
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+1
-1
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
+9
-0
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-0
src/vs/workbench/api/node/extHostWebview.ts
src/vs/workbench/api/node/extHostWebview.ts
+11
-5
src/vs/workbench/parts/webview/electron-browser/webviewEditorInput.ts
...ench/parts/webview/electron-browser/webviewEditorInput.ts
+11
-4
src/vs/workbench/parts/webview/electron-browser/webviewElement.ts
...orkbench/parts/webview/electron-browser/webviewElement.ts
+1
-0
未找到文件。
extensions/markdown-language-features/src/features/preview.ts
浏览文件 @
68afee90
...
...
@@ -34,14 +34,14 @@ export class MarkdownPreview {
private
isScrolling
=
false
;
private
_disposed
:
boolean
=
false
;
public
static
async
revive
(
webview
:
vscode
.
WebviewPanel
,
state
:
any
,
contentProvider
:
MarkdownContentProvider
,
previewConfigurations
:
MarkdownPreviewConfigurationManager
,
logger
:
Logger
,
topmostLineMonitor
:
MarkdownFileTopmostLineMonitor
topmostLineMonitor
:
MarkdownFileTopmostLineMonitor
,
contributions
:
MarkdownContributions
,
):
Promise
<
MarkdownPreview
>
{
const
resource
=
vscode
.
Uri
.
parse
(
state
.
resource
);
const
locked
=
state
.
locked
;
...
...
@@ -56,6 +56,12 @@ export class MarkdownPreview {
logger
,
topmostLineMonitor
);
preview
.
editor
.
webview
.
options
=
{
enableScripts
:
true
,
enableCommandUris
:
true
,
localResourceRoots
:
MarkdownPreview
.
getLocalResourceRoots
(
resource
,
contributions
)
};
if
(
!
isNaN
(
line
))
{
preview
.
line
=
line
;
}
...
...
extensions/markdown-language-features/src/features/previewManager.ts
浏览文件 @
68afee90
...
...
@@ -89,7 +89,8 @@ export class MarkdownPreviewManager implements vscode.WebviewPanelSerializer {
this
.
_contentProvider
,
this
.
_previewConfigurations
,
this
.
_logger
,
this
.
_topmostLineMonitor
);
this
.
_topmostLineMonitor
,
this
.
_contributions
);
this
.
registerPreview
(
preview
);
}
...
...
src/vs/vscode.d.ts
浏览文件 @
68afee90
...
...
@@ -5286,7 +5286,7 @@ declare module 'vscode' {
/**
* Content settings for the webview.
*/
readonly
options
:
WebviewOptions
;
options
:
WebviewOptions
;
/**
* Contents of the webview.
...
...
src/vs/workbench/api/electron-browser/mainThreadWebview.ts
浏览文件 @
68afee90
...
...
@@ -19,6 +19,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
extHostNamedCustomer
}
from
'
./extHostCustomers
'
;
import
*
as
vscode
from
'
vscode
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadWebviews
)
export
class
MainThreadWebviews
implements
MainThreadWebviewsShape
,
WebviewReviver
{
...
...
@@ -105,6 +106,14 @@ export class MainThreadWebviews implements MainThreadWebviewsShape, WebviewReviv
webview
.
html
=
value
;
}
$setOptions
(
handle
:
WebviewPanelHandle
,
options
:
vscode
.
WebviewOptions
):
void
{
const
webview
=
this
.
getWebview
(
handle
);
webview
.
setOptions
({
...
options
,
localResourceRoots
:
Array
.
isArray
(
options
.
localResourceRoots
)
?
options
.
localResourceRoots
.
map
(
URI
.
revive
)
:
undefined
});
}
$reveal
(
handle
:
WebviewPanelHandle
,
viewColumn
:
EditorViewColumn
|
null
,
preserveFocus
:
boolean
):
void
{
const
webview
=
this
.
getWebview
(
handle
);
if
(
webview
.
isDisposed
())
{
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
68afee90
...
...
@@ -428,6 +428,7 @@ export interface MainThreadWebviewsShape extends IDisposable {
$reveal
(
handle
:
WebviewPanelHandle
,
viewColumn
:
EditorViewColumn
|
null
,
preserveFocus
:
boolean
):
void
;
$setTitle
(
handle
:
WebviewPanelHandle
,
value
:
string
):
void
;
$setHtml
(
handle
:
WebviewPanelHandle
,
value
:
string
):
void
;
$setOptions
(
handle
:
WebviewPanelHandle
,
options
:
vscode
.
WebviewOptions
):
void
;
$postMessage
(
handle
:
WebviewPanelHandle
,
value
:
any
):
Thenable
<
boolean
>
;
$registerSerializer
(
viewType
:
string
):
void
;
...
...
src/vs/workbench/api/node/extHostWebview.ts
浏览文件 @
68afee90
...
...
@@ -19,7 +19,7 @@ export class ExtHostWebview implements vscode.Webview {
private
_options
:
vscode
.
WebviewOptions
;
private
_isDisposed
:
boolean
=
false
;
readonly
_onMessageEmitter
=
new
Emitter
<
any
>
();
public
readonly
_onMessageEmitter
=
new
Emitter
<
any
>
();
public
readonly
onDidReceiveMessage
:
Event
<
any
>
=
this
.
_onMessageEmitter
.
event
;
constructor
(
...
...
@@ -32,16 +32,16 @@ export class ExtHostWebview implements vscode.Webview {
this
.
_options
=
options
;
}
dispose
()
{
public
dispose
()
{
this
.
_onMessageEmitter
.
dispose
();
}
get
html
():
string
{
public
get
html
():
string
{
this
.
assertNotDisposed
();
return
this
.
_html
;
}
set
html
(
value
:
string
)
{
public
set
html
(
value
:
string
)
{
this
.
assertNotDisposed
();
if
(
this
.
_html
!==
value
)
{
this
.
_html
=
value
;
...
...
@@ -49,11 +49,17 @@ export class ExtHostWebview implements vscode.Webview {
}
}
get
options
():
vscode
.
WebviewOptions
{
public
get
options
():
vscode
.
WebviewOptions
{
this
.
assertNotDisposed
();
return
this
.
_options
;
}
public
set
options
(
newOptions
:
vscode
.
WebviewOptions
)
{
this
.
assertNotDisposed
();
this
.
_proxy
.
$setOptions
(
this
.
_handle
,
newOptions
);
this
.
_options
=
newOptions
;
}
public
postMessage
(
message
:
any
):
Thenable
<
boolean
>
{
this
.
assertNotDisposed
();
return
this
.
_proxy
.
$postMessage
(
this
.
_handle
,
message
);
...
...
src/vs/workbench/parts/webview/electron-browser/webviewEditorInput.ts
浏览文件 @
68afee90
...
...
@@ -11,7 +11,7 @@ import { EditorInput, EditorModel, IEditorInput, GroupIdentifier } from 'vs/work
import
{
IPartService
,
Parts
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
WebviewEvents
,
WebviewInputOptions
,
WebviewReviver
}
from
'
./webviewEditorService
'
;
import
{
WebviewElement
}
from
'
./webviewElement
'
;
import
*
as
vscode
from
'
vscode
'
;
export
class
WebviewEditorInput
extends
EditorInput
{
private
static
handlePool
=
0
;
...
...
@@ -95,7 +95,7 @@ export class WebviewEditorInput extends EditorInput {
this
.
_onDidChangeLabel
.
fire
();
}
matches
(
other
:
IEditorInput
):
boolean
{
public
matches
(
other
:
IEditorInput
):
boolean
{
return
other
&&
other
===
this
;
}
...
...
@@ -136,8 +136,15 @@ export class WebviewEditorInput extends EditorInput {
return
this
.
_options
;
}
public
set
options
(
value
:
WebviewInputOptions
)
{
this
.
_options
=
value
;
public
setOptions
(
value
:
vscode
.
WebviewOptions
)
{
this
.
_options
=
{
...
this
.
_options
,
...
value
};
if
(
this
.
_webview
)
{
this
.
_webview
.
options
=
this
.
_options
;
}
}
public
resolve
(
refresh
?:
boolean
):
TPromise
<
IEditorModel
,
any
>
{
...
...
src/vs/workbench/parts/webview/electron-browser/webviewElement.ts
浏览文件 @
68afee90
...
...
@@ -251,6 +251,7 @@ export class WebviewElement {
public
set
options
(
value
:
WebviewOptions
)
{
this
.
_options
=
value
;
this
.
reload
();
}
public
set
contents
(
value
:
string
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录