Skip to content

Commit c9b46be

Browse files
committed
fix font-src loading issue
1 parent 854ced0 commit c9b46be

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

src/editor/ReactWebView.ts

+20-17
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,16 @@ class ReactWebView {
4747
}
4848

4949
// prevents new panels from going ontop of coderoad panel
50-
vscode.window.onDidChangeActiveTextEditor(param => {
51-
if (!param || param.viewColumn !== vscode.ViewColumn.Two) {
50+
vscode.window.onDidChangeActiveTextEditor((textEditor) => {
51+
console.log('onDidChangeActiveTextEditor')
52+
console.log(textEditor)
53+
if (!textEditor || textEditor.viewColumn !== vscode.ViewColumn.Two) {
5254
updateWindows()
5355
}
5456
})
5557
// // prevents moving coderoad panel on top of left panel
56-
vscode.window.onDidChangeVisibleTextEditors(param => {
58+
vscode.window.onDidChangeVisibleTextEditors((textEditor) => {
59+
console.log('onDidChangeVisibleTextEditors')
5760
updateWindows()
5861
})
5962

@@ -144,29 +147,29 @@ class ReactWebView {
144147
const [n1, n2, n3] = [1, 2, 3].map(this.getNonce)
145148

146149
return `<!DOCTYPE html>
147-
<html lang="en">
150+
<html lang='en'>
148151
<head>
149-
<meta charset="utf-8">
150-
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
151-
<meta name="theme-color" content="#000000">
152+
<meta charset='utf-8'>
153+
<meta name='viewport' content='width=device-width,initial-scale=1,shrink-to-fit=no'>
154+
<meta name='theme-color' content='#000000'>
152155
<title>React App</title>
153-
<link rel="manifest" href="./manifest.json" />
156+
<link rel='manifest' href='./manifest.json' />
154157
<!-- TODO: load styles through package -->
155-
<link rel="stylesheet" href="https://unpkg.com/@alifd/next/dist/next.css" />
156-
<link rel="stylesheet" type="text/css" href="${styleUri}">
157-
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src vscode-resource: https:; script-src 'nonce-${n1}' 'nonce-${n2}' 'nonce-${n3}'; style-src vscode-resource: 'unsafe-inline' http: https: data:;">
158-
<base href="${vscode.Uri.file(path.join(this.extensionPath, 'build')).with({
158+
<link rel='stylesheet' href='https://unpkg.com/@alifd/next/dist/next.css' />
159+
<link rel='stylesheet' type='text/css' href='${styleUri}'>
160+
<meta http-equiv='Content-Security-Policy' content="font-src *; img-src vscode-resource: https:; script-src 'nonce-${n1}' 'nonce-${n2}' 'nonce-${n3}'; style-src vscode-resource: 'unsafe-inline' http: https: data:;">
161+
<base href='${vscode.Uri.file(path.join(this.extensionPath, 'build')).with({
159162
scheme: 'vscode-resource',
160-
})}/">
163+
})}/'>
161164
<style></style>
162165
</head>
163166
164167
<body>
165168
<noscript>You need to enable JavaScript to run this app.</noscript>
166-
<div id="root">Loading...</div>
167-
<script nonce=${n1} src="./webpackBuild.js"></script>
168-
<script nonce=${n2} src="${chunkUri}"></script>
169-
<script nonce="${n3}" src="${scriptUri}"></script>
169+
<div id='root'>Loading...</div>
170+
<script nonce=${n1} src='./webpackBuild.js'></script>
171+
<script nonce=${n2} src='${chunkUri}'></script>
172+
<script nonce='${n3}' src='${scriptUri}'></script>
170173
</body>
171174
</html>`
172175
}

0 commit comments

Comments
 (0)