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

Always use external endpoint on web

上级 5d828fdc
......@@ -19,6 +19,7 @@ import { WebviewPortMappingManager } from 'vs/workbench/contrib/webview/common/p
import { loadLocalResource } from 'vs/workbench/contrib/webview/common/resourceLoader';
import { getWebviewThemeData } from 'vs/workbench/contrib/webview/common/themeing';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { isWeb } from 'vs/base/common/platform';
interface WebviewContent {
readonly html: string;
......@@ -47,9 +48,7 @@ export class IFrameWebview extends Disposable implements Webview {
@IConfigurationService private readonly _configurationService: IConfigurationService,
) {
super();
const useExternalEndpoint = this._configurationService.getValue<string>('webview.experimental.useExternalEndpoint');
if (!useExternalEndpoint && (!environmentService.options || typeof environmentService.options.webviewEndpoint !== 'string')) {
if (!this.useExternalEndpoint && (!environmentService.options || typeof environmentService.options.webviewEndpoint !== 'string')) {
throw new Error('To use iframe based webviews, you must configure `environmentService.webviewEndpoint`');
}
......@@ -155,7 +154,7 @@ export class IFrameWebview extends Disposable implements Webview {
}
private get externalEndpoint(): string | undefined {
const useExternalEndpoint = this._configurationService.getValue<boolean>('webview.experimental.useExternalEndpoint');
const useExternalEndpoint = this.useExternalEndpoint;
if (!useExternalEndpoint) {
return undefined;
}
......@@ -163,6 +162,10 @@ export class IFrameWebview extends Disposable implements Webview {
return `https://{{uuid}}.vscode-webview-test.com/${commit}`;
}
private get useExternalEndpoint(): boolean {
return isWeb || this._configurationService.getValue<boolean>('webview.experimental.useExternalEndpoint');
}
public mountTo(parent: HTMLElement) {
if (this.element) {
parent.appendChild(this.element);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册