mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-23 15:46:28 +08:00
fix(message): fix truncation of messages
It would seem the document.documentElement.scrollHeight can return 0 when the document.body.scrollHeight reliably returns the correct height. Changed to fallback to various height checking mechanisms. Fixes #425 Fixes #1102 Fixes #1153
This commit is contained in:
parent
256b240b70
commit
6620779ee2
1 changed files with 6 additions and 3 deletions
|
@ -59,12 +59,15 @@ class EmailFrame extends React.Component
|
|||
@refs.iframe.documentWasReplaced()
|
||||
@_setFrameHeight()
|
||||
|
||||
_getFrameHeight: (doc) ->
|
||||
return 0 unless doc
|
||||
return doc.body?.scrollHeight ? doc.documentElement?.scrollHeight ? 0
|
||||
|
||||
_setFrameHeight: =>
|
||||
return unless @_mounted
|
||||
|
||||
domNode = React.findDOMNode(@)
|
||||
wrapper = domNode.contentDocument.getElementsByTagName('html')[0]
|
||||
height = wrapper.scrollHeight
|
||||
height = @_getFrameHeight(domNode.contentDocument)
|
||||
|
||||
# Why 5px? Some emails have elements with a height of 100%, and then put
|
||||
# tracking pixels beneath that. In these scenarios, the scrollHeight of the
|
||||
|
@ -74,7 +77,7 @@ class EmailFrame extends React.Component
|
|||
domNode.height = "#{height}px"
|
||||
@_lastComputedHeight = height
|
||||
|
||||
unless domNode?.contentDocument?.readyState is 'complete'
|
||||
unless domNode.contentDocument?.readyState is 'complete'
|
||||
_.defer => @_setFrameHeight()
|
||||
|
||||
_emailContent: =>
|
||||
|
|
Loading…
Reference in a new issue