-
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
Experiment with adding drag&drop to image galleries #15222
Conversation
This makes DnD for images that aren't stored in the media library, but are just a link to an external resource.
Looks good! Should we also add some kind of visual clue that let the users know what the order would be before |
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. |
@@ -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' ) { |
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.
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; | ||
} |
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 these styles be applied from Draggable
component automatically?
@nosolosw: What's the status on this one? |
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. |
would love to see this feature, was a bit surprised it wasn't there! |
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 |
Related #743
This PR experiments with adding Drag&Drop support for moving images within a gallery.