Update of
/var/cvs/contributions/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha
In directory
james.mmbase.org:/tmp/cvs-serv19848/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha
Modified Files:
my-htmlarea.js
Log Message:
CMSC-1090 - Content link around an image did not convert to live-link at live
war; links could not be changed around an image.
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha
See also: http://www.mmbase.org/jira/browse/CMSC-1090
Index: my-htmlarea.js
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha/my-htmlarea.js,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- my-htmlarea.js 16 Oct 2008 09:13:19 -0000 1.6
+++ my-htmlarea.js 4 Dec 2008 11:22:09 -0000 1.7
@@ -197,8 +197,11 @@
var outparam = null;
if (typeof link == "undefined") {
link = this.getParentElement();
- if (link && !/^a$/i.test(link.tagName))
- link = null;
+ while (link) {
+ if (/^a$/i.test(link.tagName)) break; //Search for the
enclosing A tag, if found: continue and use it.
+ if (/^body$/i.test(link.tagName)) { link = null; break }
//Stop searching when Body-tag is found, don't go too deep.
+ link = link.parentNode;
+ }
}
var sel = editor._getSelection();
@@ -206,7 +209,7 @@
if (link) outparam = {
f_href : HTMLArea.is_ie ? editor.stripBaseURL(link.href) :
link.getAttribute("href"),
f_destination : HTMLArea.is_ie ? link.destination :
link.getAttribute("destination"),
- f_linkName : link.linkName?link.linkName:sel,
+ f_linkName : link.linkName ? link.linkName:sel,
f_title : link.title,
f_target : link.target
};
@@ -228,18 +231,14 @@
editor._doc.execCommand("createlink", false,
param.f_href);
a = editor.getParentElement();
+ while (a) {
+ if (/^a$/i.test(a.tagName)) break; //Search for the
enclosing A tag, if found: continue and use it.
+ if (/^body$/i.test(a.tagName)) { a = null; break }
//Stop searching when Body-tag is found, don't go too deep.
+ a = a.parentNode;
+ }
+
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;
- if ( a === null ) {
- a =
range.startContainer.parentNode;
- }
- }
- }
if(sel == null || sel == ""){
var aLink =
document.createElement('a');
editor.insertNodeAtSelection(aLink);
@@ -253,7 +252,6 @@
a.innerHTML = param.f_linkName.trim();
a.title = param.f_title.trim();
-
if (HTMLArea.is_ie) {
a.destination = param.f_destination.trim();
if (!a.destination && a.relationID) {
@@ -270,7 +268,7 @@
a.target = param.f_target.trim();
editor.selectNodeContents(a);
editor.updateToolbar();
- }, outparam, "width=398,height=220");
+ }, outparam);
};
HTMLArea.prototype._insertImage = function(image) {
@@ -517,5 +515,3 @@
null
);
};
-
-
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs