r1769 - branches/bxe_2_0/js

[email protected] Fri, 26 Oct 2007 14:23:47 +0200 (CEST)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Fri Oct 26 14:23:47 2007
New Revision: 1769

Log:
BXEB-44
 Text-Inlines erzeugen scheitert bei direkt benachbarten Markierungen


Modified:
   branches/bxe_2_0/js/bxeFunctions.js

Modified: branches/bxe_2_0/js/bxeFunctions.js
==============================================================================
--- branches/bxe_2_0/js/bxeFunctions.js	(original)
+++ branches/bxe_2_0/js/bxeFunctions.js	Fri Oct 26 14:23:47 2007
@@ -540,13 +540,24 @@
 				
 			}
 	} else {
-		var styleHolder;
-		sel.anchorNode.parentNode.normalize();
+		sel.fixFocus();		
+		
+		if (sel.anchorNode != sel.focusNode) {
+			var anchorLength = sel.anchorNode.nodeValue.length - sel.anchorOffset;
+			var focusLength = sel.focusNode.nodeValue.length - sel.focusOffset;
+			if (anchorLength > focusLength) {
+				sel.extend(sel.anchorNode,sel.anchorNode.nodeValue.length);
+			} else {
+				var _o = sel.focusOffset;
+				sel.collapse(sel.focusNode,0);
+				sel.extend(sel.focusNode,_o)
+			}
 		
+		}
+		sel.anchorNode.parentNode.normalize();
 		var _node = bxe_config.xmldoc.createElementNS(e.additionalInfo.namespaceURI,e.additionalInfo.localName);
 		var xmlnode = bxe_getXMLNodeByHTMLNode(sel.anchorNode.parentNode);
 		xmlnode.betterNormalize();
-		//FIXME: switch focus and anchor, if needed
 		var _position = bxe_getChildPosition(sel.anchorNode);
 		xmlnode.childNodes[_position].splitText(sel.focusOffset);
 		xmlnode.childNodes[_position].splitText(sel.anchorOffset);
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs