r1661 - branches/bxe_2_0/js

[email protected] Wed, 25 Apr 2007 10:42:41 +0200 (CEST)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Wed Apr 25 10:42:40 2007
New Revision: 1661

Log:
added callbackCancel for modal widgets
and remove table, if cancel is clicked


Modified:
   branches/bxe_2_0/js/bxeFunctions.js
   branches/bxe_2_0/js/widget.js

Modified: branches/bxe_2_0/js/bxeFunctions.js
==============================================================================
--- branches/bxe_2_0/js/bxeFunctions.js	(original)
+++ branches/bxe_2_0/js/bxeFunctions.js	Wed Apr 25 10:42:40 2007
@@ -1580,6 +1580,12 @@
 			bxe_table_createTableFinish(te,  values["rows"], values["cols"]);
 			bxe_Transform();
 		}
+	}, function() {
+		if (replaceNode && replaceNode._node) {
+			replaceNode._node.parentNode.removeChild(replaceNode._node);
+		}
+		bxe_Transform();
+		
 	});
 	
 	mod.addItem("rows",2,"textfield",bxe_i18n.getText("number of rows"));

Modified: branches/bxe_2_0/js/widget.js
==============================================================================
--- branches/bxe_2_0/js/widget.js	(original)
+++ branches/bxe_2_0/js/widget.js	Wed Apr 25 10:42:40 2007
@@ -428,11 +428,11 @@
 	return this.WidgetGlobals;
 }
 
-Moz.prototype.getWidgetModalBox = function (title, callback) {
+Moz.prototype.getWidgetModalBox = function (title, callback, callbackCancel) {
 	if (this.ModalBox) {
-		this.ModalBox.reset(title,callback);
+		this.ModalBox.reset(title,callback, callbackCancel);
 	} else {
-		this.ModalBox = new Widget_ModalBox(title,callback);
+		this.ModalBox = new Widget_ModalBox(title,callback, callbackCancel);
 	}
 	return this.ModalBox;
 }
@@ -998,11 +998,11 @@
 
 Widget_ModalBox.prototype = new Widget();
 
-function Widget_ModalBox (title, callback) {
-	this.setup(title,callback);
+function Widget_ModalBox (title, callback, callbackCancel) {
+	this.setup(title,callback, callbackCancel);
 }
 
-Widget_ModalBox.prototype.setup = function (title, callback ) {
+Widget_ModalBox.prototype.setup = function (title, callback, callbackCancel ) {
 	this.doCancel = false;
 
 	this.node = this.initNode("div","ModalBox");
@@ -1013,10 +1013,10 @@
 		this.initTitle(title);
 	}
 	this.initPane();
-	this.reset(title, callback);
+	this.reset(title, callback,callbackCancel);
 }
 
-Widget_ModalBox.prototype.reset = function (title, callback) {
+Widget_ModalBox.prototype.reset = function (title, callback, callbackCancel) {
 	this.doCancel = false;
 	if (this.PaneNode.hasChildNodes()) {
 		this.PaneNode.removeAllChildren();
@@ -1024,6 +1024,7 @@
 	this.hasTable = false;
 	this.hasForm = false;
 	this.callback = callback;
+	this.callbackCancel = callbackCancel;
 	if (title) {
 		this.setTitle(title);
 	}
@@ -1212,7 +1213,9 @@
 					var sel = window.getSelection();
 					sel.selectEditableRange(e.target.Widget.cssr);
 				}
-	
+				if (e.target.Widget.callbackCancel) {
+					e.target.Widget.callbackCancel();
+				}
 				e.target.Widget.hide();
 			}, false);
 			this.hasTable.parentNode.appendChild(cancel);
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs