From 5f33c5e68a7762414cb6cfd960a853bc23bc2eb6 Mon Sep 17 00:00:00 2001 From: en Date: Fri, 21 Feb 2025 14:49:24 +0100 Subject: [PATCH] fix(notes): render image preview --- src/components/Notes/NoteRender.tsx | 10 ++++++++++ src/styles/comments.css | 3 --- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/Notes/NoteRender.tsx b/src/components/Notes/NoteRender.tsx index fbe492a..da3d4d6 100644 --- a/src/components/Notes/NoteRender.tsx +++ b/src/components/Notes/NoteRender.tsx @@ -7,6 +7,7 @@ import { BlogPreview } from './internal/BlogPreview' import { ModPreview } from './internal/ModPreview' import { NoteWrapper } from './internal/NoteWrapper' import { NIP05_REGEX } from 'nostr-tools/nip05' +import { isValidImageUrl, isValidUrl } from 'utils' interface NoteRenderProps { content: string @@ -33,6 +34,15 @@ export const NoteRender = ({ content }: NoteRenderProps) => { const _parts = parts.map((part, index) => { if (link.test(part)) { const [href] = part.match(link) || [] + + if (href && isValidUrl(href)) { + // Image + if (isValidImageUrl(href)) { + return + } + } + + // Link return ( {href} diff --git a/src/styles/comments.css b/src/styles/comments.css index 235fc8f..3fa7e13 100644 --- a/src/styles/comments.css +++ b/src/styles/comments.css @@ -65,9 +65,6 @@ .IBMSMSMBSSCL_CBText { white-space: pre-line; - display: flex; - flex-direction: column; - grid-gap: 5px; } .IBMSMSMBSSCL_CBTextStatus {