Skip to content

Commit 2204337

Browse files
committed
fix: comment highlight when text is deleted
1 parent 928c2a9 commit 2204337

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/highlight-support.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const highlightSupport = {
4040
const markerNode = highlightSupport.createMarkerNode(firstMarker, type, this.win)
4141
const textSearch = new TextHighlighting(markerNode, 'text')
4242
const blockText = highlightText.extractText(editableHost)
43+
if (blockText === '') return -1 // the text was deleted so we can't highlight it
4344
const matchesArray = textSearch.findMatches(blockText, [text])
4445
const {actualStartIndex, actualEndIndex} = this.getIndex(matchesArray, startIndex, endIndex)
4546
const range = rangy.createRange()

0 commit comments

Comments
 (0)