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

Commit6bafe24

Browse files
committed
WIP: fix extension to run on windows computers
Signed-off-by: argemiront <argemiront@gmail.com>
1 parentb60526d commit6bafe24

File tree

3 files changed

+29
-30
lines changed

3 files changed

+29
-30
lines changed

‎scripts/build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ tsc -p ./
1414
cd web-app
1515
npm run build
1616
cd ..
17-
cp -R ./web-app/build/ ./build/
17+
# For Windows build: switch the next 2 lines
18+
# cp -R ./web-app/build/ ./
19+
cp -R ./web-app/build/ ./build
1820
node scripts/fixFontPaths.js
1921

2022
echo"Build complete!"

‎src/webview/render.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,18 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
2020

2121
// set base href
2222
constbase:HTMLBaseElement=document.createElement('base')
23-
base.href=`vscode-resource:${rootPath}/`
23+
base.href=`${vscode.Uri.file(path.join(rootPath,'build')).with({scheme:'vscode-resource'})}`
2424

2525
document.head.appendChild(base)
2626

2727
// used for CSP
2828
constnonces:string[]=[]
2929

3030
// generate vscode-resource build path uri
31-
constcreateUri=(filePath:string):any=>{
32-
return(
33-
panel.webview
34-
//@ts-ignore
35-
.asWebviewUri(vscode.Uri.file(filePath))
36-
.toString()
37-
.replace(/^\/+/g,'')// remove leading '/'
38-
.replace('/vscode-resource%3A',rootPath)
39-
)// replace mangled resource path with root
31+
constcreateUri=(_filePath:string):any=>{
32+
constfilePath=(_filePath.startsWith('vscode') ?_filePath.substr(16) :_filePath).replace('///','\\')
33+
34+
returnpanel.webview.asWebviewUri(vscode.Uri.file(path.join(rootPath,filePath)))
4035
}
4136

4237
// fix paths for scripts
@@ -55,7 +50,7 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
5550
runTimeScript.nonce=getNonce()
5651
nonces.push(runTimeScript.nonce)
5752
constmanifest=awaitimport(path.join(rootPath,'asset-manifest.json'))
58-
runTimeScript.src=createUri(path.join(rootPath,manifest.files['runtime-main.js']))
53+
runTimeScript.src=createUri(manifest.files['runtime-main.js'])
5954
document.body.appendChild(runTimeScript)
6055

6156
// fix paths for links

‎web-app/public/index.html

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<!DOCTYPE html>
22
<htmllang="en">
3-
<head>
4-
<metacharset="utf-8"/>
5-
<metaname="viewport"content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
6-
<metaname="theme-color"content="#000000"/>
7-
<!--
3+
4+
<head>
5+
<metacharset="utf-8"/>
6+
<metaname="viewport"content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
7+
<metaname="theme-color"content="#000000"/>
8+
<!--
89
manifest.json provides metadata used when your web app is added to the
910
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
1011
-->
11-
<linkrel="manifest"href="%PUBLIC_URL%/manifest.json"/>
12-
<linkrel="shortcut icon"href="%PUBLIC_URL%/favicon.ico"/>
13-
<!--
12+
<linkrel="manifest"href="manifest.json"/>
13+
<linkrel="shortcut icon"href="favicon.ico"/>
14+
<!--
1415
Notice the use of %PUBLIC_URL% in the tags above.
1516
It will be replaced with the URL of the `public` folder during the build.
1617
Only files inside the `public` folder can be referenced from the HTML.
@@ -19,15 +20,15 @@
1920
work correctly both with client-side routing and a non-root public URL.
2021
Learn how to configure a non-root public URL by running `npm run build`.
2122
-->
22-
<title>CodeRoad</title>
23-
</head>
23+
<title>CodeRoad</title>
24+
</head>
2425

25-
<body>
26-
<noscript>
27-
You need to enable JavaScript to run this app.
28-
</noscript>
29-
<divid="root"></div>
30-
<!--
26+
<body>
27+
<noscript>
28+
You need to enable JavaScript to run this app.
29+
</noscript>
30+
<divid="root"></div>
31+
<!--
3132
This HTML file is a template.
3233
If you open it directly in the browser, you will see an empty page.
3334
@@ -37,5 +38,6 @@
3738
To begin the development, run `npm start` or `yarn start`.
3839
To create a production bundle, use `npm run build` or `yarn build`.
3940
-->
40-
</body>
41-
</html>
41+
</body>
42+
43+
</html>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp