Description
When importing a DOM into a lexical state, spaces are only taken into account near native HTML inline elements, or near those elements that have the CSS property display: inline https://github.com/facebook/lexical/blob/main/packages/lexical/src/nodes/LexicalTextNode.ts#L1333-L1337
If, when creating a DOM, non-standard elements are assumed, but which are intended to be inline, then there is a way to workaround the limitation described in discord https://discord.com/channels/953974421008293909/1075554413587996782/threads/1257957695537807422
The point of the workaround is that you need to manually add the display: inline property when calling the importDOM node, and you will also need to override importDOM for TextNode which increases coupling and makes supporting custom inline elements inconvenient.
Impact
An API that allows you to pass a function (or their names) to validate custom inline nodes would greatly simplify the task. This is important for editors that save and create custom markup in the backend
Description
When importing a DOM into a lexical state, spaces are only taken into account near native HTML inline elements, or near those elements that have the CSS property
display: inlinehttps://github.com/facebook/lexical/blob/main/packages/lexical/src/nodes/LexicalTextNode.ts#L1333-L1337If, when creating a DOM, non-standard elements are assumed, but which are intended to be inline, then there is a way to workaround the limitation described in discord https://discord.com/channels/953974421008293909/1075554413587996782/threads/1257957695537807422
The point of the workaround is that you need to manually add the
display: inlineproperty when calling theimportDOMnode, and you will also need to overrideimportDOMfor TextNode which increases coupling and makes supporting custom inline elements inconvenient.Impact
An API that allows you to pass a function (or their names) to validate custom inline nodes would greatly simplify the task. This is important for editors that save and create custom markup in the backend