Alessio Gravili
bffd98f019
feat(richtext-lexical): lexical => JSX converter (#8795)
Example:
```tsx
import React from 'react'
import {
type JSXConvertersFunction,
RichText,
} from '@payloadcms/richtext-lexical/react'
const jsxConverters: JSXConvertersFunction = ({ defaultConverters }) => ({
...defaultConverters,
blocks: {
// myTextBlock is the slug of the block
myTextBlock: ({ node }) => <div style={{ backgroundColor: 'red' }}>{node.fields.text}</div>,
},
})
export const MyComponent = ({ lexicalContent }) => {
return (
<RichText
converters={jsxConverters}
data={data.lexicalWithBlocks as SerializedEditorState}
/>
)
}
```
2024-11-26 22:40:24 +00:00
..
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-26 13:25:37 -05:00
2024-11-23 16:35:27 -07:00
2024-11-26 16:18:10 -05:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-26 17:06:30 -05:00
2024-11-26 14:31:14 -07:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-25 22:40:34 -06:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-26 10:50:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-26 22:40:24 +00:00
2024-11-26 14:31:14 -07:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-25 16:42:21 -05:00
2024-11-26 17:06:30 -05:00
2024-11-26 17:06:30 -05:00