-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Bug: Exception is swallowed when pasting into editor #7940
Copy link
Copy link
Closed
Labels
copy+pasteRelates to Lexical Copy/PasteRelates to Lexical Copy/Pastegood first issueGood for newcomersGood for newcomers
Description
Lexical version: 0.37.0
Steps To Reproduce
- 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.
- Copy any HTML containing element.
- 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 ;-).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
copy+pasteRelates to Lexical Copy/PasteRelates to Lexical Copy/Pastegood first issueGood for newcomersGood for newcomers