From cd1f39f2fa53e7aae53a8d7b9a4abf92f44cd194 Mon Sep 17 00:00:00 2001 From: Annie Date: Tue, 19 Jul 2016 11:39:43 -0700 Subject: [PATCH] fix(email): Fix email body height bug #1280 Summary: Some emails were having their body height set to 0 if their height was dependent upon the iframe height -- e.g. body.height equals 100% or inherit. Added a check to see if height computed to 0px and if so, set the height to auto. Test Plan: Tested with emails on my computer Reviewers: juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3100 --- internal_packages/message-list/lib/email-frame.jsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal_packages/message-list/lib/email-frame.jsx b/internal_packages/message-list/lib/email-frame.jsx index 11c009ef9..7967da25c 100644 --- a/internal_packages/message-list/lib/email-frame.jsx +++ b/internal_packages/message-list/lib/email-frame.jsx @@ -101,6 +101,13 @@ export default class EmailFrame extends React.Component { let height = 0; if (doc && doc.body) { + // Why reset the height? body.scrollHeight will always be 0 if the height + // of the body is dependent on the iframe height e.g. if height === + // 100% in inline styles or an email stylesheet + const style = window.getComputedStyle(doc.body) + if (style.height === '0px') { + doc.body.style.height = "auto" + } height = doc.body.scrollHeight; }