r1500 - in branches/bxe_2_0: js mozile relaxng

[email protected] Mon, 5 Jun 2006 18:23:35 +0200 (CEST)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Mon Jun  5 18:23:33 2006
New Revision: 1500

Modified:
   branches/bxe_2_0/js/bxeFunctions.js
   branches/bxe_2_0/mozile/mozCE.js
   branches/bxe_2_0/relaxng/RelaxNG.js
Log:
onempty possibillity


Modified: branches/bxe_2_0/js/bxeFunctions.js
==============================================================================
--- branches/bxe_2_0/js/bxeFunctions.js	(original)
+++ branches/bxe_2_0/js/bxeFunctions.js	Mon Jun  5 18:23:33 2006
@@ -678,17 +678,22 @@
 	if (clip._clipboard) {
 		var _clipboardNodeName = "";
 		var _clipboardNamespaceUri = "";
-		if (clip._clipboard.firstChild) {
+		var _textOnly  = "";
+		
+		if (clip._clipboard.firstChild && clip._clipboard.firstChild.nodeType == 1)  {
 			_clipboardNodeName = clip._clipboard.firstChild.nodeName;
 			_clipboardNamespaceUri = clip._clipboard.firstChild.namespaceURI;
-		} else {
+		} else if (clip._clipboard.nodeType == 1) {
 			_clipboardNodeName = clip._clipboard.nodeName;
 			_clipboardNamespaceUri = XHTMLNS;
-		}
-		if (!_clipboardNamespaceUri) { _clipboardNamespaceUri = ""};
-		if (node.parentNode && node.parentNode.isAllowedChild(_clipboardNamespaceUri, _clipboardNodeName)) {
-			
+		} /* else if (clip._clipboard.firstChild && clip._clipboard.firstChild.nodeType == 3) {
+			_textOnly = clip._clipboard.firstChild.data;
+		} else if (clip._clipboard.nodeType == 3) {
+			_textOnly = clip._clipboard.data;
+		} */
 			
+		if (!_clipboardNamespaceUri) { _clipboardNamespaceUri = ""};
+		if (_clipboardNodeName && node.parentNode && node.parentNode.isAllowedChild(_clipboardNamespaceUri, _clipboardNodeName)) {
 			popup.addMenuItem(bxe_i18n.getText("Append {0} from Clipboard",new Array(_clipboardNodeName)), function (e) {
 				var widget = e.currentTarget.Widget;
 				var appNode = widget.MenuPopup.MainNode;
@@ -697,7 +702,14 @@
 				eDOMEventCall("appendNode",document,{"appendToNode":appNode, "node": clipNode})
 				
 			});
-		}
+		} /* else if (_textOnly) {
+			popup.addMenuItem(bxe_i18n.getText("Insert Text from Clipboard"), function (e) {
+				var sel = window.getSelection();
+				sel.paste();
+				
+			});
+			
+		}*/
 	}
 	
 	popup.addMenuItem(bxe_i18n.getText("Delete {0} Element",new Array(node.vdom.bxeName)), function (e) {
@@ -2523,4 +2535,24 @@
 function html_get_current_XMLNode(element) {
 
 return element.getParentWithXMLNode().XMLNode;
+}
+
+function bxe_onEmptyAddDefaultContent(node) {
+	if (node.vdom.bxeDefaultcontent) {
+		node.setContent(node.vdom.bxeDefaultcontent);
+	} else {
+		node.setContent("#" + node.nodeName);
+	}
+	node._node.setAttribute("__bxe_defaultcontent","true");
+	bxe_Transform();
+	
+	var sel = window.getSelection();
+	var _htmlnode = node._htmlnode; 
+	
+	sel.collapse(_htmlnode.firstChild,0);
+	sel.extend(_htmlnode.firstChild,_htmlnode.firstChild.length);
+	this.lastDefaultContent = _htmlnode;
+				
+	return true;
+	
 }
\ No newline at end of file

Modified: branches/bxe_2_0/mozile/mozCE.js
==============================================================================
--- branches/bxe_2_0/mozile/mozCE.js	(original)
+++ branches/bxe_2_0/mozile/mozCE.js	Mon Jun  5 18:23:33 2006
@@ -213,6 +213,12 @@
 				} else {
 					var parpar = par.parentNode;
 					var nextSibling = par.nextSibling;
+					if (par.XMLNode.vdom.bxeOnempty && par.XMLNode.vdom.bxeOnemptyType == "function") {
+						if (eval(par.XMLNode.vdom.bxeOnempty + "(par.XMLNode)")) {
+							return true;
+						}
+					} 
+				
 					if (! (par.XMLNode.vdom.bxeTabletype == "table-cell" || par.XMLNode.vdom.bxeTabletype == "table-col" )){
 						parpar.removeChild(par);
 					}
@@ -225,8 +231,10 @@
 				}
 				parpar.normalize();
 				var _h = par.XMLNode._htmlnode;
+				
 				var _pref = _h.previousSibling;
 				_h.parentNode.removeChild(_h);
+				
 				if (_pref && _pref.nodeType == 1) {_pref = _pref.lastChild;}
 				if (_pref && _pref.nodeValue) {
 					sel.collapse(_pref,_pref.nodeValue.length);
@@ -235,7 +243,6 @@
 				}
 				
 				sel.collapseToStart();
-				
 				bxe_Transform();
 				return;
 				

Modified: branches/bxe_2_0/relaxng/RelaxNG.js
==============================================================================
--- branches/bxe_2_0/relaxng/RelaxNG.js	(original)
+++ branches/bxe_2_0/relaxng/RelaxNG.js	Mon Jun  5 18:23:33 2006
@@ -440,6 +440,10 @@
 					this.bxeOnnewType = childNodes[i].getAttribute("type");
 					this.bxeOnnew = childNodes[i].firstChild.data;
 					break;
+				case "onempty":
+					this.bxeOnemptyType = childNodes[i].getAttribute("type");
+					this.bxeOnempty = childNodes[i].firstChild.data;
+					break;
 				case "dontshow":
 					this.bxeDontshow = true;
 					break;
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs