File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import {
16
16
Uri ,
17
17
ViewColumn ,
18
18
window ,
19
+ workspace ,
19
20
} from 'vscode' ;
20
21
import { ProvideCompletionItemsSignature , ProvideHoverSignature } from 'vscode-languageclient' ;
21
22
@@ -37,14 +38,27 @@ export namespace DocsBrowser {
37
38
localResourceRoots : [ Uri . parse ( documentationDirectory ) ] ,
38
39
enableFindWidget : true ,
39
40
enableCommandUris : true ,
41
+ enableScripts : true ,
40
42
} ) ;
41
- const uri = panel . webview . asWebviewUri ( Uri . parse ( localPath ) ) ;
42
43
43
44
const encoded = encodeURIComponent ( JSON . stringify ( { hackageUri } ) ) ;
44
45
const hackageCmd = 'command:haskell.openDocumentationOnHackage?' + encoded ;
45
46
46
- panel . webview . html = `<div><a href="${ hackageCmd } ">Open on Hackage</a></div>
47
- <div><iframe src="${ uri } " frameBorder = "0" style = "background: white; width: 100%; height: 100%; position:absolute; left: 0; right: 0; bottom: 0; top: 30px;"/></div>` ;
47
+ const bytes = await workspace . fs . readFile ( Uri . parse ( localPath ) ) ;
48
+
49
+ const addBase = `
50
+ <base href="${ panel . webview . asWebviewUri ( Uri . parse ( documentationDirectory ) ) } /">
51
+ ` ;
52
+
53
+ panel . webview . html = `
54
+ <html>
55
+ ${ addBase }
56
+ <body>
57
+ <div><a href="${ hackageCmd } ">Open on Hackage</a></div>
58
+ ${ bytes . toString ( ) }
59
+ </body>
60
+ </html>
61
+ ` ;
48
62
} catch ( e ) {
49
63
await window . showErrorMessage ( e ) ;
50
64
}
You can’t perform that action at this time.
0 commit comments