Lexical doesn't respect default values #4147
-
Link to reproductionNo response Describe the Bugi'm creating a custom feature where i need to render lexical inside a modal, it works fine but when i try to set defaultValue it doesn't respect it To Reproduce
Payload Version2.1.1 Adapters and PluginsNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The The defaultValue of the richtext field is populated solely through the In order to give it a default value, you will have to set the |
Beta Was this translation helpful? Give feedback.
The
defaultValue
prop in the RichText component actually doesn't do anything. Since that's intended, I'm closing this issue & converted it into a discussion. I've also removed this prop in 4bc5fa7 since it wasn't used.The defaultValue of the richtext field is populated solely through the
Form
. The RichText component itself receives it as value from theuseField
hook - which is provided by that Form.In order to give it a default value, you will have to set the
initialState
property of the Form component. Check out theBlocks
Feature if you need an example of how initialState can be created & passed to the Form - I did something similar there