-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set multi select copy content + better selector names #1013
Conversation
If anyone finds any better names, feel free to suggest. :) |
922ec36
to
959733b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Do you have plans for a future "paste" handling pull request?
- How can I cut/copy a single block?
|
||
componentWillUnmount() { | ||
document.removeEventListener( 'copy', this.onCopy ); | ||
document.removeEventListener( 'copy', this.onCut ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be 'cut'
, not 'copy'
Warning on missed selector rename:
|
ad66657
to
5570ad0
Compare
@aduth These are specifically for multi-selection. Paste will we quite a bit of work to get right in and outside blocks, but yeah I'll try to address in a separate PR. Regarding copy, would you expect to get the whole block copied when a block is selected and there is a collapsed selection? I don't see what could be wrong with that as nothing would happen by default. :) |
Cut, copy and paste will be very cool, and the multi select stuff feels born for it. But it's probably something we should push a bit head of us, especially if it's a lot of work. It's one of those "plus" features that will be really nice to add once everything else is in place and solid. |
Sure. Copy and cut are easy to handle. Note that this PR renames a few things as well. Paste is quite a bit more complicated. :) I don't mind to defer that one. |
I'm still a bit unclear on the purpose of these changes then if we're not looking to pursue paste in the near-term. What use case is this satisfying? |
I thought this is something we eventually want. If not, feel free to close the PR. |
To step back a bit, my suggestion to postpone work on paste isn't because I don't like the feature, I think it's potentially cool. But I do get the sense that it's a very difficult undertaking, which if true means we should prioritize it lower than the items in the beta milestone: https://github.com/WordPress/gutenberg/milestone/7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
5570ad0
to
64bb52e
Compare
This PR enables copying content from a multi selection. To test, select some blocks, and verify that the clipboard data contains the serialised block content.
It also renames some selectors, which hopefully makes things clearer, and fixes a bug in the inserter where a block would be inserted at the wrong position for bottom-to-top selection.