-
Notifications
You must be signed in to change notification settings - Fork 152
Expand file tree
/
Copy pathindex.html
More file actions
46 lines (43 loc) · 1.54 KB
/
index.html
File metadata and controls
46 lines (43 loc) · 1.54 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SuperDoc — CDN</title>
<link href="./style.css" rel="stylesheet" />
<script src="./superdoc.min.js"></script>
<style>
body { margin: 0; font-family: system-ui, sans-serif; }
#controls { padding: .5rem 1rem; background: #f1f5f9; border-bottom: 1px solid #e2e8f0; display: flex; gap: .5rem; align-items: center; }
#toolbar { border-bottom: 1px solid #e2e8f0; }
#editor { height: calc(100vh - 92px); }
</style>
</head>
<body>
<div id="controls">
<input type="file" id="file-input" accept=".docx" />
<span style="color:#64748b;font-size:.875rem">or open the bundled sample</span>
</div>
<div id="toolbar"></div>
<div id="editor"></div>
<script>
function mount(source) {
if (window.__sd) window.__sd.destroy();
window.__sd = new SuperDoc({
selector: '#editor',
toolbar: '#toolbar',
document: source,
documentMode: 'editing',
user: { name: 'Guest', email: 'guest@example.com' },
onReady: () => (window.__SUPERDOC_READY__ = true),
});
}
// Load the bundled sample on first paint so the page shows a real editor.
mount('./test_file.docx');
document.getElementById('file-input').addEventListener('change', function (e) {
const file = e.target.files[0];
if (file) mount(file);
});
</script>
</body>
</html>