htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: WYSIWYG Forums: WYSIWYG Editor Discussion:
i found a solution for the targetproblem with imagelinks in htmlarea!!


 


misch
New User

Jul 12, 2005, 1:31 PM

Post #1 of 1 (13488 views)
Shortcut
i found a solution for the targetproblem with imagelinks in htmlarea!! Can't Post

Hi!

Last weekend i solved the problem of setting a target for imagelinks. I didn't find a solution in the net, so i post it here.

But First, what is the problem? If you click on an image to edit the link, the javascript references the image as selection and not the a-tag.

What did i do? I checked the tagname of the selection and if it is a "img" i select the parentElement and that is the a-tag.

It is simple. open the file htmlarea.js. There is a function "HTMLArea.prototype.renderPopup_addLink".

Search the following lines in this function:

sel = editor._getSelection();
var range = editor._createRange(sel);
a = editor.getParentElement();


right after these lines enter this code:

if( a.tagName.toLowerCase() == "img"){
a = a.parentElement;
}

that's all. I hope i could help somebody;-)



misch


(This post was edited by misch on Jul 13, 2005, 12:55 AM)

 
 
 


Search for (options)