fix: resolve all linting and type errors

- Remove unused applyHighlightsToText import from ContentPanel
- Replace while(true) with proper condition in findHighlightMatches
- Remove unused match parameter from replaceTextWithMark function

All ESLint and TypeScript checks now pass with no errors.
This commit is contained in:
Gigi
2025-10-04 22:13:31 +01:00
parent aa8d3c285d
commit e98dc1c5da
2 changed files with 6 additions and 7 deletions

View File

@@ -25,10 +25,8 @@ export function findHighlightMatches(
let startIndex = 0
// Find all occurrences of this highlight in the content
while (true) {
const index = content.indexOf(searchText, startIndex)
if (index === -1) break
let index = content.indexOf(searchText, startIndex)
while (index !== -1) {
matches.push({
highlight,
startIndex: index,
@@ -36,6 +34,7 @@ export function findHighlightMatches(
})
startIndex = index + searchText.length
index = content.indexOf(searchText, startIndex)
}
}
@@ -110,7 +109,7 @@ function createMarkElement(highlight: Highlight, matchText: string): HTMLElement
}
// Helper to replace text node with mark element
function replaceTextWithMark(textNode: Text, before: string, match: string, after: string, mark: HTMLElement) {
function replaceTextWithMark(textNode: Text, before: string, after: string, mark: HTMLElement) {
const parent = textNode.parentNode
if (!parent) return
@@ -157,7 +156,7 @@ function tryMarkInTextNodes(
const after = text.substring(actualIndex + searchText.length)
const mark = createMarkElement(highlight, match)
replaceTextWithMark(textNode, before, match, after, mark)
replaceTextWithMark(textNode, before, after, mark)
return true
}