fix: Render email preview in an iframe

This commit is contained in:
Faris Ansari 2020-03-05 14:05:50 +05:30
parent 020655bff8
commit df0f8fa5d7

View file

@ -1,16 +1,30 @@
frappe.preview_email = function(template, args, header) {
frappe.call({
method: 'frappe.email.email_body.get_email_html',
args: {
subject: 'Test',
template,
args,
header
}
}).then((r) => {
var html = r.message;
html = html.replace(/embed=/, 'src=');
var d = frappe.msgprint(html);
d.$wrapper.find('.modal-dialog').css('width', '70%');
});
frappe
.call({
method: 'frappe.email.email_body.get_email_html',
args: {
subject: 'Test',
template,
args,
header
}
})
.then(r => {
var html = r.message;
html = html.replace(/embed=/, 'src=');
var d = frappe.msgprint({
message:
'<iframe width="100%" height="600px" style="border: none;"></iframe>',
wide: true
});
setTimeout(() => {
d.$wrapper
.find('iframe')
.contents()
.find('html')
.html(html);
d.$wrapper.find('.modal-dialog').css('width', '70%');
}, 1000);
});
};