-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
Unexpected backspace/delete key handling in nested lists #1259
Comments
Because there are nested list items outside of the deleted range, which cannot exist without parent nodes, those list items must be preserved in order to satisfy the document shape prescribed by the schema. You could try add custom deletion logic that behaves differently, and bind it to the delete and backspace keys, but as for core library logic, this is expected behavior. |
Hi @marijnh thanks for the explanation. I will add a custom delete/backspace command as you suggested, but there is still something I don't quite get: After you press backspace/delete you get: In this case, the second bullet point should be removed, right? It also conforms to the "no children without parent" rule and should satisfy the schema. But here's something interesting: if you only partially select the second item, it works nicely: After you press backspace/delete you get: Is this a bug? |
…aceStep FIX: Make replacements that span to the end of a textblock more consistent with those ending in the middle of the block. Issue ProseMirror/prosemirror#1259
That does seem surprising. Attached patch makes the two cases behave more consistently. |
Hi team ProseMirror,
We are Pitch are building our next-gen text editor using ProseMirror and it has been great. So first of all big kudos!!
However, we encountered some unexpected behaviors when pressing backspace/delete in nested lists.
Steps to repro:
Issue 1: press delete or backspace on range selection, all bullet points stay
Expected: these 2 lines get removed, together with the bullet points
Actual: all bullet points stay
Issue 2: press delete or backspace on range selection, some bullet points stay
This is (I think) basically the same thing as issue 1, but more confusing for everyday users
Expected: these 3 lines get removed, together with the bullet points
Actual: 1 bullet point stays
Issue 3: put cursor at the end of a line and press delete, if the "join next line" op will break the scheme, the delete doesn't happen, and a chunk of list is selected below
Expected: well this is a bit hard to say, an everyday user might expect the list structure to be re-adjusted to allow this deletion, and I (who has played with ProseMirror for a few weeks) might expect at least nothing happens because it can be categorized as an "illegal" operation.
Actual: no deletion happens, and 4 lines below are selected
Issue 4: put cursor at the start of a line and press backspace, if the "join to prev line" op will break the scheme, the delete doesn't happen, and a chunk of list is selected below
Expected: similar to issue 3
Actual: no deletion happens, and the line above is selected
I'm very satisfied and impressed by the richness and simplicity of ProseMirror, but list handling seems to have missed some love. Would you kindly take a look? Thank you very much.
The text was updated successfully, but these errors were encountered: