r1563 - branches/bxe_2_0/js

[email protected] Sun, 22 Oct 2006 22:06:35 +0200 (CEST)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Sun Oct 22 22:06:33 2006
New Revision: 1563

Modified:
   branches/bxe_2_0/js/bxeFunctions.js
Log:
works also for first element

Modified: branches/bxe_2_0/js/bxeFunctions.js
==============================================================================
--- branches/bxe_2_0/js/bxeFunctions.js	(original)
+++ branches/bxe_2_0/js/bxeFunctions.js	Sun Oct 22 22:06:33 2006
@@ -1736,11 +1736,14 @@
 	}
 	if (textContainer.parentNode == null) {
 		var _prev = sel.anchorNode.parentNode.previousSibling;
-			var sel = window.getSelection();
+		var sel = window.getSelection();
 		var _pos = 0;
+		
 		if (_prev) {
 			_pos = _prev.nodeValue.length;
 			sel.collapse(_prev,_pos);
+		} else {
+			sel.collapse(sel.anchorNode.parentNode.parentNode.firstChild,0);
 		}
 	}
 	bxe_Transform();
@@ -2308,11 +2311,9 @@
 	if (typeof xpath == "string") {
 		var _node = bxe_getHTMLNodeByBxeId(xpath);
 		sel = window.getSelection();
-		console.log(_node);
 		// the selection stuff does not always work
 		if (_node) {
 			try {
-				console.log(position);
 				if (position == "select") {
 					sel.collapse(_node.firstChild,0);
 					sel.extend(_node.firstChild,_node.firstChild.length);
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs