You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I have implemented lexical editor in my app together with possibility of creating collapsible container (the same way as it shown in the lexical playground).
In order to save it on backend, I need to serialize (using $generateHtmlFromNodes) collapsible container (transform into plain html) and when I want to retrieve it and edit I need to deserialize it (using $generateNodesFromDOM) from plain html into lexical nodes.
However, deserializing doesn't inject into editor a correct html markup. It doesn't preserve structure for collapsible container with details and summary tags but transforms it into p tags with text only:
<p class="editor-paragraph ltr" dir="ltr">
<span data-lexical-text="true">Test title</span>
</p>
<p class="editor-paragraph ltr" dir="ltr">
<span data-lexical-text="true">This is test description</span>
</p>
After some research I think it should be handled in my ExtendedTextNode in importDom() function by detecting details tag and applying correct conversion function. However, I need some direction how this could look like.
Could you please provide me some help in that matter?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I have implemented lexical editor in my app together with possibility of creating collapsible container (the same way as it shown in the lexical playground).
In order to save it on backend, I need to serialize (using
$generateHtmlFromNodes
) collapsible container (transform into plain html) and when I want to retrieve it and edit I need to deserialize it (using$generateNodesFromDOM
) from plain html into lexical nodes.However, deserializing doesn't inject into editor a correct html markup. It doesn't preserve structure for collapsible container with details and summary tags but transforms it into p tags with text only:
It should be deserialized into:
but instead it is:
After some research I think it should be handled in my ExtendedTextNode in importDom() function by detecting details tag and applying correct conversion function. However, I need some direction how this could look like.
Could you please provide me some help in that matter?
Beta Was this translation helpful? Give feedback.
All reactions