mirror of
https://github.com/dergigi/boris.git
synced 2025-12-17 14:44:26 +01:00
feat: add onSelectUrl to BookmarkItem and intercept URL clicks
- Adds optional onSelectUrl callback - Prevents default navigation to open in main content panel - Keeps middle-click/target blank behavior if no handler
This commit is contained in:
@@ -8,9 +8,10 @@ import { extractUrlsFromContent } from '../services/bookmarkHelpers'
|
||||
interface BookmarkItemProps {
|
||||
bookmark: IndividualBookmark
|
||||
index: number
|
||||
onSelectUrl?: (url: string) => void
|
||||
}
|
||||
|
||||
export const BookmarkItem: React.FC<BookmarkItemProps> = ({ bookmark, index }) => {
|
||||
export const BookmarkItem: React.FC<BookmarkItemProps> = ({ bookmark, index, onSelectUrl }) => {
|
||||
const copy = async (text: string) => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text)
|
||||
@@ -50,7 +51,14 @@ export const BookmarkItem: React.FC<BookmarkItemProps> = ({ bookmark, index }) =
|
||||
<div className="bookmark-urls">
|
||||
<h4>URLs:</h4>
|
||||
{extractedUrls.map((url, urlIndex) => (
|
||||
<a key={urlIndex} href={url} target="_blank" rel="noopener noreferrer" className="bookmark-url">
|
||||
<a
|
||||
key={urlIndex}
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="bookmark-url"
|
||||
onClick={(e) => { if (onSelectUrl) { e.preventDefault(); onSelectUrl(url) } }}
|
||||
>
|
||||
{url}
|
||||
</a>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user