Error when trying to delete selection of list item to paragraph
See original GitHub issueDo you want to request a feature or report a bug?
Report a bug.
What’s the current behavior?
- Make a selection from or to the end of a list item (except the last list item) to a paragraph
- Hit delete/backspace
- An error is thrown (
Could not find a node with key X.
) and the selection is not removed
Observed on the Rich Text Slate Example:
Tested with Slate 0.20.3 in latest Chrome (59.0.3071.115) on Windows 7 and 10 (64-bit).
What’s the expected behavior?
The selected text should be deleted.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Can't backspace a list if it's the only element in the editor #3048
Your selection is collapsed at the start of; A list item. And your output is: You want the list item to become a...
Read more >Remove Paragraph Error - google apps script - Stack Overflow
Currently, I am getting this error: Can't remove the last paragraph in a document section. Does anyone know why this is happening? Is...
Read more >If you can't remove something from a document in Pages on Mac
Click the object, then press Delete on your keyboard. If the object is still on the page, try the following: If a small...
Read more >Add or remove AutoCorrect entries in Word - Microsoft Support
Go to the AutoCorrect tab. In the Replace box, type the word to remove from the list. Select the entry from the list....
Read more >How to Remove Hard Returns in a Word Document
Learn simple steps to remove hard returns or paragraph marks in Microsoft ... when the document has extra hard returns you want to...
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
We should already be only allowing selections to reference text nodes, but there may be gaps I don’t know about for sure. Your plan sounds good!
This is a bit larger problem than just the issue described above. It boils down to how offsets are used to resolve node operations:
What if I invoke
node.getTextAtOffset
on theul
-node and specify an offset of 5? I will get the text node inside the second list-item. If I wanted the first list-item I’m out of luck since we cannot express the end of a node using an offset from a parent node (that has more nodes inside it).I have solved this problem by adding a parameter denoting how node resolution should work when offsets are ‘between’ nodes but I don’t feel like it is a good approach since it is such a big step away from how it currently works with paths and offsets.
If anyone have any input or experience with this issue I’ll be happy to discuss it.