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) => {
|
const handleMenuGoToQuote = (e: React.MouseEvent) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
setShowMenu(false)
|
setShowMenu(false)
|
||||||
|
|
||||||
|
if (onHighlightClick) {
|
||||||
|
onHighlightClick(highlight.id)
|
||||||
|
} else {
|
||||||
navigateToArticle()
|
navigateToArticle()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -557,7 +562,12 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
|
|||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
|
if (onHighlightClick) {
|
||||||
|
onHighlightClick(highlight.id)
|
||||||
|
} else {
|
||||||
navigateToArticle()
|
navigateToArticle()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -568,7 +578,12 @@ export const HighlightItem: React.FC<HighlightItemProps> = ({
|
|||||||
className="highlight-text"
|
className="highlight-text"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|
||||||
|
if (onHighlightClick) {
|
||||||
|
onHighlightClick(highlight.id)
|
||||||
|
} else {
|
||||||
navigateToArticle()
|
navigateToArticle()
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
style={{ cursor: 'pointer' }}
|
style={{ cursor: 'pointer' }}
|
||||||
title="Go to quote in article"
|
title="Go to quote in article"
|
||||||
|
|||||||
Reference in New Issue
Block a user