Skip to content

Bug: Exception is swallowed when pasting into editor #7940

Closed

Description

@mareolan

Lexical version: 0.37.0

Steps To Reproduce

  1. Use Editor's initialConfig: { html: { import: { span: (el) => { throw new Error("Unintentional error."); } } } }, i.e. have custom import handling for an HTML element and do an unintentional error there.
  2. Copy any HTML containing element.
  3. When pasting, the exception is swallowed - it's not shown anywhere, so developer has no clue why the import is behaving weirdly (it looks like it falls back to something like non-HTML plain-text paste).

Link to code example:

https://stackblitz.com/edit/facebook-lexical-7nhfkbzs?file=src%2FApp.tsx

The current behavior

Exception is swallowed. Likely due to:
https://github.com/facebook/lexical/blob/main/packages/lexical-clipboard/src/clipboard.ts#L148
https://github.com/facebook/lexical/blob/main/packages/lexical-clipboard/src/clipboard.ts#L168

The expected behavior

Exception is logged into console.

Impact of fix

Developers will thank you for not making it harder for them ;-).

Activity

  1. added
    copy+paste
    good first issue
    on Oct 22, 2025
  2. added a commit that references this issue on Oct 23, 2025
    9978ef8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    copy+pastegood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions