fix viewer.js

This commit is contained in:
Sidharth Vinod
2023-02-19 21:43:50 +05:30
parent a88789fe07
commit 284ef24deb
6 changed files with 30 additions and 23 deletions

View File

@@ -1,7 +1,12 @@
<html>
<head>
<meta charset="utf-8" />
<script src="./viewer.js" type="module"></script>
<script type="module">
import { init } from './viewer.js';
import mermaid from './mermaid.esm.mjs';
import external from './mermaid-example-diagram.esm.mjs';
init(mermaid, external);
</script>
<link
href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap"
rel="stylesheet"

View File

@@ -1,5 +1,5 @@
import mermaid2 from '../../packages/mermaid/src/mermaid';
import externalExample from '../../packages/mermaid-example-diagram/src/detector';
let mermaid2;
let externalExample;
function b64ToUtf8(str) {
return decodeURIComponent(escape(window.atob(str)));
@@ -144,3 +144,8 @@ if (typeof document !== 'undefined') {
false
);
}
export function init(mermaid, external) {
mermaid2 = mermaid;
externalExample = external;
}

View File

@@ -1,6 +1,15 @@
<html>
<head>
<script src="./viewer.js" type="module"></script>
<script type="module">
import { init } from './viewer.js';
import mermaid from './mermaid.esm.mjs';
import external from './mermaid-example-diagram.esm.mjs';
mermaid.initialize({
startOnLoad: false,
useMaxWidth: true,
});
init(mermaid, external);
</script>
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet" />
<style>
.malware {
@@ -32,13 +41,5 @@
}
</script>
</head>
<body>
<script type="module">
import mermaid from './mermaid.esm.mjs';
mermaid.initialize({
startOnLoad: false,
useMaxWidth: true,
});
</script>
</body>
<body></body>
</html>