Skip to content

Feature: Add API for checking custom inline DOM element #8391

@levensta

Description

@levensta

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement over existing feature

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions