-
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
Link directly to files stored in the Media Library using the Link UI #39701
Conversation
Size Change: +49 B (0%) Total Size: 1.21 MB
ℹ️ View Unchanged
|
packages/core-data/src/fetch/__experimental-fetch-link-suggestions.js
Outdated
Show resolved
Hide resolved
This is so cool @getdave. This PR looks very good. Anything in particular that makes it a draft? |
Not really. I just knocked it up in 5mins last night so I wasn't confident in saying it's ready for review. |
This PR is not currently my main focus but I will make my best effort to advance it as I see it's important to users. |
cc'ing @mintplugins as the original creator of the Issue. I appreciate it was a long time ago but if you have time/inclination you can follow these steps to test this PR. |
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.
Feature works well for me. Thank you!
Oh sweet! I guess this one just needs a code review to land. As with every piece of UI in the entire interface, there's always an opportunity to improve the visuals. The following should not block this PR at all, but just sharing in terms of future musings: (For that design, we could probably use a general File icon, but also a note to self, might be nice with a bespoke PDF variant as well.) |
Hey @jasmussen Joen. I will just add it in... |
It would be a future exploration, and I think figuring out what works will feel much more natural in a PR. |
packages/core-data/src/fetch/test/__experimental-fetch-link-suggestions.js
Outdated
Show resolved
Hide resolved
packages/core-data/src/fetch/__experimental-fetch-link-suggestions.js
Outdated
Show resolved
Hide resolved
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.
This looks great, just a few nitpicks but nothing to stop you merging.
@paaljoachim @jasmussen Thank you both for taking time to review this and make such good suggestions 🙇 The icon idea is certainly worth exploring in a followup but I also agree with Paal that we ought to retain some kind of text-based title. |
a140f7b
to
4bfddea
Compare
4bfddea
to
7c27802
Compare
7c27802
to
4acbcca
Compare
What?
This PR includes media files (attachments) in the results returned by
__experimentalFetchLinkSuggestions
. This means that you can search for and see results for media files in the Link UI.This means you can now link directly to files that have been uploaded to the WordPress Media library.
Why?
Many folks want to be able to link to a Media file directly from the Link UI. Currently this is not possible without significant workarounds.
A key use case is the ability to link to previously uploaded PDFs which is a very common requirements.
How?
This PR appends an additional query which makes a request to the Media REST endpoint using the
search
query parameter to find attachments which match the given query.Given that the Search and Media endpoints are very similar it's then simple enough to normalize the results into the format expected to be returned by
__experimentalFetchLinkSuggestions
.The result of this is that you can now search for media files directly from the Link UI.
Please note: this PR doesn't provide a means to upload media directly from the Link UI itself (that's something for another day).
Testing Instructions
Screenshots or screencast
Screen.Capture.on.2022-03-23.at.16-56-21.mov