diff --git a/src/components/ContentPreview/Content.tsx b/src/components/ContentPreview/Content.tsx index f5517bd..f4df41d 100644 --- a/src/components/ContentPreview/Content.tsx +++ b/src/components/ContentPreview/Content.tsx @@ -32,7 +32,7 @@ export default function Content({ }, [content]) return ( - + {nodes.map((node, index) => { if (node.type === 'image' || node.type === 'images') { return index > 0 ? ` [${t('Image')}]` : `[${t('Image')}]` diff --git a/src/components/Embedded/EmbeddedMention.tsx b/src/components/Embedded/EmbeddedMention.tsx index 1b270c2..0bead98 100644 --- a/src/components/Embedded/EmbeddedMention.tsx +++ b/src/components/Embedded/EmbeddedMention.tsx @@ -7,6 +7,7 @@ export function EmbeddedMention({ userId, className }: { userId: string; classNa userId={userId} showAt className={cn('text-primary font-normal inline', className)} + style={{ verticalAlign: 'baseline' }} withoutSkeleton /> ) diff --git a/src/components/Note/index.tsx b/src/components/Note/index.tsx index a183296..67bcd08 100644 --- a/src/components/Note/index.tsx +++ b/src/components/Note/index.tsx @@ -156,7 +156,17 @@ export default function Note({ } return ( -
+
{ + // Don't navigate if clicking on interactive elements + const target = e.target as HTMLElement + if (target.closest('button') || target.closest('[role="button"]') || target.closest('a')) { + return + } + navigateToNote(toNote(event)) + }} + >
diff --git a/src/components/Username/index.tsx b/src/components/Username/index.tsx index c693342..76abc34 100644 --- a/src/components/Username/index.tsx +++ b/src/components/Username/index.tsx @@ -9,13 +9,15 @@ export default function Username({ showAt = false, className, skeletonClassName, - withoutSkeleton = false + withoutSkeleton = false, + style }: { userId: string showAt?: boolean className?: string skeletonClassName?: string withoutSkeleton?: boolean + style?: React.CSSProperties }) { const { profile } = useFetchProfile(userId) const { navigateToProfile } = useSmartProfileNavigation() @@ -35,13 +37,14 @@ export default function Username({ const { username, pubkey } = profile return ( -
navigateToProfile(toProfile(pubkey))} > {showAt && '@'} {username} -
+ ) } @@ -50,13 +53,15 @@ export function SimpleUsername({ showAt = false, className, skeletonClassName, - withoutSkeleton = false + withoutSkeleton = false, + style }: { userId: string showAt?: boolean className?: string skeletonClassName?: string withoutSkeleton?: boolean + style?: React.CSSProperties }) { const { profile } = useFetchProfile(userId) @@ -75,9 +80,12 @@ export function SimpleUsername({ const { username } = profile return ( -
+ {showAt && '@'} {username} -
+ ) } \ No newline at end of file diff --git a/src/lib/nostr-parser.tsx b/src/lib/nostr-parser.tsx index 2136c0a..d20d5f0 100644 --- a/src/lib/nostr-parser.tsx +++ b/src/lib/nostr-parser.tsx @@ -173,12 +173,33 @@ export function parseNostrContent(content: string, event?: Event): ParsedNostrCo const bech32Id = match[1] const nostrType = getNostrType(bech32Id) + // Add spacing around handles if they're not at the beginning or end of a line + const isAtStart = start === 0 || content[start - 1] === '\n' + const isAtEnd = end === content.length || content[end] === '\n' + const needsSpaceBefore = !isAtStart && content[start - 1] !== ' ' + const needsSpaceAfter = !isAtEnd && content[end] !== ' ' + + if (needsSpaceBefore) { + elements.push({ + type: 'text', + content: ' ' + }) + } + elements.push({ type: 'nostr', content: match[0], bech32Id, nostrType: nostrType || undefined }) + + if (needsSpaceAfter) { + elements.push({ + type: 'text', + content: ' ' + }) + } + } else if (['image', 'video', 'audio'].includes(type) && url) { elements.push({ type: type as 'image' | 'video' | 'audio', @@ -485,7 +506,7 @@ export function renderNostrContent(parsedContent: ParsedNostrContent, className? ) } else if (['nevent', 'naddr', 'note'].includes(element.nostrType)) { diff --git a/src/pages/secondary/NotePage/index.tsx b/src/pages/secondary/NotePage/index.tsx index 83be249..443e0b3 100644 --- a/src/pages/secondary/NotePage/index.tsx +++ b/src/pages/secondary/NotePage/index.tsx @@ -201,12 +201,21 @@ function ParentNote({ 'flex space-x-1 px-[0.4375rem] py-1 items-center rounded-full border clickable text-sm text-muted-foreground', event && 'hover:text-foreground' )} - onClick={() => { + onClick={(e) => { + e.stopPropagation() navigateToNote(toNote(event ?? eventBech32Id)) }} > {event && } - +
{ + e.stopPropagation() + navigateToNote(toNote(event ?? eventBech32Id)) + }} + > + +
{isConsecutive ? (