Make sure image views (and custom editors) work properly on the web

This fixes an issue where webviews for custom editors did not have any associated extension information, which caused them try reading `file:` uri resources instead of remote uri resources
This commit is contained in:
Matt Bierner
2019-09-25 15:10:28 -07:00
parent fd9528257e
commit 0506f7f736
13 changed files with 76 additions and 48 deletions

View File

@@ -8,7 +8,6 @@ import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { isWeb } from 'vs/base/common/platform';
import { startsWith } from 'vs/base/common/strings';
import { URI, UriComponents } from 'vs/base/common/uri';
import { generateUuid } from 'vs/base/common/uuid';
import * as modes from 'vs/editor/common/modes';
import { localize } from 'vs/nls';
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
@@ -173,6 +172,11 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
webview.webview.contentOptions = reviveWebviewOptions(options as any /*todo@mat */);
}
public $setExtension(handle: WebviewPanelHandle, extensionId: ExtensionIdentifier, extensionLocation: UriComponents): void {
const webview = this.getWebviewEditorInput(handle);
webview.webview.extension = { id: extensionId, location: URI.revive(extensionLocation) };
}
public $reveal(handle: WebviewPanelHandle, showOptions: WebviewPanelShowOptions): void {
const webview = this.getWebviewEditorInput(handle);
if (webview.isDisposed()) {