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-24 19:18:33 -07:00
2024-11-26 19:07:56 +00:00
2024-11-24 19:18:33 -07:00
2024-11-24 19:18:33 -07:00
2024-11-21 14:09:08 -05:00
2024-11-11 09:31:47 -05:00
2024-07-17 12:52:41 -04:00
2024-11-26 19:07:56 +00:00
2024-11-25 16:31:08 -05:00
2024-11-19 14:53:48 -05:00
2024-11-18 17:35:36 -05:00
2024-10-30 11:54:44 -06:00
2024-07-11 09:54:21 -04:00
2024-11-18 17:35:36 -05:00
2024-11-26 22:40:24 +00:00
2024-11-16 15:30:05 -05:00
2024-11-25 16:31:08 -05:00
2024-11-25 09:17:34 -05:00
2024-11-24 19:18:33 -07:00
2024-11-18 17:35:36 -05:00
2024-11-18 17:35:36 -05:00
2024-11-24 19:18:33 -07:00
2024-11-18 17:35:36 -05:00
2024-07-11 09:54:21 -04:00
2024-07-17 12:52:41 -04:00
2024-11-26 03:46:25 +00:00
2024-07-15 15:29:11 -04:00