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

Tiled gallery block: allow adding images from media gallery after adding images to block #11877

Open
simison opened this issue Nov 28, 2018 · 10 comments
Assignees
Labels
[Block] Tiled Gallery [Feature] Tiled Gallery A different way to display image galleries on your site, in different organizations and shapes. [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Pri] Normal [Status] Needs Design

Comments

@simison
Copy link
Member

simison commented Nov 28, 2018

When adding Tiled gallery block, user can choose to upload or add image via media gallery:

image

After adding images, user can only choose to upload images:

image

We should keep "Media library" option here, too.

We should follow closely what core gallery does for this section and possibly aim to componentize it: WordPress/gutenberg#9682 and WordPress/gutenberg#12367

Relates to permissions checking: https://github.com/WordPress/gutenberg/blob/bcf55ff095fb9cbfee37aef24c422fbbf9661562/docs/data/data-core.md#hasuploadpermissions

@simison simison changed the title Tiled gallery block: allow adding images from media gallery after adding images Tiled gallery block: allow adding images from media gallery after adding images to block Nov 28, 2018
@sirreal sirreal self-assigned this Feb 18, 2019
@sirreal
Copy link
Member

sirreal commented Feb 19, 2019

I was implementing this in #30863 where I attempted to unify the empty gallery placeholder and the add media placeholder, but have hit significant roadblocks.

@simison
Copy link
Member Author

simison commented Feb 19, 2019

I think we should piggyback on this implementation once it merges WordPress/gutenberg#12367

@sirreal
Copy link
Member

sirreal commented Feb 19, 2019

I think we should piggyback on this implementation once it merges WordPress/gutenberg#12367

Yep, that implementation is essentially what I propose in #30863. A large part of MediaPlaceholder is duplicated. I suspect WordPress/gutenberg#9682 to experience the same issues I discovered in #30863.

@simison
Copy link
Member Author

simison commented Feb 19, 2019

Do you think it's related to media gallery bugs fixed in WordPress/gutenberg#12435 ?

@sirreal
Copy link
Member

sirreal commented Feb 19, 2019

No, there are just limitations to the MediaPlaceholder. See the full description: Automattic/wp-calypso#30863 (comment)

Specifically, there's no clear way around this limitation:

  • When uploading media via the placeholder button to an existing gallery, it completely replaces the existing images.
  • When uploading media via drag and drop to an existing gallery, it completely replaces the existing images.

Otherwise, the MediaPlaceholder implementation is quite nice.

@simison
Copy link
Member Author

simison commented Feb 19, 2019

cc @jorgefilipecosta

@jorgefilipecosta
Copy link
Member

jorgefilipecosta commented Feb 19, 2019

Hi @simison, @sirreal,
My plan was to after merging WordPress/gutenberg#12367 extract a component that allows rendering the gallery appender. After reading this PR and the related one Automattic/wp-calypso#30863, I noticed that the gallery appender being implemented in WordPress/gutenberg#12367 is just equivalent to MediaPlaceholder without label and icon, with the media library button opening the media library in a different state, and with some custom styles.
It may be possible refactor WordPress/gutenberg#12367 to use MediaPlaceholder in the gallery appender by adding two additional optional props one that enables a custom style and one that allows opening the media library in a specific state (the add to gallery mode).
Feel free to share your thoughts about this idea.

@sirreal
Copy link
Member

sirreal commented Feb 20, 2019

Thanks @jorgefilipecosta! What you outline is aligned with my ideas 👍

Two things I'd add:

MediaPlaceholder needs to take into account that uploaded images, via dialog or drag and drop, should be appended to the current gallery rather than replace it as they do now.

MediaPlaceholder includes DropZone. Core Gallery and Tiled Gallery remove the appender section when the block is not selected. If we rely on MediaPlaceholder and its DropZone, we cannot remove it when the block is not selected or we lose the DropZone. It would be nice to be able to remove the appender UI but keep the DropZone functionality when the block is not selected. In #30863 I've done this with CSS.

@scruffian scruffian transferred this issue from Automattic/wp-calypso Apr 3, 2019
@scruffian scruffian added [Pri] Normal [Status] Needs Design [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Feature] Tiled Gallery A different way to display image galleries on your site, in different organizations and shapes. labels Apr 3, 2019
@sirreal
Copy link
Member

sirreal commented Feb 20, 2020

There was some work in Automattic/wp-calypso#30863 that could be brought over for this if anyone is interested in picking it up.

@annezazu
Copy link

Just ran into this on my site (simple site on WPCOM using 6.6.1):

tiled.gallery.UX.mov

This is rough especially when you're trying to quickly add images in. Something also seems broken with the upload an image button. It would be great to repick this work up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Tiled Gallery [Feature] Tiled Gallery A different way to display image galleries on your site, in different organizations and shapes. [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Pri] Normal [Status] Needs Design
Projects
None yet
Development

No branches or pull requests

6 participants