From d745f98bb7e77e9a1841ca9f5b7c9a6046c3b794 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 8 Jan 2020 12:38:09 +0100 Subject: [PATCH] Add polyfill for browsers not supporting srcdoc --- plugins/base/public/assets/script.js | 10 ++++++++++ plugins/base/public/message.html | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/base/public/assets/script.js b/plugins/base/public/assets/script.js index 84c353e..fd7a1d5 100644 --- a/plugins/base/public/assets/script.js +++ b/plugins/base/public/assets/script.js @@ -1,8 +1,18 @@ var emailFrame = document.getElementById("email-frame"); if (emailFrame) { + // Resize the frame with its content var resizeFrame = function() { emailFrame.style.height = emailFrame.contentWindow.document.documentElement.scrollHeight + "px"; }; emailFrame.addEventListener("load", resizeFrame); emailFrame.contentWindow.addEventListener("resize", resizeFrame); + + // Polyfill in case the srcdoc attribute isn't supported + if (!emailFrame.srcdoc) { + var srcdoc = emailFrame.getAttribute("srcdoc"); + var doc = emailFrame.contentWindow.document; + doc.open(); + doc.write(srcdoc); + doc.close(); + } } diff --git a/plugins/base/public/message.html b/plugins/base/public/message.html index 343f79e..9544d0a 100644 --- a/plugins/base/public/message.html +++ b/plugins/base/public/message.html @@ -113,7 +113,6 @@ {{if .Body}}

Reply

{{if .IsHTML}} -