import { jsx as _jsx } from "react/jsx-runtime"; import { RichText as PayloadRichText } from '@payloadcms/richtext-lexical/react'; /** * Renders a Payload Lexical richText field to React — a thin wrapper over * Payload's OFFICIAL converter (@payloadcms/richtext-lexical/react). * * Why not hand-roll it: parsing Lexical by hand (node.type switch, node.format * bit flags) duplicates what Payload already does, misses node types, drifts * on Lexical updates, and tempts shortcuts like dangerouslySetInnerHTML (XSS) * or a hardcoded `.pl` locale. The official converter handles every node, * stays in sync, and is safe. This is the RenderBlocks of rich text: the * plugin owns the engine, the project owns the look via `converters`. * * // project — a Server Component * import { RenderRichText } from '@intecion/ipal-kit/rsc' * * * // with project styling per node: * const converters: JSXConvertersFunction = ({ defaultConverters }) => ({ * ...defaultConverters, * heading: ({ node, nodesToJSX }) => { * const children = nodesToJSX({ nodes: node.children }) * const cls = { h2: 'text-2xl font-semibold mt-10', h3: 'text-xl mt-7' }[node.tag] ?? '' * const Tag = node.tag as 'h1'|'h2'|'h3'|'h4' * return {children} * }, * }) * */ export function RenderRichText({ className, converters, data }) { if (!data) { return null; } return /*#__PURE__*/ _jsx(PayloadRichText, { className: className, converters: converters, data: data }); } //# sourceMappingURL=RenderRichText.js.map