r1347 - trunk/js

[email protected]
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Sun Jun 26 13:49:29 2005
New Revision: 1347

Modified:
   trunk/js/bxeFunctions.js
Log:
fix some hidden Exception issues
- Alert user, if he wants to make a list from a eg. title
- Alert user, if he wants to apply sth outside an editable area
Thanks to Michael Wohlfart for the hints

Modified: trunk/js/bxeFunctions.js
==============================================================================
--- trunk/js/bxeFunctions.js	(original)
+++ trunk/js/bxeFunctions.js	Sun Jun 26 13:49:29 2005
@@ -477,6 +477,10 @@
 	if (typeof e.additionalInfo.namespaceURI == "undefined") {
 		e.additionalInfo.namespaceURI = "";
 	}
+	if (cssr == null) {
+		alert("Not possible to use this button. You must select a field to edit first");
+		return false;
+	}	 
 	if (bxe_checkForSourceMode(sel)) {
 		alert("You're in Source Mode. Not possible to use this button");
 		return false;
@@ -1321,6 +1325,22 @@
 	if (bxe_checkForSourceMode(sel)) {
 		return false;
 	}
+	
+		var cssr = sel.getEditableRange();
+
+	if(!cssr) {
+		return;
+	}
+	var lines = cssr.lines;
+	if (lines[0].container.XMLNode.xmlBridge) {
+		alert("You can't change '" + lines[0].container.XMLNode.nodeName + "' to a list");
+		return;
+	}
+	
+	if (lines[0].container.XMLNode.nodeName != "li" && !bxe_checkIsAllowedChildOfNode( XHTMLNS,"ul",lines[0].container.parentNode)) {
+		return;
+	}
+
 	var lines = window.getSelection().toggleListLines("ul", "ol");
 	lines[0].container.updateXMLNode();
 	var li = lines[0].container;
@@ -1347,6 +1367,21 @@
 		return false;
 	}
 	
+	var cssr = sel.getEditableRange();
+
+	if(!cssr) {
+		return;
+	}
+	var lines = cssr.lines;
+	if (lines[0].container.XMLNode.xmlBridge) {
+		alert("You can't change " + lines[0].container.XMLNode.nodeName + " to a list");
+		return;
+	}
+	
+	if (lines[0].container.XMLNode.nodeName != "li" && !bxe_checkIsAllowedChildOfNode( XHTMLNS,"ol",lines[0].container.parentNode)) {
+		return;
+	}
+	
 	var lines = window.getSelection().toggleListLines("ol", "ul");
 
 	lines[0].container.updateXMLNode();
-- 
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.