mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
Rename WebviewEditor to WebviewPanel
This commit is contained in:
@@ -20,7 +20,7 @@ export class MarkdownPreview {
|
||||
|
||||
public static viewType = 'markdown.preview';
|
||||
|
||||
private readonly editor: vscode.WebviewEditor;
|
||||
private readonly editor: vscode.WebviewPanel;
|
||||
private throttleTimer: any;
|
||||
private line: number | undefined = undefined;
|
||||
private readonly disposables: vscode.Disposable[] = [];
|
||||
@@ -32,7 +32,7 @@ export class MarkdownPreview {
|
||||
|
||||
|
||||
public static async revive(
|
||||
webview: vscode.WebviewEditor,
|
||||
webview: vscode.WebviewPanel,
|
||||
state: any,
|
||||
contentProvider: MarkdownContentProvider,
|
||||
previewConfigurations: MarkdownPreviewConfigurationManager,
|
||||
@@ -69,7 +69,7 @@ export class MarkdownPreview {
|
||||
topmostLineMonitor: MarkdownFileTopmostLineMonitor,
|
||||
contributions: MarkdownContributions
|
||||
): MarkdownPreview {
|
||||
const webview = vscode.window.createWebviewEditor(
|
||||
const webview = vscode.window.createWebviewPanel(
|
||||
MarkdownPreview.viewType,
|
||||
MarkdownPreview.getPreviewTitle(resource, locked),
|
||||
previewColumn, {
|
||||
@@ -90,7 +90,7 @@ export class MarkdownPreview {
|
||||
}
|
||||
|
||||
private constructor(
|
||||
webview: vscode.WebviewEditor,
|
||||
webview: vscode.WebviewPanel,
|
||||
private _resource: vscode.Uri,
|
||||
public locked: boolean,
|
||||
private readonly contentProvider: MarkdownContentProvider,
|
||||
@@ -155,7 +155,7 @@ export class MarkdownPreview {
|
||||
private readonly _onDisposeEmitter = new vscode.EventEmitter<void>();
|
||||
public readonly onDispose = this._onDisposeEmitter.event;
|
||||
|
||||
private readonly _onDidChangeViewStateEmitter = new vscode.EventEmitter<vscode.WebviewEditorOnDidChangeViewStateEvent>();
|
||||
private readonly _onDidChangeViewStateEmitter = new vscode.EventEmitter<vscode.WebviewPanelOnDidChangeViewStateEvent>();
|
||||
public readonly onDidChangeViewState = this._onDidChangeViewStateEmitter.event;
|
||||
|
||||
public get resource(): vscode.Uri {
|
||||
@@ -231,7 +231,7 @@ export class MarkdownPreview {
|
||||
return this._resource.fsPath === resource.fsPath;
|
||||
}
|
||||
|
||||
public isWebviewOf(webview: vscode.WebviewEditor): boolean {
|
||||
public isWebviewOf(webview: vscode.WebviewPanel): boolean {
|
||||
return this.editor === webview;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import { isMarkdownFile } from '../util/file';
|
||||
import { MarkdownPreviewConfigurationManager } from './previewConfig';
|
||||
import { MarkdownContributions } from '../markdownExtensions';
|
||||
|
||||
export class MarkdownPreviewManager implements vscode.WebviewEditorSerializer {
|
||||
export class MarkdownPreviewManager implements vscode.WebviewPanelSerializer {
|
||||
private static readonly markdownPreviewActiveContextKey = 'markdownPreviewFocus';
|
||||
|
||||
private readonly topmostLineMonitor = new MarkdownFileTopmostLineMonitor();
|
||||
@@ -36,7 +36,7 @@ export class MarkdownPreviewManager implements vscode.WebviewEditorSerializer {
|
||||
}
|
||||
}, null, this.disposables);
|
||||
|
||||
this.disposables.push(vscode.window.registerWebviewEditorSerializer(MarkdownPreview.viewType, this));
|
||||
this.disposables.push(vscode.window.registerWebviewPanelSerializer(MarkdownPreview.viewType, this));
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
@@ -88,8 +88,8 @@ export class MarkdownPreviewManager implements vscode.WebviewEditorSerializer {
|
||||
}
|
||||
}
|
||||
|
||||
public async deserializeWebviewEditor(
|
||||
webview: vscode.WebviewEditor,
|
||||
public async deserializeWebviewPanel(
|
||||
webview: vscode.WebviewPanel,
|
||||
state: any
|
||||
): Promise<void> {
|
||||
const preview = await MarkdownPreview.revive(
|
||||
@@ -103,8 +103,8 @@ export class MarkdownPreviewManager implements vscode.WebviewEditorSerializer {
|
||||
this.registerPreview(preview);
|
||||
}
|
||||
|
||||
public async serializeWebviewEditor(
|
||||
webview: vscode.WebviewEditor,
|
||||
public async serializeWebviewPanel(
|
||||
webview: vscode.WebviewPanel,
|
||||
): Promise<any> {
|
||||
const preview = this.previews.find(preview => preview.isWebviewOf(webview));
|
||||
return preview ? preview.state : undefined;
|
||||
|
||||
Reference in New Issue
Block a user