Never assign a 0 height or width when measuring editor scroll view

This commit is contained in:
Nathan Sobo
2014-04-18 16:24:30 -06:00
parent 274ca33959
commit a271e52a4e

View File

@@ -182,15 +182,17 @@ EditorScrollViewComponent = React.createClass
measureHeightAndWidth: ->
return unless @isMounted()
{editor} = @props
node = @getDOMNode()
computedStyle = getComputedStyle(node)
{editor} = @props
unless computedStyle.height is '0px'
editor.setHeight(node.clientHeight)
clientHeight = node.clientHeight
editor.setHeight(clientHeight) if clientHeight > 0
unless computedStyle.width is '0px'
editor.setWidth(node.clientWidth)
clientWidth = node.clientWidth
editor.setWidth(clientWidth) if clientHeight > 0
focus: ->
@refs.input.focus()