提交 954c5ae2 编写于 作者: M Matt Bierner

Don't set resource on webviews

Fixes #46217
上级 dd3ce6c8
......@@ -54,7 +54,7 @@ export class MainThreadWebviews implements MainThreadWebviewsShape {
options: vscode.WebviewOptions,
extensionFolderPath: string
): void {
const webviewInput = new WebviewInput(URI.parse('webview://' + handle), title, options, '', {
const webviewInput = new WebviewInput(title, options, '', {
onMessage: message => this._proxy.$onMessage(handle, message),
onDidChangePosition: position => this._proxy.$onDidChangePosition(handle, position),
onDispose: () => {
......
......@@ -83,8 +83,7 @@ export class ReleaseNotesManager {
this._editorService.openEditor(this._currentReleaseNotes, { preserveFocus: true });
}
} else {
const uri = URI.parse('release-notes:' + version);
this._currentReleaseNotes = new WebviewInput(uri, title, { tryRestoreScrollPosition: true, enableFindWidget: true }, html, {
this._currentReleaseNotes = new WebviewInput(title, { tryRestoreScrollPosition: true, enableFindWidget: true }, html, {
onDidClickLink: uri => this.onDidClickLink(uri),
onDispose: () => { this._currentReleaseNotes = undefined; }
}, this._partService);
......
......@@ -141,7 +141,7 @@ export class WebviewEditor extends BaseWebviewEditor {
return undefined;
}
if (this.input && this.input.getResource().fsPath !== input.getResource().fsPath) {
if (this.input) {
(this.input as WebviewInput).releaseWebview(this);
this._webview = undefined;
this.webviewContent = undefined;
......
......@@ -28,7 +28,6 @@ export interface WebviewInputOptions extends vscode.WebviewOptions {
export class WebviewInput extends EditorInput {
private static handlePool = 0;
private readonly _resource: URI;
private _name: string;
private _options: WebviewInputOptions;
private _html: string;
......@@ -43,7 +42,6 @@ export class WebviewInput extends EditorInput {
public readonly extensionFolderPath: URI | undefined;
constructor(
resource: URI,
name: string,
options: WebviewInputOptions,
html: string,
......@@ -52,7 +50,6 @@ export class WebviewInput extends EditorInput {
extensionFolderPath?: string
) {
super();
this._resource = resource;
this._name = name;
this._options = options;
this._html = html;
......@@ -90,20 +87,28 @@ export class WebviewInput extends EditorInput {
}
public getResource(): URI {
return this._resource;
return null;
}
public getName(): string {
return this._name;
}
public getTitle() {
return this.getName();
}
public getDescription(): string {
return null;
}
public setName(value: string): void {
this._name = value;
this._onDidChangeLabel.fire();
}
matches(other: IEditorInput): boolean {
return other && other instanceof WebviewInput && other.getResource().fsPath === this.getResource().fsPath;
return other && other === this;
}
public get position(): Position | undefined {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册