Skip to content

Commit 7223d46

Browse files
committed
chore(highlight): Remove variable redeclaration in highlightRange
1 parent 3b84a76 commit 7223d46

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/highlight-support.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,28 +45,25 @@ const highlightSupport = {
4545
this.win
4646
)
4747

48-
const actualStartIndex = startIndex
49-
const actualEndIndex = endIndex
50-
5148
// If text is provided then validate that it matches
5249
if (text) {
5350
const tempElement = document.createElement('div')
5451
tempElement.innerHTML = text
55-
if (tempElement.textContent !== blockText.slice(actualStartIndex, actualEndIndex)) {
52+
if (tempElement.textContent !== blockText.slice(startIndex, endIndex)) {
5653
return -1
5754
}
5855
}
5956

6057
highlightText.highlightMatches(editableHost, [{
61-
startIndex: actualStartIndex,
62-
endIndex: actualEndIndex,
58+
startIndex,
59+
endIndex,
6360
id: highlightId,
6461
marker
6562
}], false)
6663

6764
if (dispatcher) dispatcher.notify('change', editableHost)
6865

69-
return actualStartIndex
66+
return startIndex
7067
},
7168

7269
updateHighlight (editableHost, highlightId, addCssClass, removeCssClass) {

0 commit comments

Comments
 (0)