r1580 - branches/bxe_2_0/js

[email protected] Thu, 26 Oct 2006 13:40:23 +0200 (CEST)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Thu Oct 26 13:40:22 2006
New Revision: 1580

Modified:
   branches/bxe_2_0/js/bxeFunctions.js
Log:
fix cursor position on delete

Modified: branches/bxe_2_0/js/bxeFunctions.js
==============================================================================
--- branches/bxe_2_0/js/bxeFunctions.js	(original)
+++ branches/bxe_2_0/js/bxeFunctions.js	Thu Oct 26 13:40:22 2006
@@ -732,7 +732,21 @@
 		bxe_history_snapshot();
 		
 		var par = delNode.parentNode
+		try {
+			var _prev = delNode._htmlnode.previousSibling;
+			var sel = window.getSelection();
+			var _pos = 0;
+			
+			if (_prev) {
+				_pos = _prev.nodeValue.length;
+				sel.collapse(_prev,_pos);
+			} else {
+				sel.collapse(par._htmlnode.firstChild,0);
+			}
+		} catch(e) {
+		}
 		delNode.unlink();
+		
 		bxe_Transform(false,false,par);
 	},bxe_i18n.getText("Deletes the Element and all its children"));
 	
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs