Gutenberg: Featured Image dialogue missing "Mine", "Uploaded to this post", "Unattached" filters

Created on 9 Aug 2018  路  17Comments  路  Source: WordPress/gutenberg

"Set Featured Image" not as useful
The new editor removes the ability for the "Featured Image" button dialogue to "know" what images have been uploaded to the current Post, as well as what images are "Mine" or "Unattached."

To Reproduce
Steps to reproduce the behavior:

  1. Create a Post
  2. Upload an Image to it
  3. In the sidebar panel on the right, click Featured Image
  4. Click Set Featured Image
  5. In the dialogue box, the Uploaded to this post button is gone.

Expected behavior
Having an image "attached" to a Post can be a very useful thing.

  • It helps establish a relationship between the Post and the Image.
  • If one editor has uploaded her own images, she could use the "Mine" selection to find her images, as opposed to the ones that someone else uploaded.
  • If there are some "unattached" images that are needing placement, that is useful to know.

This feature makes it handy to find a relevant image when there may be hundreds if not thousands of images to choose from. There may be some importance for this related to WooCommerce.

The two useful popups, one that shows items by owner/relationship and one by date, have been replaced by a smaller popup that is just by date.

Screenshots
Classic editor:
featured image includes uploaded to this post

New editor:
popup for featured image is small

Oddly the Gallery Media Dialogue does know how to filter:
media dialog for gallery does know what is there

Desktop (please complete the following information):

  • OS: Windows10
  • Browser: Chrome
  • Version: Gutenberg 3.4.0 and WordPress 4.9.8

Smartphone

  • N/A

Additional context

  • The Classic editor's Media Dialogue has a DIV called "media-toolbar-secondary" that contained the pop-ups, DIVS with IDs of, "media-attachment-filters" and "media-attachment-date-filters."
  • The same thing seems to happen when you add an Image Block; the Media Dialogue doesn't filter for images that are Uploaded to this Post, Mine, or Unattached.
  • When you use Image Gallery, it _is_ possible to see what is Uploaded to this Post, Mine, or Unattached.
  • Inline Image and Cover Image both _do not_ show the Uploaded to this Post, Mine, or Unattached.
  • So, whoever is coding the Gallery section must be doing something right, because that does not remove functionality.
Backwards Compatibility [Feature] Media [Status] In Progress [Type] Bug

Most helpful comment

Definitely a bug/regression rather than type:enhancement.
cweagans/composer-patches to the rescue:

diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js
index 2ffa44b..7edfb19 100644
--- a/wp-includes/js/media-views.js
+++ b/wp-includes/js/media-views.js
@@ -949,7 +949,7 @@ function(module, exports) {
        router:             'browse',
        toolbar:            'select',
        searchable:         true,
-       filterable:         false,
+       filterable:         'uploaded',
        sortable:           true,
        autoSelect:         true,
        describe:           false,

Gist: https://gist.githubusercontent.com/drzraf/efc324504dac13b7723b5322a2056669/raw/6531b40e6705e54c2d9a427e13952ce9aeca9023/gutenberg-fix-8748

All 17 comments

Related #7736

@danielbauchhuber, if you're changing the title of this issue, please don't forget the "Uploaded to this post" as that is one of the more important features of that filter.

@designsimply, does the "type enhancement" mean that this is not going to be fixed by the 5.0 release of WordPress?

please don't forget the "Uploaded to this post" as that is one of the more important features of that filter.

Done.

Does the "type enhancement" mean that this is not going to be fixed by the 5.0 release of WordPress?

Not necessarily! However, I will note that developers working full time on the project are focused mainly on fixing bugs prior to the 5.0 release, and of course this project is open source and any developer who would like to take on submitting updates may do so.

I would characterize this as a bug, not a feature request or enhancement , because it's something that worked before and now does not work.

As mentioned above, it does work in one situation:

Gallery Media Dialogue

Here's how the Gallery frames factor in this filter as we would expect: https://github.com/WordPress/gutenberg/blob/master/packages/edit-post/src/hooks/components/media-upload/index.js#L36

We'd need to make frames for each instance of the media library and also define a default state. I'm not positive yet how it currently gets the initial frame from the featured image and image block, but I'll investigate. It may just be adding filterable: 'uploaded' to that frame.

A condition might be needed for featuredImage image video audio etc. and a default would need to also be set. We'd match something like this file from a PR I have open. : https://github.com/WordPress/gutenberg/blob/4119c5a1380a85f0fee3ac0a6b7121076b9c0290/edit-post/hooks/components/media-upload/index.js#L67

I'm thinking the media frame default (and especially the featured image default) view will need to match this here from Core: https://github.com/WordPress/wordpress-develop/blob/6b366c6620fdd5960cedcdf80955966a715efa82/src/js/media/controllers/featured-image.js#L40-L47

I'll keep digging into this tomorrow. Just wanted to throw a quick brain dump from my initial findings. :)

I've opened a PR. Would love some testing on it and a review. This adds a condition for featuredImage to allow for the proper frame features (uploaded, mine, not uploaded) to be available. https://github.com/WordPress/gutenberg/pull/10810

In https://github.com/WordPress/gutenberg/pull/10810 there is some discussion around how the featured image flow should go.

@joemcgill outlined much of the pending decisions/blockers in this comment: https://github.com/WordPress/gutenberg/pull/10810#discussion_r230175251

The PR currently uses the Post frame instead of the Select frame. (sidebar on the left vs. no sidebar on the left) In the 4.9.8 media flows, featured image frame does not have this sidebar.

@joemcgill and I discussed this again today in slack DMs and have come to the agreement that it would be better to push this issue to a later version in favor of a more complete solution that is applicable to all forms of media, and not just featured images. We need to make some decisions and changes in the Media Library structure that would allow it to be better extended or filtered. Just wanted to outline this before moving the milestone without reasoning.

Open to suggestions if anyone has any thoughts around this.

I'm just bumping this thread to point out that this requirement doesn't only apply to featured images, but also to adding/changing any image -- I don't see this mentioned in the thread above.

This is particularly needed when changing themes where image resolutions are different. In this use case, and you need to edit a page/post to reinsert the page's/post's images again at a different resolution. Trying to find the images among 1,000s is impossible without the 'Uploaded to this post' feature in the media browser.

This is definitely a bug/omission this functionality is present in the Classic editor.

@antpb I understand the need for better media flow. Just for recap what I remember from past experience with wp. In past years there were various flows for inserting image.

WP 3.0 - Up 7, ADD 3 steps - default view was uploaded to post
UP // Create new post - Click Upload / Insert by file type - Click Upload to post - Pick images from pc - Click Open - Choose an image - Click insert
ADD // Click Upload/insert - Choose an image - Click insert

WP 3.5 - UP 5, ADD 5 or 3 steps - default view changed to all media (using plugin Default Media Uploader View)
UP // Create new post - Click Add media - drag and drop upload - Choose an image - Click Insert into post
ADD // Click Add media - Click images - Choose uploaded to this post - Choose an image - Click Insert into post
ADD with plugin // Click Add media - Choose an image - Click Insert into post

WP 3.9 - UP 4, ADD 5 or 3 steps
UP // Create new post - drag and drop upload - Choose an image - Click Insert into post
ADD // Click Add media - Click images - Choose uploaded to this post - Choose an image - Click Insert into post
ADD with plugin // Click Add media - Choose an image - Click Insert into post

WP 5.1 - UP 4 (multiplied by the number of single images added to post), ADD 25
UP // Create new post - click Add block - click Add image - drag and drop upload
ADD // Click media library - try to find an image - choose an image, click Select

Difference between 5.1 and previous - In the previous version, it was possible to upload all files for a given post, and then return back and choose files needed. In 5.1 we are back to WP 3.0 flow, when you have to upload one by one specific file types or separate images. It is very frustrating to see this regress.
I understand that this is still in development, but the necessity to dig through images is clearly a bug.

For better flow, I am thinking about things that could be fixed

  1. Return media uploader to post - an ability to add various files at once is for some people crucial
  2. Add option to settings - see files uploaded to this post first
  3. Give people the option to drag to top toolbar blocks that they use the most. Removing one unnecessary step - clicking on Add block
  4. I can imagine that files uploaded to post will be visible in the right sidebar, and from there I will be able to drag and drop them as blocks - image or when choosing multiple images as a gallery

Definitely a bug/regression rather than type:enhancement.
cweagans/composer-patches to the rescue:

diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js
index 2ffa44b..7edfb19 100644
--- a/wp-includes/js/media-views.js
+++ b/wp-includes/js/media-views.js
@@ -949,7 +949,7 @@ function(module, exports) {
        router:             'browse',
        toolbar:            'select',
        searchable:         true,
-       filterable:         false,
+       filterable:         'uploaded',
        sortable:           true,
        autoSelect:         true,
        describe:           false,

Gist: https://gist.githubusercontent.com/drzraf/efc324504dac13b7723b5322a2056669/raw/6531b40e6705e54c2d9a427e13952ce9aeca9023/gutenberg-fix-8748

Thank you drzraf! The missing filters were driving me batty and your fix works! I'm admittedly clueless about github workflows, but I hope someone can get this fix pushed up the chain and into core. My clients and I use 'uploaded to this post' on a daily basis and we've been floundering around without it.

fwiw, if anyone else comes across this, the media-views.min.js file needs to be updated as well (or at least it did in my case)....once I made that change, and reloaded it, voila, filter has returned! :) thanks!

Is it possible to implement this fix with a hook, so that when core updates the fix remains in place?

I have opened a PR that fixes this issue. There was an old PR from over a year ago that had much of the discussion that landed us on the new PR's changes. Link above!

With https://github.com/WordPress/gutenberg/pull/17410 merged, I think we can close this now. Yay!

Is this ever going to be fixed? I have no option for "Uploaded to this post" in any of my Wordpress installations with Gutenberg. It's present in Classic. Guess I will go back to classic until Gutenberg is actually ready for prime time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

franz-josef-kaiser picture franz-josef-kaiser  路  3Comments

cr101 picture cr101  路  3Comments

ellatrix picture ellatrix  路  3Comments

moorscode picture moorscode  路  3Comments

maddisondesigns picture maddisondesigns  路  3Comments