Gutenberg: Remove Edit Gallery from Media Library modal

Created on 6 Apr 2020  路  7Comments  路  Source: WordPress/gutenberg

Describe the bug

Users are able to edit a gallery from the modal that appears when one clicks on _Media Library_ in a Gallery block. This is confusing, though, as the image captions in this modal differ from the image captions in the block. Having _Edit Gallery_ in the modal is unnecessary as galleries can be edited directly from within the block. We should remove the _Edit Gallery_ button. See https://github.com/WordPress/gutenberg/issues/8310 for more context.

To reproduce

  1. Insert a Gallery block.
  2. Upload a few images to the gallery.
  3. Add a caption to one or more images.
  4. Click _Media Library_.
  5. Click _Edit Gallery_.

Note that the image captions that appear in the modal differ from the image captions that appear in the block.

Expected behavior

There should not be a _Edit Gallery_ button in the modal.

Screenshots

gallery

Needs Dev [Block] Gallery [Feature] Media [Type] Bug

Most helpful comment

I have taken a look at this.

The context seems to be that the modal is a Wordpress tool from pre-Gutenberg, and is getting phased out for a purely block editing tool as per #21247 . It provides both gallery editing as well as media-library capabilities and we will be removing the gallery editing.

I have traced the media library button through the code and I have found a way to isolate the modal as used only by gallery:
https://github.com/WordPress/gutenberg/blob/bbc2390d5bd48d754e3cc4033d972eb2aa725e2e/packages/media-utils/src/components/media-upload/index.js#L83-L91

wp.media.view.MediaFrame.Post is used in other places particularly the classic editor, so it makes sense to alter its behaviour using the extension of it above.

Design-wise, I looks like it should work to just remove the "Edit Gallery" menu item, and as per #8310 it seems like it won't impact existing user experience.

I will submit a PR shortly.

Possible complications:

  • I have not yet looked at the native side of things, I am not sure if I need to.
  • MediaUpload goes through an extensible filter, I haven't looked into this enough but it doesn't look like it should be an issue.

All 7 comments

@noisysocks, is it ok if I tackle this one?

@noisysocks, is it ok if I tackle this one?

Go for it! 馃挭 I'll assign you so that nobody else accidentally starts working on it. Let me know if you can no longer work on this and would like to be unassigned. And, of course, please drop into #core-editor in WordPress Slack if you have any questions or need help.

Check out this issue:

21247

This will still be an issue if #21247 is implemented because we'll still have the _Media Library_ button.

I have taken a look at this.

The context seems to be that the modal is a Wordpress tool from pre-Gutenberg, and is getting phased out for a purely block editing tool as per #21247 . It provides both gallery editing as well as media-library capabilities and we will be removing the gallery editing.

I have traced the media library button through the code and I have found a way to isolate the modal as used only by gallery:
https://github.com/WordPress/gutenberg/blob/bbc2390d5bd48d754e3cc4033d972eb2aa725e2e/packages/media-utils/src/components/media-upload/index.js#L83-L91

wp.media.view.MediaFrame.Post is used in other places particularly the classic editor, so it makes sense to alter its behaviour using the extension of it above.

Design-wise, I looks like it should work to just remove the "Edit Gallery" menu item, and as per #8310 it seems like it won't impact existing user experience.

I will submit a PR shortly.

Possible complications:

  • I have not yet looked at the native side of things, I am not sure if I need to.
  • MediaUpload goes through an extensible filter, I haven't looked into this enough but it doesn't look like it should be an issue.

While testing this I have found that the edit image feature currently isn't functional:

Screen Shot 2020-04-09 at 10 20 52 pm

How are you supposed to swap or add images to a gallery if this feature is removed?

Please do not remove the edit link. It is currently the only way to edit the caption (or other media meta-data ) for an image
"globally" without having to hunt for the image in the media library. Also editing via the modal allows for drag and drop re-ordering of images which far faster than clicking the arrow button on images in the Gutenberg gallery.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ellatrix picture ellatrix  路  3Comments

jasmussen picture jasmussen  路  3Comments

hedgefield picture hedgefield  路  3Comments

mhenrylucero picture mhenrylucero  路  3Comments

JohnPixle picture JohnPixle  路  3Comments