22 lines
441 B
TypeScript
22 lines
441 B
TypeScript
import React from "react";
|
|
import type { JSONContent } from "@tiptap/react";
|
|
import { richTextToSafeHtml } from "@/lib/richtext";
|
|
|
|
export default function RichText({
|
|
doc,
|
|
className,
|
|
}: {
|
|
doc: JSONContent;
|
|
className?: string;
|
|
}) {
|
|
const html = richTextToSafeHtml(doc);
|
|
return (
|
|
<div
|
|
className={className}
|
|
// HTML is sanitized in `richTextToSafeHtml`
|
|
dangerouslySetInnerHTML={{ __html: html }}
|
|
/>
|
|
);
|
|
}
|
|
|