fix(notes): render image preview
This commit is contained in:
parent
01ca102dcc
commit
5f33c5e68a
@ -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 <img className='imgFeedRender' src={href} alt='' />
|
||||
}
|
||||
}
|
||||
|
||||
// Link
|
||||
return (
|
||||
<a key={index} target='_blank' href={href}>
|
||||
{href}
|
||||
|
@ -65,9 +65,6 @@
|
||||
|
||||
.IBMSMSMBSSCL_CBText {
|
||||
white-space: pre-line;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
grid-gap: 5px;
|
||||
}
|
||||
|
||||
.IBMSMSMBSSCL_CBTextStatus {
|
||||
|
Loading…
x
Reference in New Issue
Block a user