-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Media Library: Expose filters dropdown for individual images, such as with the Image block #65965
Media Library: Expose filters dropdown for individual images, such as with the Image block #65965
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @cagivacode, @tiagogon, @kylemcph, @Wadowad, @RoqueCampos, @venture89, @spncr, @simonPaulBergzeit, @Ezokia, @fylgjur, @sbathompson-he, @dnnsjsk. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +97 B (+0.01%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
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.
Yes, let's bring this in. It adds something without breaking anything and it does it by following an established pattern.
Thanks for the review, @draganescu! I'll merge this in now. I've opened a separate issue over in #66663 for the follow-up task of looking into ensuring that images added to posts or pages get attached to that post or page in Gutenberg. Or, at the very least, that issue is a good place for us to continue the discussion 🙂 |
… with the Image block (WordPress#65965) * Media Library: Expose filters dropdown for individual images, such as with the Image block * Rename to be a little more generic Unlinked contributors: cagivacode, tiagogon, kylemcph, Wadowad, yoanmarchal, RoqueCampos, venture89, spncr, simonPaulBergzeit, Ezokia, fylgjur, sbathompson-he, dnnsjsk. Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: finalwebsites <finalwebsites@git.wordpress.org> Co-authored-by: Drivingralle <drivingralle@git.wordpress.org> Co-authored-by: johnbillion <johnbillion@git.wordpress.org> Co-authored-by: torounit <toro_unit@git.wordpress.org> Co-authored-by: paaljoachim <paaljoachim@git.wordpress.org> Co-authored-by: Soean <soean@git.wordpress.org> Co-authored-by: jamesmrobinson <imaginarymedia@git.wordpress.org>
What?
Part of #12753
Expose the Filters dropdown within the media library modal that's used by the Image block (the default state for the
MediaUpload
component).Why?
As reported in #12753, it's useful for folks to be able to filter by unattached images, etc, as folks can currently do via the modal for the Gallery block. This PR essentially gets parity between the Image and Gallery blocks when it comes to the filters available from the media library.
Note as reported in #12753, there is likely still some behaviour here that could be buggy. For example, this needs to be investigated:
This still occurs with this PR:
However if I upload an image directly to a post within Gutenberg, it is attached correctly:
So, while reviewing this PR, keep that in mind when looking at the filters. If that issue feels like a blocker, we can pause this PR for now while investigating the above issue. It might need a little further investigation so that attaching images to a post only happens when we believe it's likely what the user intended 🤔
How?
Update the
MediaUpload
component so that when selecting single image media, the Select media frame is configured to use thefilterable
option of'uploaded'
. To achieve this, the proposal here is to extendwp.media.view.MediaFrame.Select
, in a similar way to how the featured image frame currently works. We then overridecreateStates
, using the same code as in core, only withfilterable
added in to switch on the filters.Testing Instructions
Screenshots or screencast
2024-10-09.16.56.13.mp4