mirror of
https://github.com/dergigi/boris.git
synced 2025-12-17 06:34:24 +01:00
fix(highlights): make go-to-quote use highlight selection
- Prefer onHighlightClick for quote button, quote text, and menu item - Fall back to navigation when no highlight-click handler is provided - Ensures reliable scroll-to-quote behavior in the reader
This commit is contained in:
@@ -501,8 +501,13 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
|
||||
const handleMenuGoToQuote = (e: React.MouseEvent) => {
|
||||
e.stopPropagation()
|
||||
setShowMenu(false)
|
||||
|
||||
if (onHighlightClick) {
|
||||
onHighlightClick(highlight.id)
|
||||
} else {
|
||||
navigateToArticle()
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -557,7 +562,12 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
|
||||
if (onHighlightClick) {
|
||||
onHighlightClick(highlight.id)
|
||||
} else {
|
||||
navigateToArticle()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -568,7 +578,12 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
|
||||
className="highlight-text"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
|
||||
if (onHighlightClick) {
|
||||
onHighlightClick(highlight.id)
|
||||
} else {
|
||||
navigateToArticle()
|
||||
}
|
||||
}}
|
||||
style={{ cursor: 'pointer' }}
|
||||
title="Go to quote in article"
|
||||
|
||||
Reference in New Issue
Block a user