Permalink
Browse files

in TextLayer, only generate a <br/> if the whole line is empty

  • Loading branch information...
onnlucky committed Jul 27, 2017
1 parent b6b792c commit ee120e5badbaacc861ac9d6ad57b943b384fd1ec
Showing with 4 additions and 3 deletions.
  1. +4 −3 framer/StyledText.coffee
View
@@ -61,11 +61,11 @@ class InlineStyle
endIndex: @endIndex
css: _.clone(@css)
createElement: ->
createElement: (maybeLineBreak) ->
span = document.createElement "span"
for prop, value of @css
span.style[prop] = value
if @text is ""
if @text is "" and maybeLineBreak
span.innerHTML = "<br/>"
else
span.textContent = @text
@@ -152,8 +152,9 @@ class StyledTextBlock
createElement: ->
div = document.createElement "div"
div.style.fontSize = "1px"
maybeLineBreak = @inlineStyles.length is 1
for style in @inlineStyles
span = style.createElement()
span = style.createElement(maybeLineBreak)
style.element = span
div.appendChild span
return div

0 comments on commit ee120e5

Please sign in to comment.