Skip to content

Commit 3f1d3f7

Browse files
committed
fix(highlight): Validate (optional) text when highlighting range
1 parent 3f60f78 commit 3f1d3f7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/highlight-support.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ const highlightSupport = {
4848
const actualStartIndex = startIndex
4949
const actualEndIndex = endIndex
5050

51+
// If text is provided then validate that it matches
52+
if (text && text !== blockText.slice(actualStartIndex, actualEndIndex)) {
53+
return -1
54+
}
55+
5156
highlightText.highlightMatches(editableHost, [{
5257
startIndex: actualStartIndex,
5358
endIndex: actualEndIndex,

0 commit comments

Comments
 (0)