File tree Expand file tree Collapse file tree 1 file changed +70
-0
lines changed
Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Original file line number Diff line number Diff line change 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 >
You can’t perform that action at this time.
0 commit comments