mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 22:12:26 +01:00
Add localResourceRoots to webview options
Fixes #44039 Add a new option that lets extensions override which root folders a webview can load local resources from. Defaults to allowing any resource in the workspace
This commit is contained in:
@@ -201,7 +201,9 @@ class WebviewEditor extends BaseWebviewEditor {
|
||||
|
||||
this.webview.options = {
|
||||
allowScripts: input.options.enableScripts,
|
||||
enableWrappedPostMessage: true
|
||||
enableWrappedPostMessage: true,
|
||||
useSameOriginForRoot: false,
|
||||
localResourceRoots: (input && input.options.localResourceRoots) || this._contextService.getWorkspace().folders.map(x => x.uri)
|
||||
};
|
||||
this.webview.contents = input.html;
|
||||
}
|
||||
@@ -215,7 +217,6 @@ class WebviewEditor extends BaseWebviewEditor {
|
||||
this._partService.getContainer(Parts.EDITOR_PART),
|
||||
this.themeService,
|
||||
this._environmentService,
|
||||
this._contextService,
|
||||
this._contextViewService,
|
||||
this.contextKey,
|
||||
this.findInputFocusContextKey,
|
||||
|
||||
Reference in New Issue
Block a user