@@ -138,7 +138,12 @@ class TributeRange {
138138 let textSuffix = typeof this . tribute . replaceTextSuffix == 'string'
139139 ? this . tribute . replaceTextSuffix
140140 : '\xA0'
141- text += textSuffix
141+ if ( text instanceof HTMLElement ) {
142+ // skip adding suffix yet - TODO later
143+ // text.appendChild(this.getDocument().createTextNode(textSuffix))
144+ } else {
145+ text += textSuffix
146+ }
142147 let endPos = info . mentionPosition + info . mentionText . length
143148 if ( ! this . tribute . autocompleteMode ) {
144149 endPos += info . mentionTriggerChar . length
@@ -151,7 +156,7 @@ class TributeRange {
151156 }
152157 }
153158
154- pasteHtml ( html , startPos , endPos ) {
159+ pasteHtml ( htmlOrElem , startPos , endPos ) {
155160 let range , sel
156161 sel = this . getWindowSelection ( )
157162 range = this . getDocument ( ) . createRange ( )
@@ -160,7 +165,11 @@ class TributeRange {
160165 range . deleteContents ( )
161166
162167 let el = this . getDocument ( ) . createElement ( 'div' )
163- el . innerHTML = html
168+ if ( htmlOrElem instanceof HTMLElement ) {
169+ el . appendChild ( htmlOrElem )
170+ } else {
171+ el . innerHTML = htmlOrElem
172+ }
164173 let frag = this . getDocument ( ) . createDocumentFragment ( ) ,
165174 node , lastNode
166175 while ( ( node = el . firstChild ) ) {
@@ -487,7 +496,7 @@ class TributeRange {
487496 div . appendChild ( span0 )
488497
489498 if ( element . nodeName === 'INPUT' ) {
490- div . textContent = div . textContent . replace ( / \s / g, ' ' )
499+ div . textContent = div . textContent . replace ( / \s / g, ' ' )
491500 }
492501
493502 //Create a span in the div that represents where the cursor
0 commit comments