Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
78f410ce
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,发现更多精彩内容 >>
提交
78f410ce
编写于
6月 20, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make sure we correctly update local resource roots when switching previewed markdown file
Fixes #49859
上级
5aff9aa7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
17 deletion
+32
-17
extensions/markdown-language-features/src/features/preview.ts
...nsions/markdown-language-features/src/features/preview.ts
+20
-15
src/vs/workbench/parts/webview/electron-browser/webviewEditorInput.ts
...ench/parts/webview/electron-browser/webviewEditorInput.ts
+7
-1
src/vs/workbench/parts/webview/electron-browser/webviewElement.ts
...orkbench/parts/webview/electron-browser/webviewElement.ts
+5
-1
未找到文件。
extensions/markdown-language-features/src/features/preview.ts
浏览文件 @
78f410ce
...
@@ -54,13 +54,10 @@ export class MarkdownPreview {
...
@@ -54,13 +54,10 @@ export class MarkdownPreview {
contentProvider
,
contentProvider
,
previewConfigurations
,
previewConfigurations
,
logger
,
logger
,
topmostLineMonitor
);
topmostLineMonitor
,
contributions
);
preview
.
editor
.
webview
.
options
=
{
preview
.
editor
.
webview
.
options
=
MarkdownPreview
.
getWebviewOptions
(
resource
,
contributions
);
enableScripts
:
true
,
enableCommandUris
:
true
,
localResourceRoots
:
MarkdownPreview
.
getLocalResourceRoots
(
resource
,
contributions
)
};
if
(
!
isNaN
(
line
))
{
if
(
!
isNaN
(
line
))
{
preview
.
line
=
line
;
preview
.
line
=
line
;
...
@@ -83,10 +80,8 @@ export class MarkdownPreview {
...
@@ -83,10 +80,8 @@ export class MarkdownPreview {
MarkdownPreview
.
viewType
,
MarkdownPreview
.
viewType
,
MarkdownPreview
.
getPreviewTitle
(
resource
,
locked
),
MarkdownPreview
.
getPreviewTitle
(
resource
,
locked
),
previewColumn
,
{
previewColumn
,
{
enableScripts
:
true
,
enableCommandUris
:
true
,
enableFindWidget
:
true
,
enableFindWidget
:
true
,
localResourceRoots
:
MarkdownPreview
.
getLocalResourceRoot
s
(
resource
,
contributions
)
...
MarkdownPreview
.
getWebviewOption
s
(
resource
,
contributions
)
});
});
return
new
MarkdownPreview
(
return
new
MarkdownPreview
(
...
@@ -96,7 +91,8 @@ export class MarkdownPreview {
...
@@ -96,7 +91,8 @@ export class MarkdownPreview {
contentProvider
,
contentProvider
,
previewConfigurations
,
previewConfigurations
,
logger
,
logger
,
topmostLineMonitor
);
topmostLineMonitor
,
contributions
);
}
}
private
constructor
(
private
constructor
(
...
@@ -106,7 +102,8 @@ export class MarkdownPreview {
...
@@ -106,7 +102,8 @@ export class MarkdownPreview {
private
readonly
_contentProvider
:
MarkdownContentProvider
,
private
readonly
_contentProvider
:
MarkdownContentProvider
,
private
readonly
_previewConfigurations
:
MarkdownPreviewConfigurationManager
,
private
readonly
_previewConfigurations
:
MarkdownPreviewConfigurationManager
,
private
readonly
_logger
:
Logger
,
private
readonly
_logger
:
Logger
,
topmostLineMonitor
:
MarkdownFileTopmostLineMonitor
topmostLineMonitor
:
MarkdownFileTopmostLineMonitor
,
private
readonly
_contributions
:
MarkdownContributions
,
)
{
)
{
this
.
_resource
=
resource
;
this
.
_resource
=
resource
;
this
.
_locked
=
locked
;
this
.
_locked
=
locked
;
...
@@ -245,10 +242,6 @@ export class MarkdownPreview {
...
@@ -245,10 +242,6 @@ export class MarkdownPreview {
return
this
.
editor
.
viewColumn
;
return
this
.
editor
.
viewColumn
;
}
}
public
isWebviewOf
(
webview
:
vscode
.
WebviewPanel
):
boolean
{
return
this
.
editor
===
webview
;
}
public
matchesResource
(
public
matchesResource
(
otherResource
:
vscode
.
Uri
,
otherResource
:
vscode
.
Uri
,
otherPosition
:
vscode
.
ViewColumn
|
undefined
,
otherPosition
:
vscode
.
ViewColumn
|
undefined
,
...
@@ -334,10 +327,22 @@ export class MarkdownPreview {
...
@@ -334,10 +327,22 @@ export class MarkdownPreview {
const
content
=
await
this
.
_contentProvider
.
provideTextDocumentContent
(
document
,
this
.
_previewConfigurations
,
this
.
line
,
this
.
state
);
const
content
=
await
this
.
_contentProvider
.
provideTextDocumentContent
(
document
,
this
.
_previewConfigurations
,
this
.
line
,
this
.
state
);
if
(
this
.
_resource
===
resource
)
{
if
(
this
.
_resource
===
resource
)
{
this
.
editor
.
title
=
MarkdownPreview
.
getPreviewTitle
(
this
.
_resource
,
this
.
_locked
);
this
.
editor
.
title
=
MarkdownPreview
.
getPreviewTitle
(
this
.
_resource
,
this
.
_locked
);
this
.
editor
.
webview
.
options
=
MarkdownPreview
.
getWebviewOptions
(
resource
,
this
.
_contributions
);
this
.
editor
.
webview
.
html
=
content
;
this
.
editor
.
webview
.
html
=
content
;
}
}
}
}
private
static
getWebviewOptions
(
resource
:
vscode
.
Uri
,
contributions
:
MarkdownContributions
):
vscode
.
WebviewOptions
{
return
{
enableScripts
:
true
,
enableCommandUris
:
true
,
localResourceRoots
:
MarkdownPreview
.
getLocalResourceRoots
(
resource
,
contributions
)
};
}
private
static
getLocalResourceRoots
(
private
static
getLocalResourceRoots
(
resource
:
vscode
.
Uri
,
resource
:
vscode
.
Uri
,
contributions
:
MarkdownContributions
contributions
:
MarkdownContributions
...
...
src/vs/workbench/parts/webview/electron-browser/webviewEditorInput.ts
浏览文件 @
78f410ce
...
@@ -144,7 +144,13 @@ export class WebviewEditorInput extends EditorInput {
...
@@ -144,7 +144,13 @@ export class WebviewEditorInput extends EditorInput {
};
};
if
(
this
.
_webview
)
{
if
(
this
.
_webview
)
{
this
.
_webview
.
options
=
this
.
_options
;
this
.
_webview
.
options
=
{
allowScripts
:
this
.
_options
.
enableScripts
,
allowSvgs
:
true
,
enableWrappedPostMessage
:
true
,
useSameOriginForRoot
:
false
,
localResourceRoots
:
this
.
_options
.
localResourceRoots
};
}
}
}
}
...
...
src/vs/workbench/parts/webview/electron-browser/webviewElement.ts
浏览文件 @
78f410ce
...
@@ -256,7 +256,11 @@ export class WebviewElement extends Disposable {
...
@@ -256,7 +256,11 @@ export class WebviewElement extends Disposable {
public
set
options
(
value
:
WebviewOptions
)
{
public
set
options
(
value
:
WebviewOptions
)
{
this
.
_options
=
value
;
this
.
_options
=
value
;
this
.
reload
();
this
.
_send
(
'
content
'
,
{
contents
:
this
.
_contents
,
options
:
this
.
_options
,
state
:
this
.
_state
});
}
}
public
set
contents
(
value
:
string
)
{
public
set
contents
(
value
:
string
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录