r1781 - branches/bxe_2_0/mozile

[email protected] Mon, 12 Nov 2007 13:57:43 +0100 (CET)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Mon Nov 12 13:57:42 2007
New Revision: 1781

Log:
fix for BXEB-53
try to improve whitespace handling


Modified:
   branches/bxe_2_0/mozile/mozCE.js

Modified: branches/bxe_2_0/mozile/mozCE.js
==============================================================================
--- branches/bxe_2_0/mozile/mozCE.js	(original)
+++ branches/bxe_2_0/mozile/mozCE.js	Mon Nov 12 13:57:42 2007
@@ -431,16 +431,23 @@
 	}
 	
 	//this.selectEditableRange(cssr);
-	
+	var _posAnchor = null;
 	if ( this.focusNode.nodeValue.substr(this.focusOffset,1) == " ") {
 		 _posPlus = this.anchorOffset;
+		 _posAnchor = this.anchorNode;
 	} else if (this.focusOffset >= this.focusNode.length && this.focusNode.nodeValue.substr(this.focusNode.length -1 ,1) == " ") {
 		_posPlus = this.focusNode.length;
+	} else if (this.anchorOffset == 0) {
+		_posPlus = 0;	
 	}
 	this.removeAllRanges();
 	this.addRange(cssr.cloneRange());
-	if (_posPlus) {
-        this.collapse(this.anchorNode, _posPlus );
+	if (typeof _posPlus == 'number') {
+		if (_posAnchor) {
+				this.collapse(_posAnchor, _posPlus );
+		} else {
+        	this.collapse(this.anchorNode, _posPlus );
+		}
 	}
 	if (doTransform) {
 		
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs