Hello!
I’m building a page with a product description using the new Lexical Rich Text field that is in beta.
Im using the <LexicalRichText />
component and am passing the field {productDescription}
as the serializedAST prop but I am receiving this error:
TypeError: editorState.isEmpty is not a function
at LexicalEditor.setEditorState (/Users/my-user/Documents/Github/my-repo/node_modules/lexical/Lexical.dev.js:10747:21)
Any advice on how to resolve would be appreciated!
1 Like
YOU CAN REFRESH OR CLOSE & OPEN IT AGAIN.[quote=“Adrienne_Williams, post:1, topic:5642, full:true”]
Hello!
I’m building a page with a product description using the new Lexical Rich Text field that is in beta.
Im using the <LexicalRichText />
component and am passing the field {productDescription}
as the serializedAST prop but I am receiving this error:
TypeError: editorState.isEmpty is not a function
at LexicalEditor.setEditorState (/Users/my-user/Documents/Github/my-repo/node_modules/lexical/Lexical.dev.js:10747:21)
Any advice on how to resolve would be appreciated!
[/quote]
I have the same problem - do you have any solution yet? Would be much appreciated
Hi,
I received that same error when trying to simply pass the component a field name. I believe the <LexicalRichText>
component is expecting the value passed to the serializedAST
prop to be stringified JSON.
In my project, I was using the new Lexical Rich Text field type for a blog body field (c_blogBody). This new field type comes through as an object with a json
property, so I was able to get the component working properly by setting it up like this:
<LexicalRichText
serializedAST={JSON.stringify(c_blogBody.json)}
/>
Hope this helps!
DJ
1 Like