r1573 - branches/bxe_2_0/mozile

[email protected] Tue, 24 Oct 2006 17:29:56 +0200 (CEST)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Tue Oct 24 17:29:55 2006
New Revision: 1573

Modified:
   branches/bxe_2_0/mozile/mozCE.js
Log:
fix focus on getXMLFragment

Modified: branches/bxe_2_0/mozile/mozCE.js
==============================================================================
--- branches/bxe_2_0/mozile/mozCE.js	(original)
+++ branches/bxe_2_0/mozile/mozCE.js	Tue Oct 24 17:29:55 2006
@@ -1072,6 +1072,7 @@
 Selection.prototype.getXMLFragment = function() {
 	
 	var docfrag = bxe_config.xmldoc.createDocumentFragment();
+	this.fixFocus();
 	if (this.anchorNode != this.focusNode) {
 		var xmlnode = bxe_getXMLNodeByHTMLNode(this.anchorNode.parentNode);
 		
@@ -1115,3 +1116,13 @@
 	this.addRange(cssr.cloneRange());
 	}	
 }
+
+Selection.prototype.fixFocus = function() {
+	if ((!this.isCollapsed && this.focusNode.nodeType == 3 && this.focusNode.compareDocumentPosition(this.anchorNode) & 4) ||
+			(this.focusNode == this.anchorNode && this.focusOffset < this.anchorOffset) ) {
+			var n = this.anchorNode;
+			var o = this.anchorOffset;
+			this.collapse(this.focusNode, this.focusOffset)
+			this.extend(n,o);
+		}
+}
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs