r1532 - in branches/bxe_2_0: js mozile

[email protected] Wed, 4 Oct 2006 13:01:51 +0200 (CEST)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Wed Oct  4 13:01:30 2006
New Revision: 1532

Modified:
   branches/bxe_2_0/js/bxeFunctions.js
   branches/bxe_2_0/mozile/mozCE.js
   branches/bxe_2_0/mozile/mozilekb.js
Log:
only textonly copy intern
do not use systemclipboard anymore here


Modified: branches/bxe_2_0/js/bxeFunctions.js
==============================================================================
--- branches/bxe_2_0/js/bxeFunctions.js	(original)
+++ branches/bxe_2_0/js/bxeFunctions.js	Wed Oct  4 13:01:30 2006
@@ -2003,8 +2003,8 @@
 		document.addEventListener("keypress", keyPressHandler, true);
 //key up and down handlers are needed for interapplication copy/paste without having native-methods access
 //if you're sure you have native-methods access you can turn them off
-		document.addEventListener("keydown", keyDownHandler, true);
-		document.addEventListener("keyup", keyUpHandler, true);
+		//document.addEventListener("keydown", keyDownHandler, true);
+		//document.addEventListener("keyup", keyUpHandler, true);
 	}
 }
 

Modified: branches/bxe_2_0/mozile/mozCE.js
==============================================================================
--- branches/bxe_2_0/mozile/mozCE.js	(original)
+++ branches/bxe_2_0/mozile/mozCE.js	Wed Oct  4 13:01:30 2006
@@ -786,7 +786,7 @@
 	
 }
 // creates a hidden form field for interapp copy/paste support without native-method support
-Selection.prototype._createHiddenForm = function() {
+/*Selection.prototype._createHiddenForm = function() {
 		var iframe = document.createElement("div");
 		iframe.setAttribute("ID","ClipboardIFrame");
 		iframe.setAttribute("style","  -moz-user-input: enabled; position: fixed; width: 0px; height: 0px; top: 0px; left: 0px; overflow: hidden; ");
@@ -803,11 +803,11 @@
 		iframe._input = input;
 		return iframe;
 }
-
+*/
 /**
  * copies the selection to the hidden form field on key down
  */
-Selection.prototype.copyKeyDown = function() {
+/*Selection.prototype.copyKeyDown = function() {
 	
 	//copy the selection into the internal clipboard
 	this.copy();
@@ -839,23 +839,20 @@
 	this.addRange(rng);
 	
 }
-
+*/
 /**
  * restores the selection back to what it was before the copy event
  */
-Selection.prototype.copyKeyUp = function() {
+/*Selection.prototype.copyKeyUp = function() {
 	
 	var iframe = document.getElementById("ClipboardIFrame");
 	this.selectEditableRange(iframe._cssr);
-/*	var clipboard = mozilla.getClipboard();
-	clipboard._clipboardText = clipboard._clipboardText.replace(/[\r\n]/g," ");
-*/
 }
-
+*/
 /**
  * sets the focus to the hidden form on a paste key down event
  */
-Selection.prototype.pasteKeyDown = function() {
+/*Selection.prototype.pasteKeyDown = function() {
 	var iframe = document.getElementById("ClipboardIFrame");
 	if (!iframe) {
 		iframe = this._createHiddenForm();
@@ -870,11 +867,11 @@
 
 	iframe._cssr = cssr;
 	iframe._input.focus();
-}
+}*/
 /**
  * pastes the stuff from the hidden form field in to the internal clipboard
  */
-Selection.prototype.pasteKeyUp = function () {
+/*Selection.prototype.pasteKeyUp = function () {
 	
 	var iframe = document.getElementById("ClipboardIFrame");
 	iframe._input.blur();
@@ -942,8 +939,8 @@
 	// paste the content of the internal clipboard
 	this.paste();
 }
-
-Selection.prototype.copy = function()
+*/
+Selection.prototype.copy = function(textOnly)
 {
 	var cssr = this.getXMLFragment();
 
@@ -955,13 +952,17 @@
 
 	var clipboard = mozilla.getClipboard();
 	clipboard._system = false;
-	// clipboard.setData(deletedFragment.saveXML(), "text/html"); // go back to this once, paste supports html paste!
-	clipboard.setData(cssr,MozClipboard.TEXT_FLAVOR);
+	
+	if (textOnly) {
+		clipboard.setData(cssr.toString(),MozClipboard.TEXT_FLAVOR);
+	} else {
+		clipboard.setData(cssr,MozClipboard.TEXT_FLAVOR);
+	}
 }
 
-Selection.prototype.cut = function()
+Selection.prototype.cut = function(textOnly)
 {
-	this.copy();
+	this.copy(textOnly);
 	bxe_history_snapshot();
 	var sel = window.getSelection();
 	bxe_deleteEventKey(sel, false);

Modified: branches/bxe_2_0/mozile/mozilekb.js
==============================================================================
--- branches/bxe_2_0/mozile/mozilekb.js	(original)
+++ branches/bxe_2_0/mozile/mozilekb.js	Wed Oct  4 13:01:30 2006
@@ -74,7 +74,7 @@
 	}
 	return true;
 }
-
+/*
 function keyDownHandler(event)
 {	
 	var handled = false;
@@ -114,7 +114,7 @@
 	}
 	return true;
 }
-
+*/
 function ctrlKeyPressHandler(event)
 {
 	var cssr;
@@ -127,7 +127,9 @@
 		if (event.target.localName == "TEXTAREA") {
 			return false;
 		}
+		return window.getSelection().paste(true);
 		if (mozilla.__allowedNativeCalls) {
+		
 			return window.getSelection().paste();
 		} else {
 			return false;
@@ -149,11 +151,12 @@
 		if (event.target.localName == "TEXTAREA") {
 			return false;
 		}
-		if (mozilla.__allowedNativeCalls) {
+		return window.getSelection().cut(true);
+		/*if (mozilla.__allowedNativeCalls) {
 			return window.getSelection().cut();
 		} else {
 			return false;
-		}
+		}*/
 	}
 	else if(String.fromCharCode(event.charCode).toLowerCase() == "c")
 	{
@@ -161,11 +164,12 @@
 		if (event.target.localName == "TEXTAREA") {
 			return false;
 		}
-		if (mozilla.__allowedNativeCalls) {
+			return window.getSelection().copy(true);
+		/*if (mozilla.__allowedNativeCalls) {
 			return window.getSelection().copy();
-		} else {
+			else {
 			return false;
-		}
+		}*/
 	}
 	else if(String.fromCharCode(event.charCode).toLowerCase() == "s")
 	{
@@ -202,6 +206,7 @@
 	return false;
 }
 
+/*
 function ctrlKeyDownHandler(event,cssr) {
 	
 	if(!event.keyCode)
@@ -286,7 +291,7 @@
 	}
 	return false;
 }
-
+*/
 /**
  * POST04: 
  * - carefully move selectEditableRange in here
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs