Select all + paste results in an error when there is a trailing empty block
See original GitHub issueDo 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:
- Created 6 years ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top 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 >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
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 forinsertFragmentAtRange
.I did found out another one though, PR’ing 😃