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

Commita710d6f

Browse files
committed
add render test
1 parent23d787f commita710d6f

File tree

2 files changed

+125
-10
lines changed

2 files changed

+125
-10
lines changed

‎src/webview/render.ts

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

1919
// set base href
2020
constbase:HTMLBaseElement=document.createElement('base')
21-
base.href=
22-
vscode.Uri.file(rootPath)
23-
.with({scheme:'vscode-resource'})
24-
.toString()+'/'
21+
base.href=panel.webview.asWebviewUri(vscode.Uri.file(rootPath)).toString()+'/'
22+
2523
document.head.appendChild(base)
2624

2725
// used for CSP
2826
constnonces:string[]=[]
2927

3028
// generate vscode-resource build path uri
31-
constcreateUri=(filePath:string):string=>
32-
vscode.Uri.file(filePath)
33-
.with({scheme:'vscode-resource'})
34-
.toString()
35-
.replace(/^\/+/g,'')//remove leading '/'
36-
.replace('/vscode-resource%3A',rootPath)// replace mangled resource path with root
29+
constcreateUri=(filePath:string):any=>{
30+
returnpanel.webview.asWebviewUri(vscode.Uri.file(filePath))
31+
// .toString()
32+
// .replace(/^\/+/g, '') // remove leading '/'
33+
//.replace('/vscode-resource%3A', rootPath) //replace mangled resource path with root
34+
}
3735

3836
// fix paths for scripts
3937
constscripts:HTMLScriptElement[]=Array.from(document.getElementsByTagName('script'))
@@ -76,6 +74,8 @@ async function render(panel: vscode.WebviewPanel, rootPath: string) {
7674
// stringify dom
7775
consthtml=dom.serialize()
7876

77+
console.log(html)
78+
7979
// set view
8080
panel.webview.html=html
8181
}

‎src/webview/test.html

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<!DOCTYPE html>
2+
<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+
<linkrel="manifest"href="vscode-resource://file///vscode-resource%3A//file/manifest.json"/>
8+
<linkrel="shortcut icon"href="vscode-resource://file///vscode-resource%3A//file/favicon.ico"/>
9+
<title>CodeRoad</title>
10+
<linkhref="vscode-resource://file///vscode-resource%3A//file/static/css/2.c5c7edcb.chunk.css"rel="stylesheet"/>
11+
<link
12+
href="vscode-resource://file///vscode-resource%3A//file/static/css/main.4a0d7baa.chunk.css"
13+
rel="stylesheet"
14+
/>
15+
<basehref="vscode-resource://file///Users/shmck/Documents/GitHub/vscode-ext/coderoad-vscode/build/"/>
16+
<meta
17+
http-equiv="Content-Security-Policy"
18+
content="font-src vscode-resource://*; img-src vscode-resource: https:; script-src 'nonce-kIwmmn0lM4OCNQQTf02Fx54xPy6NsfMz' 'nonce-QKk0IrRgcfBlgAPT4aOs1lrDhshtKZVn' 'nonce-cmZb7xM4oXWL2NE9AuOszLtePTfxXd4b'; style-src vscode-resource: http: https: data:;"
19+
/>
20+
</head>
21+
<body>
22+
<noscript>You need to enable JavaScript to run this app.</noscript>
23+
<divid="root"></div>
24+
<script>
25+
!(function(l){
26+
functione(e){
27+
for(varr,t,n=e[0],o=e[1],u=e[2],a=0,p=[];a<n.length;a++)
28+
(t=n[a]),Object.prototype.hasOwnProperty.call(i,t)&&i[t]&&p.push(i[t][0]),(i[t]=0)
29+
for(rino)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r])
30+
for(s&&s(e);p.length;)p.shift()()
31+
returnc.push.apply(c,u||[]),f()
32+
}
33+
functionf(){
34+
for(vare,r=0;r<c.length;r++){
35+
for(vart=c[r],n=!0,o=1;o<t.length;o++){
36+
varu=t[o]
37+
0!==i[u]&&(n=!1)
38+
}
39+
n&&(c.splice(r--,1),(e=a((a.s=t[0]))))
40+
}
41+
returne
42+
}
43+
vart={},
44+
i={1:0},
45+
c=[]
46+
functiona(e){
47+
if(t[e])returnt[e].exports
48+
varr=(t[e]={i:e,l:!1,exports:{}})
49+
returnl[e].call(r.exports,r,r.exports,a),(r.l=!0),r.exports
50+
}
51+
;(a.m=l),
52+
(a.c=t),
53+
(a.d=function(e,r,t){
54+
a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})
55+
}),
56+
(a.r=function(e){
57+
'undefined'!=typeofSymbol&&
58+
Symbol.toStringTag&&
59+
Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),
60+
Object.defineProperty(e,'__esModule',{value:!0})
61+
}),
62+
(a.t=function(r,e){
63+
if((1&e&&(r=a(r)),8&e))returnr
64+
if(4&e&&'object'==typeofr&&r&&r.__esModule)returnr
65+
vart=Object.create(null)
66+
if(
67+
(a.r(t),Object.defineProperty(t,'default',{enumerable:!0,value:r}),2&e&&'string'!=typeofr)
68+
)
69+
for(varninr)
70+
a.d(
71+
t,
72+
n,
73+
function(e){
74+
returnr[e]
75+
}.bind(null,n),
76+
)
77+
returnt
78+
}),
79+
(a.n=function(e){
80+
varr=
81+
e&&e.__esModule
82+
?function(){
83+
returne.default
84+
}
85+
:function(){
86+
returne
87+
}
88+
returna.d(r,'a',r),r
89+
}),
90+
(a.o=function(e,r){
91+
returnObject.prototype.hasOwnProperty.call(e,r)
92+
}),
93+
(a.p='/')
94+
varr=(this['webpackJsonpcoderoad-app']=this['webpackJsonpcoderoad-app']||[]),
95+
n=r.push.bind(r)
96+
;(r.push=e),(r=r.slice())
97+
for(varo=0;o<r.length;o++)e(r[o])
98+
vars=n
99+
f()
100+
})([])
101+
</script>
102+
<script
103+
src="vscode-resource://file///vscode-resource%3A//file/static/js/2.c1fbbeb6.chunk.js"
104+
nonce="kIwmmn0lM4OCNQQTf02Fx54xPy6NsfMz"
105+
></script>
106+
<script
107+
src="vscode-resource://file///vscode-resource%3A//file/static/js/main.8f41c984.chunk.js"
108+
nonce="QKk0IrRgcfBlgAPT4aOs1lrDhshtKZVn"
109+
></script>
110+
<script
111+
nonce="cmZb7xM4oXWL2NE9AuOszLtePTfxXd4b"
112+
src="vscode-resource://file///Users/shmck/Documents/GitHub/vscode-ext/coderoad-vscode/build/static/js/runtime-main.71300037.js"
113+
></script>
114+
</body>
115+
</html>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp