diff --git a/src/components/Note/LongFormArticle/NostrNode.tsx b/src/components/Note/LongFormArticle/NostrNode.tsx index 1a960056..b0d37ce8 100644 --- a/src/components/Note/LongFormArticle/NostrNode.tsx +++ b/src/components/Note/LongFormArticle/NostrNode.tsx @@ -6,7 +6,6 @@ import { Components } from './types' export default function NostrNode({ rawText, bech32Id }: ComponentProps) { const { type, id } = useMemo(() => { if (!bech32Id) return { type: 'invalid', id: '' } - console.log('NostrLink bech32Id:', bech32Id) try { const { type } = nip19.decode(bech32Id) if (type === 'npub') { diff --git a/src/components/Note/LongFormArticle/index.tsx b/src/components/Note/LongFormArticle/index.tsx index adb0dc24..e0e65d1d 100644 --- a/src/components/Note/LongFormArticle/index.tsx +++ b/src/components/Note/LongFormArticle/index.tsx @@ -21,6 +21,53 @@ export default function LongFormArticle({ const { push } = useSecondaryPage() const metadata = useMemo(() => getLongFormArticleMetadataFromEvent(event), [event]) + const components = useMemo( + () => + ({ + nostr: ({ rawText, bech32Id }) => , + a: ({ href, children, ...props }) => { + if (!href) { + return + } + if (href.startsWith('note1') || href.startsWith('nevent1') || href.startsWith('naddr1')) { + return ( + + {children} + + ) + } + if (href.startsWith('npub1') || href.startsWith('nprofile1')) { + return ( + + {children} + + ) + } + return ( + + {children} + + ) + }, + p: (props) =>

, + div: (props) =>

, + code: (props) => + }) as Components, + [] + ) + return (
, - a: ({ href, children, ...props }) => { - if (!href) { - return - } - if ( - href.startsWith('note1') || - href.startsWith('nevent1') || - href.startsWith('naddr1') - ) { - return ( - - {children} - - ) - } - if (href.startsWith('npub1') || href.startsWith('nprofile1')) { - return ( - - {children} - - ) - } - return ( - - {children} - - ) - }, - p: (props) =>

, - div: (props) =>

, - code: (props) => - } as Components - } + components={components} > {event.content}