提交 14c752b7 编写于 作者: M Matt Bierner

small cleanups to webview

上级 e18df5b2
...@@ -33,8 +33,6 @@ export class HtmlPreviewPart extends WebviewEditor { ...@@ -33,8 +33,6 @@ export class HtmlPreviewPart extends WebviewEditor {
static ID: string = 'workbench.editor.htmlPreviewPart'; static ID: string = 'workbench.editor.htmlPreviewPart';
private _textModelResolverService: ITextModelResolverService;
private _openerService: IOpenerService;
private _webview: Webview; private _webview: Webview;
private _webviewDisposables: IDisposable[]; private _webviewDisposables: IDisposable[];
private _container: HTMLDivElement; private _container: HTMLDivElement;
...@@ -50,17 +48,15 @@ export class HtmlPreviewPart extends WebviewEditor { ...@@ -50,17 +48,15 @@ export class HtmlPreviewPart extends WebviewEditor {
constructor( constructor(
@ITelemetryService telemetryService: ITelemetryService, @ITelemetryService telemetryService: ITelemetryService,
@ITextModelResolverService textModelResolverService: ITextModelResolverService, @ITextModelResolverService private textModelResolverService: ITextModelResolverService,
@IThemeService protected themeService: IThemeService, @IThemeService themeService: IThemeService,
@IOpenerService openerService: IOpenerService, @IOpenerService private openerService: IOpenerService,
@IWorkspaceContextService contextService: IWorkspaceContextService, @IWorkspaceContextService contextService: IWorkspaceContextService,
@IPartService private partService: IPartService, @IPartService private partService: IPartService,
@IStorageService storageService: IStorageService @IStorageService storageService: IStorageService
) { ) {
super(HtmlPreviewPart.ID, telemetryService, themeService, storageService); super(HtmlPreviewPart.ID, telemetryService, themeService, storageService);
this._textModelResolverService = textModelResolverService;
this._openerService = openerService;
this._baseUrl = contextService.toResource('/'); this._baseUrl = contextService.toResource('/');
} }
...@@ -95,7 +91,7 @@ export class HtmlPreviewPart extends WebviewEditor { ...@@ -95,7 +91,7 @@ export class HtmlPreviewPart extends WebviewEditor {
this._webviewDisposables = [ this._webviewDisposables = [
this._webview, this._webview,
this._webview.onDidClickLink(uri => this._openerService.open(uri)), this._webview.onDidClickLink(uri => this.openerService.open(uri)),
this._webview.onDidLoadContent(data => this.telemetryService.publicLog('previewHtml', data.stats)), this._webview.onDidLoadContent(data => this.telemetryService.publicLog('previewHtml', data.stats)),
this._webview.onDidScroll(data => { this._webview.onDidScroll(data => {
this.scrollYPercentage = data.scrollYPercentage; this.scrollYPercentage = data.scrollYPercentage;
...@@ -200,7 +196,7 @@ export class HtmlPreviewPart extends WebviewEditor { ...@@ -200,7 +196,7 @@ export class HtmlPreviewPart extends WebviewEditor {
return super.setInput(input, options).then(() => { return super.setInput(input, options).then(() => {
const resourceUri = input.getResource(); const resourceUri = input.getResource();
return this._textModelResolverService.createModelReference(resourceUri).then(ref => { return this.textModelResolverService.createModelReference(resourceUri).then(ref => {
const model = ref.object; const model = ref.object;
if (model instanceof BaseTextEditorModel) { if (model instanceof BaseTextEditorModel) {
......
...@@ -93,7 +93,7 @@ export default class Webview { ...@@ -93,7 +93,7 @@ export default class Webview {
addDisposableListener(this._webview, 'dom-ready', () => { addDisposableListener(this._webview, 'dom-ready', () => {
this.layout(); this.layout();
}), }),
addDisposableListener(this._webview, 'crashed', function () { addDisposableListener(this._webview, 'crashed', () => {
console.error('embedded page crashed'); console.error('embedded page crashed');
}), }),
addDisposableListener(this._webview, 'ipc-message', (event) => { addDisposableListener(this._webview, 'ipc-message', (event) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册