r1782 - branches/bxe_2_0/js

[email protected] Mon, 12 Nov 2007 17:07:17 +0100 (CET)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Mon Nov 12 17:07:17 2007
New Revision: 1782

Log:
fix BXEB-42
show move/up/down for table cells


Modified:
   branches/bxe_2_0/js/bxeFunctions.js

Modified: branches/bxe_2_0/js/bxeFunctions.js
==============================================================================
--- branches/bxe_2_0/js/bxeFunctions.js	(original)
+++ branches/bxe_2_0/js/bxeFunctions.js	Mon Nov 12 17:07:17 2007
@@ -847,52 +847,15 @@
 		previousSibling = previousSibling.previousSibling;
 	}
 	
-	if (previousSibling) {
-		var _t = "Move up";
-		if (node.vdom.bxeTabletype == "table-cell" || node.vdom.bxeTabletype == "table-col") {
-			var _t = "Move cell left";
-		}
-		popup.addMenuItem(bxe_i18n.getText(_t), function (e) {
-			var widget = e.currentTarget.Widget;
-			var appNode = widget.MenuPopup.MainNode;
-			bxe_moveUp(appNode);
-		});
-		if (previousSibling.vdom.bxeTabletype == "table-cell" || previousSibling.vdom.bxeTabletype == "table-col" ) {
-					var menui = popup.addMenuItem(bxe_i18n.getText("Move column left"), function(e) {
-				var widget = e.currentTarget.Widget;
-				var _par = widget.MenuPopup.MainNode._node.parentNode;
-				widget.MenuPopup.MainNode._node.TableCellMoveLeft();
-				bxe_Transform(true,false,widget.MenuPopup.MainNode.parentNode);
-			});
-		}
-		
-	}
 	var nextSibling = node.nextSibling;
 	while (nextSibling && nextSibling.nodeType != 1) {
 		nextSibling = nextSibling.nextSibling;
 	}
-	if (nextSibling) {
-		var _t = "Move down";
-		if (node.vdom.bxeTabletype == "table-cell" || node.vdom.bxeTabletype == "table-col") {
-			var _t = "Move cell right";
-		}
-		
-		popup.addMenuItem(bxe_i18n.getText(_t), function (e) {
-			var widget = e.currentTarget.Widget;
-			var appNode = widget.MenuPopup.MainNode;
-			bxe_moveDown(appNode);
-		});
-		if (nextSibling.vdom && (nextSibling.vdom.bxeTabletype == "table-cell" || nextSibling.vdom.bxeTabletype == "table-col" )) {
-					var menui = popup.addMenuItem(bxe_i18n.getText("Move column right"), function(e) {
-				var widget = e.currentTarget.Widget;
-				var _par = widget.MenuPopup.MainNode._node.parentNode;
-				widget.MenuPopup.MainNode._node.TableCellMoveRight();
-				bxe_Transform(true,false,widget.MenuPopup.MainNode.parentNode);
-			});
-		}
+	if (! (node.vdom.bxeTabletype &&  node.vdom.bxeTabletype == "table-cell" || node.vdom.bxeTabletype == "table-col")) {
+	
+		bxe_doMoveUpDownMenu(node,popup,e,previousSibling, nextSibling, false);
 	}
 	
-
 	if (node.vdom.bxeMenuentry) {
 		popup.addSeparator();
 		var _entries = node.vdom.bxeMenuentry;
@@ -918,6 +881,7 @@
 
 	if (node.vdom.bxeTabletype && (node.vdom.bxeTabletype == "table-cell" || node.vdom.bxeTabletype == "table-col" )) {
 		popup.addSeparator(" Table Editing ");
+		bxe_doMoveUpDownMenu(node,popup,e,previousSibling, nextSibling, true);
 		//split
 		if (node._node.getAttribute("colspan") > 1) {
 		var menui = popup.addMenuItem(bxe_i18n.getText("Split right"), function(e) {
@@ -1004,6 +968,51 @@
 	popup.MainNode = node;
 	} catch (e) { bxe_catch_alert(e);}
 }
+		
+function bxe_doMoveUpDownMenu(node,popup,e,previousSibling,nextSibling,table) {
+	if (previousSibling) {
+		if (table) {
+			var _t = "Move cell left";
+		} else {
+			var _t = "Move up";
+		}
+		popup.addMenuItem(bxe_i18n.getText(_t), function (e) {
+			var widget = e.currentTarget.Widget;
+			var appNode = widget.MenuPopup.MainNode;
+			bxe_moveUp(appNode);
+		});
+		if (table && previousSibling.vdom.bxeTabletype == "table-cell" || previousSibling.vdom.bxeTabletype == "table-col" ) {
+				var menui = popup.addMenuItem(bxe_i18n.getText("Move column left"), function(e) {
+				var widget = e.currentTarget.Widget;
+				var _par = widget.MenuPopup.MainNode._node.parentNode;
+				widget.MenuPopup.MainNode._node.TableCellMoveLeft();
+				bxe_Transform(true,false,widget.MenuPopup.MainNode.parentNode);
+			});
+		}
+		
+	}
+	if (nextSibling) {
+		if (table) {
+			var _t = "Move cell right";
+		} else {
+			var _t = "Move down";
+		}
+		popup.addMenuItem(bxe_i18n.getText(_t), function (e) {
+			var widget = e.currentTarget.Widget;
+			var appNode = widget.MenuPopup.MainNode;
+			bxe_moveDown(appNode);
+		});
+		if (table && nextSibling.vdom && (nextSibling.vdom.bxeTabletype == "table-cell" || nextSibling.vdom.bxeTabletype == "table-col" )) {
+					var menui = popup.addMenuItem(bxe_i18n.getText("Move column right"), function(e) {
+				var widget = e.currentTarget.Widget;
+				var _par = widget.MenuPopup.MainNode._node.parentNode;
+				widget.MenuPopup.MainNode._node.TableCellMoveRight();
+				bxe_Transform(true,false,widget.MenuPopup.MainNode.parentNode);
+			});
+		}
+	}
+	
+}
 
 function bxe_NodeChanged(e) {
 
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs