htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 2: htmlArea 2 & 3 archive (read only): htmlArea v2.0 - Add-Ons:
Edit hyperlink on image


The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.

 


manager_2
Novice

Nov 13, 2003, 4:09 AM

Post #1 of 3 (3884 views)
Shortcut
Edit hyperlink on image Can't Post

Hi!

I'm using the htmlArea 3.0 version and I'm trying to retrieve href from a linked image so that I can display the link in the "insert hyperlink"-popup but I can't get it to work. It's no problem to retrieve the href from a plain text-link.

Anyone have an idea?

//Mike


******************************Solved*****************************


(This post was edited by manager_2 on Nov 13, 2003, 9:27 AM)


Bytemare
Novice

Feb 27, 2004, 8:33 AM

Post #2 of 3 (3687 views)
Shortcut
Re: [manager_2] Edit hyperlink on image [In reply to] Can't Post

I just can't see it solved.
in the latest CVS it is still impossible to edit the link around an inserted image.
did i anything missed?

it only works with plain text or with text and image together sourounded by a link-tag


Bytemare
Novice

Mar 1, 2004, 11:26 AM

Post #3 of 3 (3653 views)
Shortcut
Re: [Bytemare] Edit hyperlink on image [In reply to] Can't Post


Code
I just did THIS to get the Image-Link-Problem solved: 


HTMLArea.prototype._createLink = function(link) {
var editor = this;
var outparam = null;
if (typeof link == "undefined") {
link = this.getParentElement();

//HERE the modification starts
if (link && /^img$/i.test(link.tagName))
link = link.parentNode;
//END

if (link && !/^a$/i.test(link.tagName))
link = null;
}
if (link) outparam = {
f_href : HTMLArea.is_ie ? editor.stripBaseURL(link.href) : link.getAttribute("href"),
f_title : link.title,
f_target : link.target
};
this._popupDialog("link.html", function(param) {
if (!param)
return false;
var a = link;
if (!a) {
editor._doc.execCommand("createlink", false, param.f_href);
a = editor.getParentElement();
var sel = editor._getSelection();
var range = editor._createRange(sel);
if (!HTMLArea.is_ie) {
a = range.startContainer;
if (!/^a$/i.test(a.tagName))
a = a.nextSibling;
}
} else a.href = param.f_href.trim();
if (!/^a$/i.test(a.tagName))
return false;
a.target = param.f_target.trim();
a.title = param.f_title.trim();
editor.selectNodeContents(a);
editor.updateToolbar();
}, outparam);
};


This worked for MSIE (Mozilla not tested so far)
Can this be included in the CVS or is it BAD CODE ?

 
 
 


Search for (options)