"put link in clipboard" for attached files, too

Frank Steiner - April 15, 2008 - 14:28
Project:Web File Manager
Version:6.x-2.9-alpha1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi,

would be great if the "put link in clipboard" could be added to the context menu for attached files, not only in the file browser. That would make it easier to create links in the page body for attached files (well, as soon as the clipboard works in Linux, of course ;-))

cu,
Frank

#1

Frank Steiner - April 18, 2008 - 13:46

Hi,

since the clipboard function does not work in Opera (see http://drupal.org/node/246914), I wrote a little patch to get a similar function into the context menu for the attached files instead of adding the clipboard function there.

The new menu entry "Paste link in editor window" creates the same <a href=..> code that you can copy and paste from the meta data window, but immediately inserts it at the last known cursor position in the Body textarea. This makes it very easy to create anchors for your attachments in the body.

However, there is one issue in this patch I'm not sure about. To reference the textarea, I use document.getElementById('edit-body'). I got this ID from the drupal source code, but I don't feel well relying on a hard-coded string.

If someone knows a clean way to fetch the id of the body textarea by some drupal function (I just started programming in Javascript and drupal yesterday, so I have noe clue :-)), please let me know or change the patch yourself.

Frank

AttachmentSize
insert_attachment_href.diff 2.15 KB

#2

robmilne - April 18, 2008 - 19:53

Wow, thanks a lot for these 4 patches. Open source rocks. If you've only just started in drupal/javascript I'm impressed. General programming skill is more valuable than specific language knowledge.

I don't see an issue with hardcoding the id since hardcoded classes and ids are endemic to this cms.

I'll commit to DRUPAL-5 head of the project so that you test drive before I release a 2.13 version.

Btw Andre is handling the DRUPAL-6 stuff so you may have to wait longer for a new 6 release.

#3

robmilne - April 18, 2008 - 20:11
Status:active» fixed

fixed in 5 branch only at this time

#4

Frank Steiner - April 21, 2008 - 09:52

Thanks :-) I'm glad I could help!

#5

Anonymous (not verified) - May 5, 2008 - 10:01
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.