Feed feedback and fixes #231
@ -7,6 +7,7 @@ import { BlogPreview } from './internal/BlogPreview'
|
|||||||
import { ModPreview } from './internal/ModPreview'
|
import { ModPreview } from './internal/ModPreview'
|
||||||
import { NoteWrapper } from './internal/NoteWrapper'
|
import { NoteWrapper } from './internal/NoteWrapper'
|
||||||
import { NIP05_REGEX } from 'nostr-tools/nip05'
|
import { NIP05_REGEX } from 'nostr-tools/nip05'
|
||||||
|
import { isValidImageUrl, isValidUrl } from 'utils'
|
||||||
|
|
||||||
interface NoteRenderProps {
|
interface NoteRenderProps {
|
||||||
content: string
|
content: string
|
||||||
@ -33,6 +34,15 @@ export const NoteRender = ({ content }: NoteRenderProps) => {
|
|||||||
const _parts = parts.map((part, index) => {
|
const _parts = parts.map((part, index) => {
|
||||||
if (link.test(part)) {
|
if (link.test(part)) {
|
||||||
const [href] = part.match(link) || []
|
const [href] = part.match(link) || []
|
||||||
|
|
||||||
|
if (href && isValidUrl(href)) {
|
||||||
|
// Image
|
||||||
|
if (isValidImageUrl(href)) {
|
||||||
|
return <img className='imgFeedRender' src={href} alt='' />
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Link
|
||||||
return (
|
return (
|
||||||
<a key={index} target='_blank' href={href}>
|
<a key={index} target='_blank' href={href}>
|
||||||
{href}
|
{href}
|
||||||
|
@ -65,9 +65,6 @@
|
|||||||
|
|
||||||
.IBMSMSMBSSCL_CBText {
|
.IBMSMSMBSSCL_CBText {
|
||||||
white-space: pre-line;
|
white-space: pre-line;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
grid-gap: 5px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.IBMSMSMBSSCL_CBTextStatus {
|
.IBMSMSMBSSCL_CBTextStatus {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user