r1405 - in trunk: js relaxng

[email protected]
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Tue Oct  4 18:34:10 2005
New Revision: 1405

Modified:
   trunk/js/bxeFunctions.js
   trunk/relaxng/NodeVAL.js
Log:
do undo after validation error where it makes sense



Modified: trunk/js/bxeFunctions.js
==============================================================================
--- trunk/js/bxeFunctions.js	(original)
+++ trunk/js/bxeFunctions.js	Tue Oct  4 18:34:10 2005
@@ -205,8 +205,10 @@
 			} catch(e) {
 				bxe_catch_alert(e);
 			}
+			return true;
 		}
 	} 
+	return false;
 	/*bxe_snapshots[bxe_snapshots_position] == xmlstr;
 	bxe_snapshots_position++;*/
 }
@@ -916,7 +918,7 @@
 					var newNode = _child.init();
 					aNode.parentNode.insertAfter(newNode,aNode);
 					newNode._node.updateXMLNode();
-					newNode.parentNode.isNodeValid(true,2);
+					newNode.parentNode.isNodeValid(true,2,false,true);
 				} 
 				_child = _next;
 			}
@@ -933,7 +935,7 @@
 			
 			aNode.parentNode.insertAfter(newNode,aNode);
 			newNode._node.updateXMLNode();
-			newNode.parentNode.isNodeValid(true,2);
+			newNode.parentNode.isNodeValid(true,2,false,true);
 		}
 	} else {
 		var cb = bxe_getCallback(e.additionalInfo.localName,e.additionalInfo.namespaceURI);
@@ -947,8 +949,7 @@
 		var newNode = new XMLNodeElement(e.additionalInfo.namespaceURI,e.additionalInfo.localName, 1 ) ;
 		
 		aNode.parentNode.insertAfter(newNode,aNode);
-		
-		newNode.parentNode.isNodeValid(true,2);
+		newNode.parentNode.isNodeValid(true,2,false,true);
 		// looks like not needed, not sure...
 		//newNode._node.parentNode.insertBefore(newNode._node.ownerDocument.createTextNode(" "),newNode._node);
 		
@@ -973,7 +974,7 @@
 		var aNode = e.additionalInfo.appendToNode;
 		var newNode = new XMLNodeElement(e.additionalInfo.namespaceURI,e.additionalInfo.localName, 1 ) ;
 		aNode.appendChild(newNode);
-		debug("valid? : " + newNode.isNodeValid());
+		newNode.parentNode.isNodeValid(true,2,false,true);
 		var cb = bxe_getCallback(e.additionalInfo.localName, e.additionalInfo.namespaceURI);
 		if (cb ) {
 			bxe_doCallback(cb, newNode);
@@ -1019,9 +1020,7 @@
 		} catch(e) {alert(newContainer[i] + " can't be updateXMLNode()'ed\n" + e);
 		}
 	}
-	if (!newContainer[0].XMLNode.parentNode.isNodeValid(false, 2)) {
-		bxe_history_undo();
-	}
+	newContainer[0].XMLNode.parentNode.isNodeValid(false, 2,false,true);
 	bxe_history_snapshot_async();
 	bxe_delayedUpdateXPath();
 }
@@ -1574,7 +1573,7 @@
 			te.setAttribute("class", bxe_config.options[OPTION_DEFAULTTABLECLASS]);
 			var newNode = te.init();
 			window.bxe_ContextNode.parentNode.insertAfter(newNode, window.bxe_ContextNode);
-			debug("valid? : " + newNode.isNodeValid());
+			newNode.isNodeValid();
 		}
 	});
 	mod.addItem("rows",2,"textfield","number of rows");
@@ -2053,8 +2052,9 @@
 		
 		replaceNode.parentNode.insertAfter(newNode,replaceNode);
 		newNode._node.updateXMLNode();
+		newNode.isNodeValid(true,2,false,true);
 		bxe_history_snapshot_async();
-		debug("valid? : " + newNode.isNodeValid());
+		
 	} else {
 		docfrag.firstChild.init();
 		var sel= window.getSelection();

Modified: trunk/relaxng/NodeVAL.js
==============================================================================
--- trunk/relaxng/NodeVAL.js	(original)
+++ trunk/relaxng/NodeVAL.js	Tue Oct  4 18:34:10 2005
@@ -20,7 +20,7 @@
 
 const BXE_VALID_NOMESSAGE = 1;
 
-XMLNode.prototype.isNodeValid = function(deep, wFValidityCheckLevel, noError ) {
+XMLNode.prototype.isNodeValid = function(deep, wFValidityCheckLevel, noError, undo ) {
 	if ( this._node && this._node._SourceMode == true) {
 		return true;
 	}
@@ -39,7 +39,9 @@
 				bxe_validationAlert(c.errormsg);
 			}
 		} 
-			
+		if (undo) {
+			bxe_history_undo();
+		}
 		return false;
 	} else {
 		return true;
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.