提交 5eeed6d2 编写于 作者: M Matt Bierner

Move layout and focus ot base class

上级 7cbbf47f
......@@ -151,14 +151,8 @@ class WebviewEditor extends BaseWebviewEditor {
public layout(dimension: Dimension): void {
if (this._webview) {
this.doUpdateContainer();
this._webview.layout();
}
}
public focus() {
if (this._webview) {
this._webview.focus();
}
super.layout(dimension);
}
public dispose(): void {
......
......@@ -157,13 +157,8 @@ export class HtmlPreviewPart extends WebviewEditor {
const { width, height } = dimension;
this.content.style.width = `${width}px`;
this.content.style.height = `${height}px`;
if (this._webview) {
this._webview.layout();
}
}
public focus(): void {
this.webview.focus();
super.layout(dimension);
}
public clearInput(): void {
......
......@@ -12,6 +12,7 @@ import { IContextKey, RawContextKey, IContextKeyService } from 'vs/platform/cont
import { Webview } from './webview';
import { Builder } from 'vs/base/browser/builder';
import { Dimension } from 'vs/workbench/services/part/common/partService';
/** A context key that is set when a webview editor has focus. */
export const KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS = new RawContextKey<boolean>('webviewEditorFocus', false);
......@@ -90,6 +91,18 @@ export abstract class WebviewEditor extends BaseWebviewEditor {
}
}
public layout(dimension: Dimension): void {
if (this._webview) {
this._webview.layout();
}
}
public focus(): void {
if (this._webview) {
this._webview.focus();
}
}
protected abstract createEditor(parent: Builder): void;
}
......@@ -139,20 +139,6 @@ export class ReleaseNotesEditor extends WebviewEditor {
this.contentDisposables.push(toDisposable(() => this._webview = null));
}
layout(): void {
if (this._webview) {
this._webview.layout();
}
}
focus(): void {
if (!this._webview) {
return;
}
this._webview.focus();
}
dispose(): void {
this.contentDisposables = dispose(this.contentDisposables);
super.dispose();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册