Can't backspace a list if it's the only element in the editor
See original GitHub issueDo you want to request a feature or report a bug?
Bug
What’s the current behavior?
List elements cannot be removed with backspacing when they’re the only element in the editor. This list elements can only be removed when by clicking the numbered list icon
The error is currently active in the rich text
demo: https://www.slatejs.org/#/rich-text
macOS Mojave 10.14.6 - Google Chrome Google Chrome | 77.0.3865.90 (Official Build) (64-bit)
What’s the expected behavior?
Expected behavior is for backspacing to also remove the list
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:5
Top Results From Across the Web
Backspace not working in list - Microsoft Community
When I'm in Word (Desktop) and having a list (bullet or numbered) the backspace is not working for me anymore. For instance if...
Read more >vim not allowing backspace - Stack Overflow
This is a list of items, separated by commas. Each item allows a way to backspace over something: value effect indent allow backspacing...
Read more >notepad++ - The backspace key doesn't work while editing ...
But when i am editing a c++ source files, i can't use the backspace key to delete the current line when the cursor...
Read more >type - Cypress Documentation
Cypress will fire textInput only if typing that key would have inserted an actual character. Cypress will fire input only if typing that...
Read more >Backspace Doesn't Delete Highlighted Text FIX - YouTube
Your browser can't play this video. ... The most likely cause of the problem is that you've somehow changed how Word handles what...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I also wrote a plugin to do the same thing.
note
toggleBlock
is taken from https://github.com/ianstormtaylor/slate/blob/main/site/examples/richtext.tsx#L63usage
Hey @11, this rich text editor example is not meant to be fully featured and usable as a RTE out of the box. It is meant to provide enough of the basics for how to interact with slate for you to be successful in implementing your own editor with your own custom behaviors.
One could also make the argument that this example should do things like handle pasting, or like-list merging, or anything of that nature that are also idiomatic with modern RTEs. The problem then is that the examples become harder to maintain, more subject to bugs, and also conversations like this where people disagree with the behaviors of the example.
On those grounds, I don’t think we need a PR that adds this clean up functionality.
To your specific question on how you would detect this condition yourself, my recommendation would be to boil this down to the interactions you’re having with the editor and what you expect it to do.
The preconditions are:
And your output is:
You want the list item to become a paragraph block
This sounds like an onKeyDown event to me that runs
toggleBlock
when the above conditions are true.You might also look for a plugin that provides list editing behaviors.