提交 fd952825 编写于 作者: M Matt Bierner

Make sure we use consistent unique ids for custom editors

上级 a47bf2ac
...@@ -250,7 +250,7 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews ...@@ -250,7 +250,7 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
return webviewEditorInput.getTypeId() !== WebviewInput.typeId && webviewEditorInput.viewType === viewType; return webviewEditorInput.getTypeId() !== WebviewInput.typeId && webviewEditorInput.viewType === viewType;
}, },
resolveWebview: async (webview) => { resolveWebview: async (webview) => {
const handle = generateUuid(); const handle = webview.id;
this._webviewEditorInputs.add(handle, webview); this._webviewEditorInputs.add(handle, webview);
this.hookupWebviewEventDelegate(handle, webview); this.hookupWebviewEventDelegate(handle, webview);
......
...@@ -40,12 +40,13 @@ export class CustomEditoInputFactory extends WebviewEditorInputFactory { ...@@ -40,12 +40,13 @@ export class CustomEditoInputFactory extends WebviewEditorInputFactory {
serializedEditorInput: string serializedEditorInput: string
): CustomFileEditorInput { ): CustomFileEditorInput {
const data = this.fromJson(serializedEditorInput); const data = this.fromJson(serializedEditorInput);
const webviewInput = this.webviewService.reviveWebview(generateUuid(), data.viewType, data.title, data.iconPath, data.state, data.options, data.extensionLocation ? { const id = data.id || generateUuid();
const webviewInput = this.webviewService.reviveWebview(id, data.viewType, data.title, data.iconPath, data.state, data.options, data.extensionLocation ? {
location: data.extensionLocation, location: data.extensionLocation,
id: data.extensionId id: data.extensionId
} : undefined, data.group); } : undefined, data.group);
const customInput = this._instantiationService.createInstance(CustomFileEditorInput, URI.from((data as any).editorResource), data.viewType, generateUuid(), new UnownedDisposable(webviewInput.webview)); const customInput = this._instantiationService.createInstance(CustomFileEditorInput, URI.from((data as any).editorResource), data.viewType, id, new UnownedDisposable(webviewInput.webview));
if (typeof data.group === 'number') { if (typeof data.group === 'number') {
customInput.updateGroup(data.group); customInput.updateGroup(data.group);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册