We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d2ef3eb commit 09e0bdbCopy full SHA for 09e0bdb
src/highlight-support.js
@@ -51,6 +51,7 @@ const highlightSupport = {
51
marker.appendChild(fragment)
52
range.deleteContents()
53
range.insertNode(marker)
54
+ highlightSupport.cleanupStaleMarkerNodes(editableHost, 'comment')
55
return startIndex
56
},
57
@@ -115,6 +116,15 @@ const highlightSupport = {
115
116
}
117
118
119
+ cleanupStaleMarkerNodes (editableHost, highlightType) {
120
+ editableHost.querySelectorAll('span[data-highlight="' + highlightType + '"]')
121
+ .forEach(node => {
122
+ if (!node.textContent.length) {
123
+ node.parentNode.removeChild(node)
124
+ }
125
+ })
126
+ },
127
+
128
createMarkerNode (markerMarkup, highlightType, win) {
129
let marker = $(markerMarkup)[0]
130
0 commit comments