refactor: remove all console.log debug output

This commit is contained in:
Gigi
2025-10-19 22:35:45 +02:00
parent 1c21615103
commit 4202807777
58 changed files with 11 additions and 411 deletions

View File

@@ -10,14 +10,12 @@ export function applyHighlightsToHTML(
highlightStyle: 'marker' | 'underline' = 'marker'
): string {
if (!html || highlights.length === 0) {
console.log('⚠️ applyHighlightsToHTML: No HTML or highlights', {
htmlLength: html?.length,
highlightsCount: highlights.length
})
return html
}
console.log('🔨 applyHighlightsToHTML: Processing', highlights.length, 'highlights')
const tempDiv = document.createElement('div')
tempDiv.innerHTML = html
@@ -31,7 +29,6 @@ export function applyHighlightsToHTML(
mark.parentNode?.replaceChild(textNode, mark)
})
console.log('🧹 Removed', existingMarks.length, 'existing highlight marks')
let appliedCount = 0
@@ -42,7 +39,6 @@ export function applyHighlightsToHTML(
continue
}
console.log('🔍 Searching for highlight:', searchText.substring(0, 50) + '...')
// Collect all text nodes
const walker = document.createTreeWalker(tempDiv, NodeFilter.SHOW_TEXT, null)
@@ -50,7 +46,6 @@ export function applyHighlightsToHTML(
let node: Node | null
while ((node = walker.nextNode())) textNodes.push(node as Text)
console.log('📄 Found', textNodes.length, 'text nodes to search')
// Try exact match first, then normalized match
const found = tryMarkInTextNodes(textNodes, searchText, highlight, false, highlightStyle) ||
@@ -58,13 +53,11 @@ export function applyHighlightsToHTML(
if (found) {
appliedCount++
console.log('✅ Highlight applied successfully')
} else {
console.warn('❌ Could not find match for highlight:', searchText.substring(0, 50))
}
}
console.log('🎉 Applied', appliedCount, '/', highlights.length, 'highlights')
return tempDiv.innerHTML
}