How to set default value for rich text in lexical? Setting just text makes it error because it is not object
Hey
@220641138267258892, you need to pass editor state object, you can copy the return value of richText and just pass it in defaultValue. For example:
defaultValue: {
root: {
children: [
{
children: [
{
detail: 0,
format: 0,
mode: 'normal',
style: '',
text: 'Hey this is some richText default value',
type: 'text',
version: 1,
},
],
direction: 'ltr',
format: '',
indent: 0,
type: 'paragraph',
version: 1,
textFormat: 0,
textStyle: '',
},
],
direction: 'ltr',
format: '',
indent: 0,
type: 'root',
version: 1,
},
},Star
Discord
online
Get dedicated engineering support directly from the Payload team.