Correct way to deserialise markdown and set the content to the editor ? Using PlateController ? #3093
Unanswered
florian583
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem
I am currently using NextJS, Plate as a rich text editor, and react-hook-form in my project. I have another component that performs completion with AI and Vercel AI SDK. Once I receive the completion, I need to update the content of the Plate editor with the parsed completion as markdown.
I am retrieving the content from a Zustand state called
completion
, and I also have initial values set as an empty array or the current saved state of the form with react-hook-form.I have tried the following approaches:
<p>
line (the default of the editor, I assume) at the beginning, which I don't know how to remove.Here is the function I am currently using to parse the completion string and set the node with
insertNodes()
:My
RichTextEditor
component is as follows:Usage:
Question
How can I update the Plate editor content with the parsed completion as markdown without having an empty
<p>
line at the beginning or what is the recommanded usage ? Any help or suggestions would be greatly appreciated.Beta Was this translation helpful? Give feedback.
All reactions