Files
logbuch/src/components/blocks/TextBlock.tsx
T
Matthias G a123e0bca2 Write text blocks with formatting
Tiptap replaces the plain textarea: bold, italic, subheading, lists and
links. Stored as Markdown so API clients keep reading and writing the
same field, rendered with react-markdown.
2026-08-01 12:46:34 +02:00

24 lines
529 B
TypeScript

import Markdown from 'react-markdown'
import remarkGfm from 'remark-gfm'
import { readString } from './data'
import type { BlockProps } from './types'
export function TextBlock({ data }: BlockProps) {
const text = readString(data, 'text', 'body', 'content')
if (text === undefined || text.trim() === '') {
return null
}
return (
<div className="prose-logbuch">
<Markdown
remarkPlugins={[remarkGfm]}
components={{ a: props => <a {...props} rel="noreferrer" /> }}
>
{text}
</Markdown>
</div>
)
}