update markdown

This commit is contained in:
Ren Amamiya
2023-07-15 21:01:27 +07:00
parent f154d8f5f4
commit e0a14ce6cf
10 changed files with 85 additions and 153 deletions

View File

@@ -1,16 +1,9 @@
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import {
ImagePreview,
LinkPreview,
MentionNote,
MentionUser,
NoteActions,
NoteContent,
NoteMetadata,
NoteSkeleton,
RepostUser,
VideoPreview,
} from '@shared/notes';
import { User } from '@shared/user';
@@ -49,29 +42,7 @@ export function Repost({ event }: { event: LumeEvent }) {
<div className="relative z-20 flex items-start gap-3">
<div className="w-11 shrink-0" />
<div className="flex-1">
<ReactMarkdown
className="markdown"
remarkPlugins={[remarkGfm]}
components={{
del: ({ children }) => {
const pubkey = children[0] as string;
return <MentionUser pubkey={pubkey.slice(3)} />;
},
}}
>
{data.content.parsed}
</ReactMarkdown>
{data.content.images.length > 0 && (
<ImagePreview urls={data.content.images} />
)}
{data.content.videos.length > 0 && (
<VideoPreview urls={data.content.videos} />
)}
{data.content.links.length > 0 && <LinkPreview urls={data.content.links} />}
{data.content.notes.length > 0 &&
data.content.notes.map((note: string) => (
<MentionNote key={note} id={note} />
))}
<NoteContent content={data.content} />
<NoteActions
id={event.event_id}
rootID={event.parent_id}