()
| 134 | }, [query, isRegex, caseSensitive, currentMatch, totalMatches]); |
| 135 | |
| 136 | function clearHighlights() { |
| 137 | if (!containerRef.current) return; |
| 138 | const marks = containerRef.current.querySelectorAll("mark.search-highlight"); |
| 139 | marks.forEach((mark) => { |
| 140 | mark.replaceWith(mark.textContent ?? ""); |
| 141 | }); |
| 142 | // Normalize text nodes |
| 143 | containerRef.current.normalize(); |
| 144 | } |
| 145 | |
| 146 | const goNext = () => { |
| 147 | setCurrentMatch((c) => (c >= totalMatches ? 1 : c + 1)); |
no test coverage detected