Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
28c8990e
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,发现更多精彩内容 >>
提交
28c8990e
编写于
3月 14, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use _ prefix for private
上级
0a8bb47d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
24 deletion
+24
-24
src/vs/workbench/parts/html/electron-browser/htmlPreviewPart.ts
.../workbench/parts/html/electron-browser/htmlPreviewPart.ts
+24
-24
未找到文件。
src/vs/workbench/parts/html/electron-browser/htmlPreviewPart.ts
浏览文件 @
28c8990e
...
...
@@ -48,8 +48,8 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
private
_modelChangeSubscription
=
EmptyDisposable
;
private
_themeChangeSubscription
=
EmptyDisposable
;
private
content
:
HTMLElement
;
private
scrollYPercentage
:
number
=
0
;
private
_
content
:
HTMLElement
;
private
_
scrollYPercentage
:
number
=
0
;
constructor
(
@
ITelemetryService
telemetryService
:
ITelemetryService
,
...
...
@@ -57,10 +57,10 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IContextViewService
private
readonly
_contextViewService
:
IContextViewService
,
@
IEnvironmentService
private
readonly
_environmentService
:
IEnvironmentService
,
@
IOpenerService
private
readonly
openerService
:
IOpenerService
,
@
IPartService
private
readonly
partService
:
IPartService
,
@
IOpenerService
private
readonly
_
openerService
:
IOpenerService
,
@
IPartService
private
readonly
_
partService
:
IPartService
,
@
IStorageService
private
readonly
_storageService
:
IStorageService
,
@
ITextModelService
private
readonly
textModelResolverService
:
ITextModelService
,
@
ITextModelService
private
readonly
_textModelResolverService
:
ITextModelService
)
{
super
(
HtmlPreviewPart
.
ID
,
telemetryService
,
themeService
,
contextKeyService
);
}
...
...
@@ -79,10 +79,10 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
}
protected
createEditor
(
parent
:
Builder
):
void
{
this
.
content
=
document
.
createElement
(
'
div
'
);
this
.
content
.
style
.
position
=
'
absolute
'
;
this
.
content
.
classList
.
add
(
HtmlPreviewPart
.
class
);
parent
.
getHTMLElement
().
appendChild
(
this
.
content
);
this
.
_
content
=
document
.
createElement
(
'
div
'
);
this
.
_
content
.
style
.
position
=
'
absolute
'
;
this
.
_
content
.
classList
.
add
(
HtmlPreviewPart
.
class
);
parent
.
getHTMLElement
().
appendChild
(
this
.
_
content
);
}
private
get
webview
():
Webview
{
...
...
@@ -93,7 +93,7 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
}
this
.
_webview
=
new
Webview
(
this
.
partService
.
getContainer
(
Parts
.
EDITOR_PART
),
this
.
_
partService
.
getContainer
(
Parts
.
EDITOR_PART
),
this
.
themeService
,
this
.
_environmentService
,
this
.
_contextViewService
,
...
...
@@ -103,21 +103,21 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
...
webviewOptions
,
useSameOriginForRoot
:
true
});
this
.
_webview
.
mountTo
(
this
.
content
);
this
.
_webview
.
mountTo
(
this
.
_
content
);
if
(
this
.
input
&&
this
.
input
instanceof
HtmlInput
)
{
const
state
=
this
.
loadViewState
(
this
.
input
.
getResource
());
this
.
scrollYPercentage
=
state
?
state
.
scrollYPercentage
:
0
;
this
.
webview
.
initialScrollProgress
=
this
.
scrollYPercentage
;
this
.
_
scrollYPercentage
=
state
?
state
.
scrollYPercentage
:
0
;
this
.
webview
.
initialScrollProgress
=
this
.
_
scrollYPercentage
;
const
resourceUri
=
this
.
input
.
getResource
();
this
.
webview
.
baseUrl
=
resourceUri
.
toString
(
true
);
}
this
.
_webviewDisposables
=
[
this
.
_webview
,
this
.
_webview
.
onDidClickLink
(
uri
=>
this
.
openerService
.
open
(
uri
)),
this
.
_webview
.
onDidClickLink
(
uri
=>
this
.
_
openerService
.
open
(
uri
)),
this
.
_webview
.
onDidScroll
(
data
=>
{
this
.
scrollYPercentage
=
data
.
scrollYPercentage
;
this
.
_
scrollYPercentage
=
data
.
scrollYPercentage
;
}),
];
}
...
...
@@ -160,8 +160,8 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
public
layout
(
dimension
:
Dimension
):
void
{
const
{
width
,
height
}
=
dimension
;
this
.
content
.
style
.
width
=
`
${
width
}
px`
;
this
.
content
.
style
.
height
=
`
${
height
}
px`
;
this
.
_
content
.
style
.
width
=
`
${
width
}
px`
;
this
.
_
content
.
style
.
height
=
`
${
height
}
px`
;
super
.
layout
(
dimension
);
}
...
...
@@ -169,7 +169,7 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
public
clearInput
():
void
{
if
(
this
.
input
instanceof
HtmlInput
)
{
this
.
saveViewState
(
this
.
input
.
getResource
(),
{
scrollYPercentage
:
this
.
scrollYPercentage
scrollYPercentage
:
this
.
_
scrollYPercentage
});
}
dispose
(
this
.
_modelRef
);
...
...
@@ -180,7 +180,7 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
public
shutdown
():
void
{
if
(
this
.
input
instanceof
HtmlInput
)
{
this
.
saveViewState
(
this
.
input
.
getResource
(),
{
scrollYPercentage
:
this
.
scrollYPercentage
scrollYPercentage
:
this
.
_
scrollYPercentage
});
}
super
.
shutdown
();
...
...
@@ -201,7 +201,7 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
if
(
this
.
input
instanceof
HtmlInput
)
{
oldOptions
=
this
.
input
.
options
;
this
.
saveViewState
(
this
.
input
.
getResource
(),
{
scrollYPercentage
:
this
.
scrollYPercentage
scrollYPercentage
:
this
.
_
scrollYPercentage
});
}
...
...
@@ -216,7 +216,7 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
return
super
.
setInput
(
input
,
options
).
then
(()
=>
{
const
resourceUri
=
input
.
getResource
();
return
this
.
textModelResolverService
.
createModelReference
(
resourceUri
).
then
(
ref
=>
{
return
this
.
_
textModelResolverService
.
createModelReference
(
resourceUri
).
then
(
ref
=>
{
const
model
=
ref
.
object
;
if
(
model
instanceof
BaseTextEditorModel
)
{
...
...
@@ -233,16 +233,16 @@ export class HtmlPreviewPart extends BaseWebviewEditor {
this
.
_modelChangeSubscription
=
this
.
model
.
onDidChangeContent
(()
=>
{
if
(
this
.
model
)
{
this
.
scrollYPercentage
=
0
;
this
.
_
scrollYPercentage
=
0
;
this
.
webview
.
contents
=
this
.
model
.
getLinesContent
().
join
(
'
\n
'
);
}
});
const
state
=
this
.
loadViewState
(
resourceUri
);
this
.
scrollYPercentage
=
state
?
state
.
scrollYPercentage
:
0
;
this
.
_
scrollYPercentage
=
state
?
state
.
scrollYPercentage
:
0
;
this
.
webview
.
baseUrl
=
resourceUri
.
toString
(
true
);
this
.
webview
.
options
=
input
.
options
;
this
.
webview
.
contents
=
this
.
model
.
getLinesContent
().
join
(
'
\n
'
);
this
.
webview
.
initialScrollProgress
=
this
.
scrollYPercentage
;
this
.
webview
.
initialScrollProgress
=
this
.
_
scrollYPercentage
;
return
undefined
;
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录