r1618 - branches/bxe_2_0/js

[email protected] Thu, 9 Nov 2006 06:58:21 +0100 (CET)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Thu Nov  9 06:58:20 2006
New Revision: 1618

Modified:
   branches/bxe_2_0/js/bxeFunctions.js
Log:
some more selection fixes

Modified: branches/bxe_2_0/js/bxeFunctions.js
==============================================================================
--- branches/bxe_2_0/js/bxeFunctions.js	(original)
+++ branches/bxe_2_0/js/bxeFunctions.js	Thu Nov  9 06:58:20 2006
@@ -2159,7 +2159,14 @@
 	var sel = window.getSelection();
 	if (sel && sel.anchorNode) {
 		var _topId = bxe_getBxeId(sel.anchorNode.parentNode);
-	}
+		if (sel.anchorNode.parentNode.hasAttribute("__bxe_attribute")) {
+			var _topAttr = sel.anchorNode.parentNode.getAttribute("__bxe_attribute");
+		} else {
+			var _topAttr = null;
+		}
+	} 
+	
+	
 	var _childPosition = bxe_getChildPosition(sel.anchorNode);
 	var _offset =sel.anchorOffset;
 	
@@ -2216,10 +2223,10 @@
 	//bxe_config.xmldoc.insertIntoHTMLDocument();
 	//dump ("insertIntoHTMLDocument " + (new Date() - startTimer)/1000 + " sec\n");
 	if (_topId) {
-		var _topNode = bxe_getHTMLNodeByBxeId(_topId);
+		
+		var _topNode = bxe_getHTMLNodeByBxeId(_topId,_topAttr);
 	}
 	//var ip = documentCreateInsertionPoint(_topNode, _topNode.childNodes[_childPosition], _offset);
-		
 	if (typeof xpath == "string") {
 		var _node = bxe_getHTMLNodeByBxeId(xpath);
 		sel = window.getSelection();
@@ -2314,8 +2321,12 @@
 	return node.getAttribute("__bxe_id");
 }
 
-function bxe_getHTMLNodeByBxeId(bxe_id) {
-	return document.evaluate("//*[@__bxe_id = '" + bxe_id + "']", document, null, XPathResult.ANY_UNORDERED_NODE_TYPE,null).singleNodeValue;
+function bxe_getHTMLNodeByBxeId(bxe_id, bxe_attr) {
+	if (bxe_attr) {
+		return document.evaluate("//*[@__bxe_id = '" + bxe_id + "' and @__bxe_attribute = '" + bxe_attr + "']", document, null, XPathResult.ANY_UNORDERED_NODE_TYPE,null).singleNodeValue;
+	} else {
+		return document.evaluate("//*[@__bxe_id = '" + bxe_id + "']", document, null, XPathResult.ANY_UNORDERED_NODE_TYPE,null).singleNodeValue;
+	}
 }
 
 function bxe_getChildPosition(node) {
@@ -2352,6 +2363,7 @@
 					node.XMLNode = _existingNode.getXMLNode();
 				}
 				node.XMLNode._htmlnode = node;
+				
 				if (node.XMLNode.vdom && node.XMLNode.vdom.bxeNoteditable) {
 					node.removeAttribute("__bxe_id");
 				} else {
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs