mdx-editor / mdx-editor/editor

Error when deleting a thematic break

Open
#252 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug released
Dominant language
TypeScript
Stars
3.7k
Forks
307
Avg merge
14h 22m
Merged PRs (30d)
5

Description

Hi,

I'm having an issue with deleting thematic breaks. Once inserted, it can only be deleted by pressing backspace twice. However, doing the following throws an error:

  1. Insert a thematic break
  2. Press on backspace once (this causes the caret to disappear)
  3. Now press on the thematic break line or slightly above or below it to place the caret under the line
  4. Press on backspace again

This the error I'm seeing:

Uncaught Error: updateEditor: selection has been lost because the previously selected nodes have been removed and selection wasn't moved to another node. Ensure selection changes after removing/replacing a selected node. at beginUpdate (Lexical.dev.js:8229:1) at updateEditor (Lexical.dev.js:8282:1) at LexicalEditor.update (Lexical.dev.js:9798:1) at triggerCommandListeners (Lexical.dev.js:8079:1) at dispatchCommand (Lexical.dev.js:1237:1) at HTMLDivElement.eventHandler (Lexical.dev.js:3064:1)

The issue can be re-produced on the live demo as well, it shows the following error on the console logs:
Uncaught Error: Minified Lexical error #19; visit https://lexical.dev/docs/error?code=19 for the full message or use the non-minified dev environment for full errors and additional helpful warnings. at Z (593-b5b58497930ed062.js:5:31202) at n7 (593-b5b58497930ed062.js:5:103168) at n8 (593-b5b58497930ed062.js:5:103784) at rh.update (593-b5b58497930ed062.js:5:117199) at n6 (593-b5b58497930ed062.js:5:100395) at tA (593-b5b58497930ed062.js:5:45526) at e._lexicalHandled.e._lexicalHandled (593-b5b58497930ed062.js:5:115732)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the sequence in the live demo and use the reported Lexical.dev.js stack trace to investigate the lost selection after deleting the thematic break. Done means pressing backspace in this state no longer throws an error and the caret remains usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.