@@ -16,27 +16,25 @@ function activate(context) {
16
16
'Mermaid Preview' ,
17
17
vscode . ViewColumn . Two ,
18
18
{
19
- enableScripts : true
19
+ enableScripts : true ,
20
20
}
21
21
) ;
22
22
23
23
const getContent = ( ) => {
24
24
const config = vscode . workspace . getConfiguration ( 'mermaid' ) ;
25
25
const configString = JSON . stringify ( config ) ;
26
26
27
- const faBase = vscode . Uri . file (
28
- context . asAbsolutePath (
29
- 'previewer/dist/vendor/font-awesome/css/font-awesome.min.css'
27
+ const faBase = panel . webview . asWebviewUri (
28
+ vscode . Uri . file (
29
+ context . asAbsolutePath (
30
+ 'previewer/dist/vendor/font-awesome/css/font-awesome.min.css'
31
+ )
30
32
)
31
- ) . with ( {
32
- scheme : 'vscode-resource'
33
- } ) ;
33
+ ) ;
34
34
35
- const jsUrl = vscode . Uri . file (
36
- context . asAbsolutePath ( 'previewer/dist/index.js' )
37
- ) . with ( {
38
- scheme : 'vscode-resource'
39
- } ) ;
35
+ const jsUrl = panel . webview . asWebviewUri (
36
+ vscode . Uri . file ( context . asAbsolutePath ( 'previewer/dist/index.js' ) )
37
+ ) ;
40
38
41
39
return `
42
40
<!DOCTYPE html>
@@ -66,12 +64,12 @@ function activate(context) {
66
64
: findDiagram ( text , cursor ) ;
67
65
68
66
panel . webview . postMessage ( {
69
- diagram
67
+ diagram,
70
68
} ) ;
71
69
} ;
72
70
73
71
vscode . workspace . onDidChangeTextDocument (
74
- e => {
72
+ ( e ) => {
75
73
if ( e . document === vscode . window . activeTextEditor . document ) {
76
74
previewHandler ( ) ;
77
75
}
@@ -81,15 +79,15 @@ function activate(context) {
81
79
) ;
82
80
83
81
vscode . workspace . onDidChangeConfiguration (
84
- e => {
82
+ ( e ) => {
85
83
panel . webview . html = getContent ( ) ;
86
84
} ,
87
85
null ,
88
86
_disposables
89
87
) ;
90
88
91
89
vscode . window . onDidChangeTextEditorSelection (
92
- e => {
90
+ ( e ) => {
93
91
if ( e . textEditor === vscode . window . activeTextEditor ) {
94
92
previewHandler ( ) ;
95
93
}
0 commit comments