Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core bug] Incorrect update of 'selection' when deleting consecutive non inline 'void' nodes #5582

Open
jiao1187875445 opened this issue Dec 15, 2023 · 0 comments
Labels

Comments

@jiao1187875445
Copy link

jiao1187875445 commented Dec 15, 2023

Description
When there are multiple consecutive non inline void nodes in the article, such as indexes 5, 6, 7, and 8. When the cursor selects 6, the path is [6,0], and then the 'editor. deleteBackward()' method is triggered to delete it. At this time, the selection path is still [6,0], which will cause continuous deletion, and each deletion will be backward deletion. The correct way would be to delete the void node of path [6,0] and change the selection path to [5,0].

Use your "image"[ https://www.slatejs.org/examples/images ]The example can reproduce this bug by first creating multiple consecutive void image nodes of the same level, and then selecting one for continuous deletion. It will be found that each time it is deleted backwards.

Recording

2023-12-15.3.43.15.mov

Sandbox
A link to a sandbox where the error can be reproduced. (You can start from the base sandbox here: https://codesandbox.io/s/slate-reproductions-c7gyg or refer to the Slate website too.)

Steps
To reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expectation
For continuous non inline void nodes, after deleting one of them, the selection should move forward instead of staying in its original position

Environment

  • Slate Version: [e.g. 0.101.1]
  • Operating System: [e.g. mac os]
  • Browser: [e.g. Chrome, Safari, firfox]

Context
Add any other context about the problem here. (The fastest way to have an issue fixed is to create a pull request with working, tested code and we'll help merge it. Slate is solving a pretty complex problem, and we can't do it without active contributors, so thank you so much for your help!)

@jiao1187875445 jiao1187875445 changed the title The cursor position is incorrect when deleting non inline void nodes [core bug] Incorrect update of 'selection' when deleting consecutive non inline 'void' nodes Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant