Update of
/var/cvs/contributions/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha
In directory
james.mmbase.org:/tmp/cvs-serv4075/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha
Modified Files:
my-htmlarea.js
Log Message:
CMSC-1090 Content link around an image does not convert to live-link at live
environment; links can not be changed around an image
Removed code is required for FF when a = editor.getParentElement(); returned a
non A-tag and text is selected
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.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- my-htmlarea.js 26 Dec 2008 09:08:20 -0000 1.8
+++ my-htmlarea.js 30 Dec 2008 16:07:38 -0000 1.9
@@ -232,16 +232,7 @@
if (!param) { return false; }
var a = link;
if (!a) {
- 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();
-
if(sel == null || sel == ""){
var aLink = document.createElement('a');
editor.insertNodeAtSelection(aLink);
@@ -249,6 +240,29 @@
a.href = param.f_href.trim();
a.innerHTML = param.f_linkName.trim();
}
+ else {
+ editor._doc.execCommand("createlink",
false, param.f_href);
+ a = editor.getParentElement();
+ var range = editor._createRange(sel);
+ if (!HTMLArea.is_ie) {
+ if (a == null || !(/^a$/i.test(a.tagName)))
{
+ a = range.startContainer;
+ if ( ! ( /^a$/i.test(a.tagName) ) ) {
+ a = a.nextSibling;
+ if ( a === null ) {
+ a =
range.startContainer.parentNode;
+ }
+ }
+ }
+ }
+ else {
+ 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;
+ }
+ }
+ }
}
else{
a.href = param.f_href.trim();
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs