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

Experiment with adding drag&drop to image galleries #15222

Closed
wants to merge 14 commits into from

Conversation

oandregal
Copy link
Member

Related #743

This PR experiments with adding Drag&Drop support for moving images within a gallery.

Peek 2019-04-26 19-27

@oandregal oandregal self-assigned this Apr 26, 2019
@oandregal oandregal added the [Feature] Drag and Drop Drag and drop functionality when working with blocks label Apr 26, 2019
@oandregal oandregal changed the title Add/gallery dnd Experiment with adding drag&drop to image galleries Apr 26, 2019
@hacknug
Copy link

hacknug commented Apr 26, 2019

Looks good! Should we also add some kind of visual clue that let the users know what the order would be before mouseup?

@oandregal
Copy link
Member Author

Should we also add some kind of visual clue that let the users know what the order would be before mouseup?

Yeah, design-wise needs improvement. Note that at the moment it uses the same mechanism (blue line indicating where it'll be dropped). I've got a working version of live DnD (you see where a block/image will be dropped during the dragging process). Perhaps it makes sense to land that first.

@oandregal oandregal added the [Status] In Progress Tracking issues with work in progress label May 22, 2019
@@ -248,7 +248,10 @@ export class BlockListBlock extends Component {
* @return {void}
*/
preventDrag( event ) {
event.preventDefault();
const { type } = JSON.parse( event.dataTransfer.getData( 'text' ) );
if ( type !== 'image' ) {
Copy link
Member

Choose a reason for hiding this comment

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

Does this create an exception to preventDrag for all image elements within blocks, regardless if they're meant for dragging or not?

Would there be some more generic way to also allow blocks to implement drag-and-dropping of non-image elements?


&:active {
cursor: grabbing;
}
Copy link
Member

Choose a reason for hiding this comment

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

Should these styles be applied from Draggable component automatically?

@noisysocks
Copy link
Member

@nosolosw: What's the status on this one?

@noisysocks noisysocks added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Jul 10, 2019
@oandregal
Copy link
Member Author

hey @noisysocks, sorry for the delayed response (was AFK). This is in a holding pattern at the moment. It needs more work at the design level and mechanics, but I have other priorities to address first, so not sure when I can come back to this.

@OffCorner
Copy link

would love to see this feature, was a bit surprised it wasn't there!

@noisysocks
Copy link
Member

I'm going to close this one out as it's stalled. We can always re-open if someone decides to pick it up.

As a side note, I'd encourage us to think about refactoring the Gallery block to use InnerBlocks so that there's fewer design patterns for moving things around within the editor. We would then get drag and drop for free 🙂

@noisysocks noisysocks closed this Aug 29, 2019
@noisysocks noisysocks deleted the add/gallery-dnd branch August 29, 2019 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Drag and Drop Drag and drop functionality when working with blocks [Status] In Progress Tracking issues with work in progress [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants