@@ -78,25 +78,14 @@ class ReactWebView {
7878 // TODO: prevent window from moving to the left when no windows remain on rights
7979 }
8080
81- public createOrShow ( column : number , callback ?: ( ) => void ) : void {
81+ public createOrShow ( column : number ) : void {
8282 // If we already have a panel, show it.
8383 // Otherwise, create a new panel.
8484 if ( this . panel && this . panel . webview ) {
8585 this . panel . reveal ( column )
8686 } else {
8787 this . panel = this . createWebviewPanel ( column )
8888 }
89- if ( callback ) {
90- // listen for when webview is loaded
91- // unfortunately there is no easy way of doing this
92- const webPanelListener = setInterval ( ( ) => {
93- if ( this . loaded ) {
94- // callback tells editor the webview has loaded
95- setTimeout ( callback )
96- clearInterval ( webPanelListener )
97- }
98- } , 200 )
99- }
10089 }
10190
10291 public async postMessage ( action : CR . Action ) : Promise < void > {
@@ -143,7 +132,7 @@ class ReactWebView {
143132 const styles = [
144133 'main.css' ,
145134 // get style chunk
146- // Object.keys(manifest.files).find(f => f.match(/^static\/css\/.+\.css$/)) || ''
135+ Object . keys ( manifest . files ) . find ( f => f . match ( / ^ s t a t i c \/ c s s \/ .+ \. c s s $ / ) ) || ''
147136 ] . map ( style => getSrc ( style ) )
148137
149138 // map over scripts
@@ -161,7 +150,6 @@ class ReactWebView {
161150 src : script . manifest ? getSrc ( script . manifest ) : script . file
162151 } ) )
163152
164-
165153 const indexHtml = `<!DOCTYPE html>
166154 <html lang='en'>
167155 <head>
@@ -173,14 +161,13 @@ class ReactWebView {
173161
174162 <link rel='stylesheet' href='https://unpkg.com/@alifd/next/dist/next.css' />
175163 ${ styles . map ( styleUri => `<link rel='stylesheet' type='text/css' href='${ styleUri } '>` ) . join ( '\n' ) }
176-
177164 <meta http-equiv='Content-Security-Policy' content="font-src *; img-src vscode-resource: https:; script-src ${ scripts . map ( script => `'nonce-${ script . nonce } '` ) . join ( ' ' ) } ; style-src vscode-resource: 'unsafe-inline' http: https: data:;">
178165 <base href='${ buildUri } /'>
179166 </head>
180167
181168 <body>
182169 <noscript>You need to enable JavaScript to run this app.</noscript>
183- <div id='root'>Loading...</div>
170+ <div id='root' style='background-color:white; padding: 1rem;' >Loading...</div>
184171 ${ scripts . map ( s => `<script nonce='${ s . nonce } ' src='${ s . src } '></script>` ) . join ( '\n' ) }
185172 </body>
186173 </html>`
0 commit comments