Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3029687

Browse files
authored
Merge pull request#62 from ShMcK/feature/load-external
Feature/load external
2 parents8068220 +1653d4a commit3029687

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

‎src/webview/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ const createReactWebView = ({ extensionPath, workspaceState, workspaceRoot }: Re
2525
localResourceRoots:[vscode.Uri.file(path.join(extensionPath,'build'))],
2626
// prevents destroying the window when it is in the background
2727
retainContextWhenHidden:true,
28+
// allows scripts to load external resources (eg. markdown images, fonts)
29+
enableCommandUris:true,
2830
}
2931
loaded=true
3032
returnvscode.window.createWebviewPanel(viewType,title,vscode.ViewColumn.Two,config)

‎src/webview/render.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
6464
// set CSP (content security policy) to grant permission to local files
6565
constcspMeta:HTMLMetaElement=document.createElement('meta')
6666
cspMeta.httpEquiv='Content-Security-Policy'
67-
cspMeta.content=[
68-
`font-src${panel.webview.cspSource} http: https: data:;`,
69-
`img-src${panel.webview.cspSource} https:;`,
70-
`script-src${nonces.map(nonce=>`'nonce-${nonce}'`).join(' ')};`,
71-
`style-src${panel.webview.cspSource} https:;`,
72-
].join(' ')
67+
cspMeta.content=
68+
[
69+
`font-src${panel.webview.cspSource} http: https: data:`,
70+
`img-src${panel.webview.cspSource} https:`,
71+
`script-src${nonces.map(nonce=>`'nonce-${nonce}'`).join(' ')} data:`,
72+
`style-src${panel.webview.cspSource} https:`,
73+
].join('; ')+';'
7374
document.head.appendChild(cspMeta)
7475

7576
// stringify dom

‎web-app/src/styles/index.css

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
@import'~@alifd/theme-4/dist/next.css';
33

44
html {
5-
height:100%;
6-
width:100%;
5+
height:100%;
6+
width:100%;
77
}
88

99
body {
10-
height:100%;
11-
width:100%;
12-
margin:0;
13-
padding:0;
14-
font-family: -apple-system, BlinkMacSystemFont,'Segoe UI','Roboto','Oxygen','Ubuntu','Cantarell','Fira Sans',
15-
'Droid Sans','Helvetica Neue', sans-serif;
16-
-webkit-font-smoothing: antialiased;
17-
-moz-osx-font-smoothing: grayscale;
18-
background-color: white;
10+
height:100%;
11+
width:100%;
12+
margin:0;
13+
padding:0;
14+
font-family: -apple-system, BlinkMacSystemFont,'Segoe UI','Roboto','Oxygen','Ubuntu','Cantarell','Fira Sans',
15+
'Droid Sans','Helvetica Neue', sans-serif;
16+
-webkit-font-smoothing: antialiased;
17+
-moz-osx-font-smoothing: grayscale;
18+
background-color: white;
1919
}
2020

2121
code {
22-
font-family: source-code-pro, Menlo, Monaco, Consolas,'Courier New', monospace;
22+
font-family: source-code-pro, Menlo, Monaco, Consolas,'Courier New', monospace;
2323
}
2424

2525
p {
26-
margin:0;
26+
margin:0;
2727
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp