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

Feature/load external#62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 3 commits intomasterfromfeature/load-external
Nov 30, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletionssrc/webview/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,8 @@ const createReactWebView = ({ extensionPath, workspaceState, workspaceRoot }: Re
localResourceRoots: [vscode.Uri.file(path.join(extensionPath, 'build'))],
// prevents destroying the window when it is in the background
retainContextWhenHidden: true,
// allows scripts to load external resources (eg. markdown images, fonts)
enableCommandUris: true,
}
loaded = true
return vscode.window.createWebviewPanel(viewType, title, vscode.ViewColumn.Two, config)
Expand Down
13 changes: 7 additions & 6 deletionssrc/webview/render.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -64,12 +64,13 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
// set CSP (content security policy) to grant permission to local files
const cspMeta: HTMLMetaElement = document.createElement('meta')
cspMeta.httpEquiv = 'Content-Security-Policy'
cspMeta.content = [
`font-src ${panel.webview.cspSource} http: https: data:;`,
`img-src ${panel.webview.cspSource} https:;`,
`script-src ${nonces.map(nonce => `'nonce-${nonce}'`).join(' ')};`,
`style-src ${panel.webview.cspSource} https:;`,
].join(' ')
cspMeta.content =
[
`font-src ${panel.webview.cspSource} http: https: data:`,
`img-src ${panel.webview.cspSource} https:`,
`script-src ${nonces.map(nonce => `'nonce-${nonce}'`).join(' ')} data:`,
`style-src ${panel.webview.cspSource} https:`,
].join('; ') + ';'
document.head.appendChild(cspMeta)

// stringify dom
Expand Down
26 changes: 13 additions & 13 deletionsweb-app/src/styles/index.css
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,26 +2,26 @@
@import'~@alifd/theme-4/dist/next.css';

html {
height:100%;
width:100%;
height:100%;
width:100%;
}

body {
height:100%;
width:100%;
margin:0;
padding:0;
font-family: -apple-system, BlinkMacSystemFont,'Segoe UI','Roboto','Oxygen','Ubuntu','Cantarell','Fira Sans',
'Droid Sans','Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-color: white;
height:100%;
width:100%;
margin:0;
padding:0;
font-family: -apple-system, BlinkMacSystemFont,'Segoe UI','Roboto','Oxygen','Ubuntu','Cantarell','Fira Sans',
'Droid Sans','Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-color: white;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas,'Courier New', monospace;
font-family: source-code-pro, Menlo, Monaco, Consolas,'Courier New', monospace;
}

p {
margin:0;
margin:0;
}

[8]ページ先頭

©2009-2025 Movatter.jp