r1446 - in branches/bxe_2_0: mozile plugins

[email protected]
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Mon Jan 16 16:14:54 2006
New Revision: 1446

Modified:
   branches/bxe_2_0/mozile/mozWrappers.js
   branches/bxe_2_0/plugins/ServerClipboard.js
Log:
added removeAttributeOnCopy option


Modified: branches/bxe_2_0/mozile/mozWrappers.js
==============================================================================
--- branches/bxe_2_0/mozile/mozWrappers.js	(original)
+++ branches/bxe_2_0/mozile/mozWrappers.js	Mon Jan 16 16:14:54 2006
@@ -252,11 +252,23 @@
 		this._clipboardText = data.data;
 	} else {
 	//copy the selection to the internal clipboard
-		if (data.nodeType == 11) {
+		if (data.nodeType == 11) { //DOCUMENT_FRAGEMENT
 			this._clipboard = data;
 			this._clipboardText = data.saveXML()
 		} else {
 			this._clipboard = data.cloneContents();
+			var removeAttr = bxe_config.options['removeAttributeOnCopy'];
+			if (removeAttr) {
+				var res = this._clipboard.ownerDocument.evaluate(".//@"+removeAttr, this._clipboard.firstChild , null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
+				var _l = res.snapshotLength;
+				for (var i = 0; i < _l; i++) {
+					if (res.snapshotItem(i).ownerElement) {
+						res.snapshotItem(i).ownerElement.removeAttributeNode(res.snapshotItem(i));
+					}
+				}
+			}
+		
+			
 	//to allow easier comparing of system and internal clipboard, store the plaintext in this variable
 			this._clipboardText = data.toString();
 		}

Modified: branches/bxe_2_0/plugins/ServerClipboard.js
==============================================================================
--- branches/bxe_2_0/plugins/ServerClipboard.js	(original)
+++ branches/bxe_2_0/plugins/ServerClipboard.js	Mon Jan 16 16:14:54 2006
@@ -54,6 +54,17 @@
 			var td = new mozileTransportDriver("http");
 			var newnode = mnode._node.cloneNode(true);
 			newnode.removeBxeIds();
+			//remove internal ids
+			var removeAttr = bxe_config.options['removeAttributeOnCopy'];
+			if (removeAttr) {
+				var res = newnode.ownerDocument.evaluate(".//@"+removeAttr, newnode , null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
+				var _l = res.snapshotLength;
+				for (var i = 0; i < _l; i++) {
+					if (res.snapshotItem(i).ownerElement) {
+						res.snapshotItem(i).ownerElement.removeAttributeNode(res.snapshotItem(i));
+					}
+				}
+			}
 			var nodestring = newnode.saveXML();
 			bxe_config.ServerClipboard.clipNode = newnode;
 			td.url = url;
-- 
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.