-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
51 lines (43 loc) · 1.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@fusionstrings/river</title>
<link rel="stylesheet" href="css/style.css" />
<script>
window.esmsInitOptions = { polyfillEnable: ['css-modules', 'json-modules'] }
</script>
<script async src="https://ga.jspm.io/npm:es-module-shims@1.3.0/dist/es-module-shims.js"></script>
<script type="importmap" id="importmap">
//__importmap
</script>
</head>
<body>
<main id="root">
<h1>@fusionstrings/river</h1>
</main>
<script type="module">
import excalidraw from "@excalidraw/excalidraw";
let params = (new URL(document.location)).searchParams;
let scratch = params.get('scratch') ? new URL(params.get('scratch').replace('http://', 'https://')).toString() : '';
const format = params.get('format');
let initialData = null;
if (scratch) {
const drawing = await fetch(scratch);
initialData = await drawing.json();
} else {
initialData = await import('./data/initial-data.excalidraw', { assert: { type: "json" } });
}
if (format === 'svg') {
const svg = await excalidraw.exportToSvg(initialData);
console.log(svg);
document.getElementById('root').innerHTML = svg.outerHTML;
} else {
const { main } = await import('./js/main.js');
main({ mountElementID: "root", initialData });
}
</script>
</body>
</html>