Skip to content

Bug: p tags in anchor tags are not handled correct #7977

@SuPuL

Description

@SuPuL

If you paste something like

<a class="mdn" href="https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer"><p>event.dataTransfer</p></a>

within a richtext. The editor gets confused, and the cursor will be stuck in the LinkNode. I'm not sure what the best solution is for such a case.

Lexical version: latest

Steps To Reproduce

  1. Goto any website. Create the example text. Copy the element.
  2. Goto https://playground.lexical.dev/
  3. Paste the html content.
  4. Start typing. You'll see that you are in a invalid state.

The current behavior

The editor renders the Link, but is stuck afterwards.

The expected behavior

The editor works as expected, like if I paste an anchor with plain text.

Impact of fix

Copy html from any website might lead to an invalid state. User will likely loose data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    copy+pasteRelates to Lexical Copy/Pastehtml

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions