question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when trying to delete selection of list item to paragraph

See original GitHub issue

Do you want to request a feature or report a bug?

Report a bug.

What’s the current behavior?

  1. Make a selection from or to the end of a list item (except the last list item) to a paragraph
  2. Hit delete/backspace
  3. 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:

bo7tysbrpi

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:closed
  • Created 6 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ianstormtaylorcommented, Jul 12, 2017

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!

1reaction
ExplicitlyImplicitcommented, Jul 10, 2017

This is a bit larger problem than just the issue described above. It boils down to how offsets are used to resolve node operations:

<ul>
  <li>item1</li>
  <li>item2</li>
</ul>

What if I invoke node.getTextAtOffset on the ul-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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found