Update of 
/var/cvs/contributions/CMSContainer/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha
In directory 
james.mmbase.org:/tmp/cvs-serv19806/cmsc/richtext/src/webapp/mmbase/edit/wizard/xinha

Modified Files:
      Tag: b1_4
        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.5
retrieving revision 1.5.6.1
diff -u -b -r1.5 -r1.5.6.1
--- my-htmlarea.js      23 Mar 2007 16:44:28 -0000      1.5
+++ my-htmlarea.js      4 Dec 2008 11:22:03 -0000       1.5.6.1
@@ -196,8 +196,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;
+            }
         }
         if (link) outparam = {
                 f_href   : HTMLArea.is_ie ? editor.stripBaseURL(link.href) : 
link.getAttribute("href"),
@@ -212,17 +215,12 @@
                 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;
-                                      if ( a === null ) {
-                                            a = 
range.startContainer.parentNode;
-                                      }
-                                }
+                        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();
 
                 a.title = param.f_title.trim();
@@ -241,7 +239,7 @@
                 a.target = param.f_target.trim();
                 editor.selectNodeContents(a);
                 editor.updateToolbar();
-  }, outparam, "width=398,height=220");
+  }, outparam);
 };
 
 HTMLArea.prototype._insertImage = function(image) {
@@ -488,5 +486,3 @@
     null
   );
 };
-
-
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to