Skip to content

Commit

Permalink
Need to clone since we modify
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed May 26, 2014
1 parent 5f3664e commit 279891c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/toolbar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Toolbar
_getActive: (range) ->
leafFormats = this._getLeafActive(range)
lineFormats = this._getLineActive(range)
return _.defaults(leafFormats, lineFormats)
return _.defaults({}, leafFormats, lineFormats)

_getLeafActive: (range) ->
if range.isCollapsed()
Expand All @@ -112,7 +112,7 @@ class Toolbar
[lastLine, offset] = @quill.editor.doc.findLineAt(range.end)
lastLine = lastLine.next if lastLine? and lastLine == firstLine
while firstLine? and firstLine != lastLine
formatsArr.push(firstLine.formats)
formatsArr.push(_.clone(firstLine.formats))
firstLine = firstLine.next
return this._intersectFormats(formatsArr)

Expand Down

0 comments on commit 279891c

Please sign in to comment.