mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-29 04:53:33 +01:00
24
src/vs/workbench/api/common/shared/webview.ts
Normal file
24
src/vs/workbench/api/common/shared/webview.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export interface WebviewInitData {
|
||||
readonly webviewResourceRoot: string;
|
||||
readonly webviewCspRule: string;
|
||||
}
|
||||
|
||||
export function toWebviewResource(
|
||||
initData: WebviewInitData,
|
||||
resource: vscode.Uri
|
||||
): vscode.Uri {
|
||||
const rootUri = URI.parse(initData.webviewResourceRoot);
|
||||
return rootUri.with({
|
||||
path: rootUri.path + resource.path,
|
||||
query: resource.query,
|
||||
fragment: resource.fragment,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user