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.

Select all + paste results in an error when there is a trailing empty block

See original GitHub issue

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

Bug

What’s the current behavior?

If there is a trailing empty block, and we select all with cmd+a and then paste anything, an error occurs:

Uncaught TypeError: Cannot read property 'key' of undefined
    at Changes.insertFragmentAtRange (https://npmcdn.com/slate@0.31.5/dist/slate.js:7158:55)
    at Change.call (https://npmcdn.com/slate@0.31.5/dist/slate.js:10521:10)
    at Change.(anonymous function) [as insertFragmentAtRange] (https://npmcdn.com/slate@0.31.5/dist/slate.js:10580:15)
    at Changes.insertFragment (https://npmcdn.com/slate@0.31.5/dist/slate.js:6193:10)
    at Change.call (https://npmcdn.com/slate@0.31.5/dist/slate.js:10521:10)
    at Change.(anonymous function) [as insertFragment] (https://npmcdn.com/slate@0.31.5/dist/slate.js:10580:15)
    at Object.onPaste (https://npmcdn.com/slate-react@0.10.20/dist/slate-react.js:11554:14)
    at Stack.run (https://npmcdn.com/slate@0.31.5/dist/slate.js:16879:38)
    at https://npmcdn.com/slate-react@0.10.20/dist/slate-react.js:9290:20
    at Change.call (https://npmcdn.com/slate@0.31.5/dist/slate.js:10521:10)

Issue can be reproduced on the default fiddle: https://jsfiddle.net/fj9dvhom/1/ Here is a gif: https://imgur.com/a/1KENt

Chrome version 62, Ubuntu 17, Slate version 0.31.5

What’s the expected behavior?

After selecting all with cmd+a, paste should work correctly no matter if there is a trailing empty block or not.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
tobiasandersencommented, Dec 11, 2017

No, sorry if I confused things here. This was recently fixed for when inserting text (i.e. for insertTextAtRange), but it’s still an issue for insertFragmentAtRange.

1reaction
zGravcommented, Dec 6, 2017

I did found out another one though, PR’ing 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug: when pasting into an empty block, the entire fragment is ...
As a user, I want to copy a heading and paste it in this scenario, not the heading and some text above it,...
Read more >
3 ways to remove blank rows in Excel - quick tip - Ablebits
Click OK. Select all the filtered rows: Press Ctrl + Home, then press the down-arrow key to go to the first data row,...
Read more >
Remove trailing spaces automatically or with a shortcut
In Codium, it starts with a click on "File" in the menu. Can I exclude some types of files from getting their trailing...
Read more >
The Surprising Behavior of Trailing Spaces
Here's last week's surprise. Create a temp table, and put in a value with trailing spaces. Then query for it using the =...
Read more >
Solutions to Three Common Problems when Using VLOOKUP()
One is to use Excel's built-in error correct if it has flagged this ... from the menu (using Excel 2007 here) select Data...
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