Skip to content

Commit a25ecc5

Browse files
committed
Create basic.html
1 parent b1f5232 commit a25ecc5

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

example-vanilla-js/basic.html

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Document</title>
7+
8+
<style>
9+
* {
10+
box-sizing: border-box;
11+
margin: 0;
12+
padding: 0;
13+
}
14+
15+
#mailui-editor {
16+
width: 100%;
17+
height: 100vh;
18+
}
19+
</style>
20+
</head>
21+
<body>
22+
<div id="mailui-editor"></div>
23+
24+
<script src="https://editor.mailui.co/embed.min.js"></script>
25+
<script>
26+
var editor = mailui.init({
27+
id: 'mailui-editor',
28+
projectId: 'YOUR_PROJECT_ID',
29+
signature: 'YOUR_SIGNATURE',
30+
});
31+
32+
(async () => {
33+
try {
34+
const res = await fetch('../example/basic/sampleTemplate.json');
35+
const design = await res.json();
36+
37+
// await editor.loadDesign(design);
38+
await editor.loadDesign({});
39+
console.log('Design loaded successfully.');
40+
41+
editor.exportHtml(
42+
(data) => {
43+
console.log('HTML exported:', data);
44+
},
45+
{
46+
amp: false,
47+
minify: false,
48+
}
49+
);
50+
51+
editor.exportPlainText(
52+
(data) => {
53+
console.log('Plain text exported:', data);
54+
},
55+
{
56+
amp: false,
57+
minify: false,
58+
}
59+
);
60+
61+
editor.addEventListener('design:updated', (design) => {
62+
console.log('Design updated:', design);
63+
});
64+
} catch (err) {
65+
console.error('Error loading or exporting design:', err);
66+
}
67+
})();
68+
</script>
69+
</body>
70+
</html>

0 commit comments

Comments
 (0)