var design = {...}; // template JSON
mailui.loadDesign(design);
{}
into mailui.loadDesign()
. This initializes a new design with no pre-existing content, allowing you to start from scratch.// pass empty object
mailui.loadDesign({});
mailui.fetchInitialDesign(async (design: { json: JSONTemplate; version: string }) => {
let siteData = design.json;
const sectionDesign = {}; // section JSON
siteData.pages[0].data.elements = sectionDesign;
mailui.loadDesign(siteData || {});
});
mailui.saveDesign(function(design) {
const json = data.json;
const html = data.html;
const version = data.version;
console.log(json, html, version);
});
mailui.addEventListener('design:updated', function(updates) {
// Design is updated by the user
mailui.exportHtml(function(data) {
const json = data.json;
const html = data.html;
const version = data.version;
console.log(json, html, version);
// Save the json, or html here
})
})