fix: update originalHtmlRef when content changes

- Remove faulty conditional that prevented HTML ref from updating
- Now properly stores fresh content when switching articles
- Fixes issue where articles weren't switching properly
This commit is contained in:
Gigi
2025-10-05 03:42:28 +01:00
parent 91fe1711cd
commit 188147d057

View File

@@ -84,10 +84,8 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
// Store original HTML when content changes
useEffect(() => {
if (!contentRef.current) return
// Only store if we don't have it yet or content changed
if (!originalHtmlRef.current || html) {
originalHtmlRef.current = contentRef.current.innerHTML
}
// Store the fresh HTML content
originalHtmlRef.current = contentRef.current.innerHTML
}, [html, markdown, selectedUrl])
// Apply highlights after DOM is rendered