Skip to content

Commit

Permalink
Merge pull request slab#311 from voxmedia/fix-remove-format
Browse files Browse the repository at this point in the history
Ensure targetNode matches leaf.length in formatText
  • Loading branch information
jhchen committed Mar 20, 2015
2 parents fc1cdf1 + f855771 commit cbb6f99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/line.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class Line extends LinkedList.Node
dom(targetNode).splitBefore(@node)
while !format.match(targetNode)
targetNode = targetNode.parentNode
dom(targetNode).split(leaf.length)
# Isolate target node
if leafOffset > 0
[leftNode, targetNode] = dom(targetNode).split(leafOffset)
Expand Down
4 changes: 4 additions & 0 deletions test/unit/core/line.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ describe('Line', ->
initial: '<b><i>01</i><s>23</s></b><i><s>45</s><b>67</b></i>'
expected: '<b><i>01</i></b><b><s>2</s></b><s>3</s><i><s>45</s></i><i>6<b>7</b></i>'
args: [3, 4, 'bold', false]
'split boundaries with parents remove at beginning':
initial: '<b><i>01</i><s>23</s></b>'
expected: '<i>01</i><s>23</s>'
args: [0, 4, 'bold', false]
'remove image':
initial: '<b>01</b><img src="http://quilljs.com/images/cloud.png"><s>34</s>'
expected: "<b>01</b>#{dom.EMBED_TEXT}<s>34</s>"
Expand Down

0 comments on commit cbb6f99

Please sign in to comment.