ianstormtaylor / slate

A completely customizable framework for building rich text editors. (Currently in beta.)
http://slatejs.org
MIT License
29.72k stars 3.24k forks source link

Can't copy single void block #1449

Closed tobiasandersen closed 6 years ago

tobiasandersen commented 6 years ago

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

Bug

What's the current behavior?

If you select a single void block, and press cmd+c (mac) to copy, and then try to paste it somewhere, it won't be pasted. However, it works if it's part of a larger selection range.

To reproduce: Go to http://slatejs.org/#/images, click the image (which should highlight that it's selected), press cmd+c and try to paste it somewhere.

I'm on Chrome Version 62.0.3202.94 (Official Build) (64-bit) on mac.

dmitrizzle commented 6 years ago

I feel like this may be because of different types of selections. When you select text, that's native. While clicking void block that's something else, which causes this bug. I think...

zGrav commented 6 years ago

In our case, it was possible to "bypass" this by doing a custom copy/paste handler... a bit annoying but it was the only solution we found.

dmitrizzle commented 6 years ago

Would love to see a snippet @zGrav - I think it might be a valid solution for Slate core (since void blocks are special case either way) - or at least as a patch in my code...

zGrav commented 6 years ago

@dmitrizzle https://gist.github.com/zGrav/440fdbe83d7eca8455362ccfd2e58662

This is a PoC plugin , and might not be 100% functional :D

dmitrizzle commented 6 years ago

Thank you!

skogsmaskin commented 6 years ago

This is a bug which has been there for long as I can remember. It would be wonderful to get this fixed properly!