Replies: 2 comments 1 reply
-
You aren't providing any specific expected input and output but it sounds like you are expecting the original HTML formatting to be preserved. It won't be. Lexical does not represent documents as HTML internally so any encoding details of the input (e.g. insignificant whitespace, comments, even the presence and order of certain tags like |
Beta Was this translation helpful? Give feedback.
-
I'm not going to comb through all that but it looks like you are expecting all of the styles to be copied over exactly which is not how Lexical's importDOM works by default. You will have to customize that, either with node overrides or the html configuration property. https://lexical.dev/docs/concepts/serialization You also need to pay attention to the styles configured in your editor's theme which may affect rendering, obviously whatever you're importing is not being rendered with those classes when it's outside your editor. |
Beta Was this translation helpful? Give feedback.
-
When I load up my editor with valid HTML, the output is normalized meaning all line spacings and white spaces are removed and it is just a condensed version without any of the original formatting you would expect like pretty HTML. I added the serialization with the ExtendedTextNode but it did not fix anything. This is how I am inserting the HTML:
Beta Was this translation helpful? Give feedback.
All reactions