mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-19 08:08:39 +01:00
Add vscode.env.webviewResourceRoot api
Fixes #72155 Adds a constant to the api that tracks the root path for resources inside of webviews. This is required because we will not be able to use `vscode-resource:` uris on the web. Our current approach is to rewrite the html we are given but there are almost certainly going to be cases where we don't get this quite right. Adopts the new api for the markdown preview
This commit is contained in:
16
extensions/markdown-language-features/src/util/resources.ts
Normal file
16
extensions/markdown-language-features/src/util/resources.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
const rootUri = vscode.Uri.parse(vscode.env.webviewResourceRoot);
|
||||
|
||||
export function toResoruceUri(uri: vscode.Uri): vscode.Uri {
|
||||
return rootUri.with({
|
||||
path: rootUri.path + uri.path,
|
||||
query: uri.query,
|
||||
fragment: uri.fragment,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user