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-26 22:40:24 +00:00
2024-09-06 15:51:09 -06:00
2024-06-17 14:25:36 -04:00
2023-09-01 14:45:41 -04:00
2024-11-21 20:14:57 +00:00
2024-11-21 14:16:01 -05:00
2024-09-20 22:46:40 -04:00
2024-11-25 11:15:19 -05:00
2024-11-18 16:27:36 -05:00
2024-11-25 17:48:16 -05:00
2024-11-21 20:14:57 +00:00
2024-11-21 14:16:01 -05:00
2024-03-14 23:53:47 -04:00
2024-06-17 14:25:36 -04:00