Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Merge pull request slab#426 from Asana/fix_parent_tag
Browse files Browse the repository at this point in the history
Fix an issue with formats with parentTag
  • Loading branch information
jhchen committed Jul 25, 2015
2 parents 3a6f2d4 + 0db1405 commit 18c4f42
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/format.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ class Format
return this.remove(node) unless value
return node if this.value(node) == value
if _.isString(@config.parentTag)
parentNode = document.createElement(@config.parentTag)
dom(node).wrap(parentNode)
parentNode = node.parentNode;
if parentNode.tagName != @config.parentTag
parentNode = document.createElement(@config.parentTag)
dom(node).wrap(parentNode)
if node.parentNode.tagName == node.parentNode.previousSibling?.tagName
dom(node.parentNode.previousSibling).merge(node.parentNode)
if node.parentNode.tagName == node.parentNode.nextSibling?.tagName
Expand Down

0 comments on commit 18c4f42

Please sign in to comment.