Opened 8 months ago
Last modified 7 months ago
#22180 new feature request
Add attachments to "existing content" area in link dialog
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Editor | Version: | 3.4 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
At the moment, the process for linking to attachments within the editor is rather cumbersome. Each time someone wants to link to a PDF document or other item they've uploaded through the media interface, they have to take the following steps:
- Upload the file through the media uploader
- Press the File URL button in the media modal
- Copy the URL from the "Link URL" box
- Close the media modal
- Highlight the text they want to link
- Press the "Insert/edit link" button in the editor toolbar
- Paste the URL from their clipboard into the URL input
It would be nice if attachments could be included in the "Link to existing content" area within the link dialog.
I can see two possible ways of implementing this. Either simply include attachments in line with the pages, posts and custom post types that already display in that area; or, use a tabbed interface to switch back and forth between the normal "existing content" list and a list of existing attachments.
When I discussed this with Nacin and a few others at WordCamp Baltimore, we proposed adding a preference (possibly based on the information that's stored when the user uploads the media) determining whether the permalink leads to the attachment page or the actual file.
Based on my preliminary research, it looks like implementing this will essentially take two steps:
- Add 'attachment' to the $pts array at the beginning of the _WP_Editors::wp_link_query() method.
- If the preference has been set to link to the actual file, the code will need to adjust the permalink value in the $results array for anything that comes up as an attachment.
I'll look at starting a patch for this over the next few days, unless someone else gets to it first. Thanks.