Skip to content

Commit

Permalink
changed "__originalHTML" to point to a cloned element instead of inne…
Browse files Browse the repository at this point in the history
…rHTML, so when pressing `escape`, it will be replaced back to that, as-is
  • Loading branch information
Yair Even Or authored and Yair Even Or committed Jul 9, 2022
1 parent a8b5d2a commit 81d49b9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tagify.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,10 @@ Tagify.prototype = {
// cache the original data, on the DOM node, before any modification ocurs, for possible revert
tagData = this.tagData(tagElm, {
__originalData: extend({}, tagData),
__originalHTML: tagElm.innerHTML
__originalHTML: tagElm.cloneNode(true)
})
// this.replaceTag(tagElm, tagData)
// re-set the tagify custom-prop on the clones element (because cloning removed it)
this.tagData(tagData.__originalHTML, tagData.__originalData)

editableElm.setAttribute('contenteditable', true)
tagElm.classList.add( _s.classNames.tagEditing )
Expand Down

0 comments on commit 81d49b9

Please sign in to comment.