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
This commit is contained in:
Annie 2016-07-19 11:39:43 -07:00
parent 34bf11d9c0
commit cd1f39f2fa

View file

@ -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;
}