Skip to content
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

Merged
merged 2 commits into from
Jun 10, 2017

Conversation

ellatrix
Copy link
Member

@ellatrix ellatrix commented Jun 3, 2017

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.

@ellatrix ellatrix self-assigned this Jun 3, 2017
@ellatrix ellatrix requested review from youknowriad and aduth June 3, 2017 12:27
@ellatrix
Copy link
Member Author

ellatrix commented Jun 3, 2017

If anyone finds any better names, feel free to suggest. :)

@ellatrix ellatrix force-pushed the add/multi-select-copy branch from 922ec36 to 959733b Compare June 3, 2017 13:17
Copy link
Member

@aduth aduth left a 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 );
Copy link
Member

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'

@aduth
Copy link
Member

aduth commented Jun 5, 2017

Warning on missed selector rename:

WARNING in ./editor/inserter/menu.js
387:26-46 "export 'getBlockSelectionEnd' was not found in '../selectors'

@ellatrix ellatrix force-pushed the add/multi-select-copy branch from ad66657 to 5570ad0 Compare June 5, 2017 18:00
@ellatrix
Copy link
Member Author

ellatrix commented Jun 5, 2017

@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. :)

@ellatrix ellatrix requested a review from aduth June 5, 2017 18:07
@jasmussen
Copy link
Contributor

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.

@ellatrix
Copy link
Member Author

ellatrix commented Jun 5, 2017

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.

@aduth
Copy link
Member

aduth commented Jun 6, 2017

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?

@ellatrix
Copy link
Member Author

ellatrix commented Jun 6, 2017

I thought this is something we eventually want. If not, feel free to close the PR.

@jasmussen
Copy link
Contributor

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?

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

Copy link
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants