All files / src/web/webviewHtml head.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                      3x   3x                        
import { WEBVIEW_STYLES } from './styles';
 
interface WebviewHeadOptions {
	bpmnCssUri: string;
	cspSource: string;
	diagramCssUri: string;
	minimapCssUri: string;
	nonce: string;
}
 
export function getWebviewHeadHtml(options: WebviewHeadOptions): string {
	const { bpmnCssUri, cspSource, diagramCssUri, minimapCssUri, nonce } = options;
 
	return `<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src ${cspSource} data:; style-src ${cspSource} 'nonce-${nonce}'; font-src ${cspSource}; script-src 'nonce-${nonce}';" />
	<link rel="stylesheet" href="${diagramCssUri}" />
	<link rel="stylesheet" href="${bpmnCssUri}" />
	<link rel="stylesheet" href="${minimapCssUri}" />
	<title>Flowable BPMN Designer</title>
	<style nonce="${nonce}">
${WEBVIEW_STYLES}
	</style>
</head>`;
}