[wp-trac] [WordPress Trac] #22180: Add attachments to "existing content" area in link dialog

WordPress Trac wp-trac at lists.automattic.com
Fri Oct 12 20:59:27 UTC 2012


#22180: Add attachments to "existing content" area in link dialog
-----------------------------+-----------------------------
 Reporter:  cgrymala         |       Type:  feature request
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Editor
  Version:  trunk            |   Severity:  normal
 Keywords:                   |
-----------------------------+-----------------------------
 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:

 1. Upload the file through the media uploader
 2. Press the File URL button in the media modal
 3. Copy the URL from the "Link URL" box
 4. Close the media modal
 5. Highlight the text they want to link
 6. Press the "Insert/edit link" button in the editor toolbar
 7. 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:

 1. Add 'attachment' to the `$pts` array at the beginning of the
 `_WP_Editors::wp_link_query()` method.
 2. 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22180>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list