This commit is contained in:
MartinBraquet
2025-09-12 02:15:06 +02:00
parent a7858d44bd
commit 14981ef077
2 changed files with 6 additions and 2 deletions

View File

@@ -65,6 +65,10 @@ export function getField(extension: AnyExtension, field: string) {
* We can't use prosemirror node views (this is what tiptap `generateHTML` does) because it uses document which is on the client.
*/
export const generateReact = (doc: JSONContent, extensions: Extensions) => {
if (!doc) {
return null
}
const extensionsIncludingStarterKit = extensions.flatMap(
(e) => getField(e, 'addExtensions')?.() ?? e
)

View File

@@ -215,8 +215,6 @@ function RichContent(props: {
}) {
const { className, content, size = 'md' } = props
if (!content) return null
const jsxContent = useMemo(() => {
try {
return generateReact(content, [
@@ -236,6 +234,8 @@ function RichContent(props: {
}
}, [content, size])
if (!content) return null
return (
<div
className={clsx(