Replies: 1 comment
-
Your english is great! I think you already got the answer, based on the other topics you opened. Let me know if not. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello every one, I just discovered Lexical and that's awesome !
I tried it and reproduced the playground and it's just amazing.
I read the documentation and I think I should use $generateHtmlFromNodes to get the HTML from the editor state, like this :
So if I type Hello in the editor, I get this in the console :
HTML : <p class="PlaygroundEditorTheme__paragraph" dir="ltr"><span>Hello</span></p>
But then if I add some more "complicated" stuff like a youtube video or an equation, I can see them in the editor like this :

But The HTML doesn't match it :
HTML : <p class="PlaygroundEditorTheme__paragraph" dir="ltr"><span>Hello</span></p><p class="PlaygroundEditorTheme__paragraph"><br></p><div></div><p class="PlaygroundEditorTheme__paragraph"><span></span></p>
I get 2 empty paragraphs instead of the youtube video and the equation.
So I don't know if I missed something or if I have to implement something by myself to make it work ?
I need it for a CMS : in the "admin" area, the admin user is typing an article.
In the database I save the JSON of the editor state to reload it when the admin user wants to update the article.
And I also same the HTML version I got from the $generateHtmlFromNodes function to show it on the client side without the editor. I do that to avoid to load the component in the client and render the html version faster.
Is it the correct way to do ? or should I do that in another way to render in the client side ?
The client side has its own themes and then the HTML will be styled by the CSS of the client.
Can you help me about it ?
THank you (and sorry for my english 🙂 )
Beta Was this translation helpful? Give feedback.
All reactions