-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add the Openverse Media Library #375
Conversation
55b2319
to
66f6515
Compare
The latest commits add support for Gallery selection too, and now uses the 2-step process that the core media modal does - you first select an image (which is highlighted with a blue border), then "Add media" in the modal footer. Still tweaking the keyboard interaction, I think the whole grid will be a single tab stop, with arrow keys to select. |
c2c5137
to
ce8984f
Compare
d956c3a
to
959cf5b
Compare
959cf5b
to
1f47969
Compare
This is so rad! One piece of early feedback (I hope this is okay!) is that we'd likely want to surface the license requirements for each result as early as possible and the resulting image block would need to include the attribution (preferrably in some way that is obvious that it shouldn't be removed for images where the license requires attribution). I'm not sure how the attribution would be handled for the gallery block but hopefully a designer can help with that. |
@sarayourfriend for the Pattern Directory, we're only allowing CC0 images to be returned, so we shouldn't need to worry about attribution. Though we could probably drop it into the caption, and let pattern authors decide to leave it or remove it…? Not sure about that - right now just the item title is added to the caption. (I also want to figure out a good solution for alt text, both when browsing and when inserting images) |
Oh perfect! I didn't catch that when I scanned the code, but that makes sense 🎉 For the alt text, on Openverse we use the image title. |
public_html/wp-content/plugins/pattern-creator/src/components/openverse/index.js
Outdated
Show resolved
Hide resolved
Latest commits get the styling almost-there: I need to get the loading state centered, but I think that's the only thing remaining. @shaunandrews I noticed an issue for the focus states on the images- when images are selected, there's no distinction between focused or not, and TBH there's not much distinction between focused/selected on the unselected images: In core, there's a checkbox that appears on selected items for a clear distinction between focused/selected, we could do something similar with an icon? Open to any other solution too. |
3723e32
to
8298a2c
Compare
I'm running into trouble trying to get the media blocks + openverse media to play together… The media blocks use image IDs to indicate what’s currently selected (for example, a gallery is a list of IDs). If we don’t pass through the OV item’s ID, it doesn’t persist selections - you can select images for a gallery, then open the Media Library again and it won’t know that you already have a gallery. On the other hand, if we do pass the OV item ID, the editor tries to make a request to We're already intercepting some media API requests, so possibly I could intercept requests that look like OV IDs and short-circuit the return value, but I'm not sure if there's an easier way :) Edit: Bypassing the API works to prevent the failed request, but it won't save the selected image ID because the media blocks expect the ID attribute to be a number and it does validation. |
@shaunandrews thanks for the updated styles, I just pushed that change up to the branch so it looks like this now: |
Great. Looks like the "Cancel" button at the button is getting cut off somehow. Will the results always be "10000"? If so, maybe we don't need the number of results. If the number could/does change, can we give it a proper counting treatment? That is, adding comma's/point's where they belong. Like, "10,000" instead? |
Cancel button: I think that's just because I'm downsizing by taking a 1x screenshot - it looks correct in real life: Result count: The demo suggestions are all very broad, so they max out at 10,000 - result counts are different for more specific searches. I'll see about formatting the number better. |
…ection when an image is clicked
…openverse/index.js Co-authored-by: sarayourfriend <24264157+sarayourfriend@users.noreply.github.com>
985cef0
to
98866dd
Compare
I'm going to merge this to get the framework in, and the remaining issues can be done in followup PRs:
|
Fixes #37 — Add a modal for searching the Openverse collection of images. Built on top of #373.
This is a rough draft of a search interface for finding images from Openverse. The only working test case is the Image block (other blocks use slightly different flows).
In the following recording, I've added an image block, found and selected an image, replaced the image, then re-replaced the image using the keyboard only.
Screen.Recording.2021-11-10.at.11.46.06.AM.mov
Steps to finish this PR:
Screenshots
Open the modal, shows a request to get all images. Here we could prepopulate a search term, or make some other specific request.
Type in the search bar, returns the results
If there are no results, we show an empty state