Skip to content

Commit

Permalink
Fix nested anchor tags after applying multiple link formats.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yujian Yao committed Jul 1, 2015
1 parent 54cae74 commit 035bd9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/format.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Format
dom(node.parentNode.previousSibling).merge(node.parentNode)
if node.parentNode.tagName == node.parentNode.nextSibling?.tagName
dom(node.parentNode).merge(node.parentNode.nextSibling)
if _.isString(@config.tag)
if _.isString(@config.tag) and node.tagName != @config.tag
formatNode = document.createElement(@config.tag)
if dom.VOID_TAGS[formatNode.tagName]?
dom(node).replace(formatNode) if node.parentNode?
Expand Down
7 changes: 7 additions & 0 deletions test/unit/core/format.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ describe('Format', ->
expect(@container).toEqualHTML('<span style="color: red;">Text</span>')
)

it('change value with given tag', ->
@container.innerHTML = '<a href="link1">a</a>'
format = new Quill.Format(Quill.Format.FORMATS.link)
format.add(@container.firstChild, 'link2')
expect(@container).toEqualHTML('<a href="link2">a</a>')
)

it('default value', ->
@container.innerHTML = '<span>Text</span>'
format = new Quill.Format(Quill.Format.FORMATS.size)
Expand Down

0 comments on commit 035bd9c

Please sign in to comment.