#Customizing Lexical Nodes with the new RichText Component

6 messages · Page 1 of 1 (latest)

oblique bane
#

When using the RichText component imported from @payloadcms/richtext-lexical/react , how do you customize the standard nodes that have children? Before, in the serialize.tsx file, you had functions that provided serializedChilden

<p className='col-start-2 mb-4' key={index}>
  {serializedChildren}
</p>

But how would you add the children in this instance?

gaunt lakeBOT
oblique bane
#

What I currently have:

const jsxConverters: JSXConvertersFunction = ({ defaultConverters }) => ({
  ...defaultConverters,
  paragraph: ({ node }) => {
    return <p>{whatGoesHere?}</p>;
  },
  blocks: {
    accordion: ({ node }) => (
      <Accordion {...(node.fields as AccordionProps)} />
    )
  }
});
amber estuary
#

const text = nodesToJSX({ nodes: node.children }).join("");

oblique bane
oblique bane
#

@amber estuary nvm, I found it. Thank you very much.