branch closing merge
authorKevin Dangoor <kdangoor@mozilla.com>
Fri, 18 Sep 2009 11:36:02 -0400
changeset 2675 d9b0e4a98011bb32f5119e6ea2d4a530c00b3f98
parent 2674 1b5e2cab3a70e40c5c7700cf1dc83870cd6ee827 (diff)
parent 2673 19af29d3d2f9bcb04a5ebba2403ac1f5f09f69c5 (current diff)
child 2677 baa88ee2c67e86d79b10ad0584675c390dcc54e2
push id1132
push userkdangoor@mozilla.com
push dateFri, 18 Sep 2009 15:42:41 +0000
branch closing merge
--- a/frontend/js/bespin/editor/clipboard.js
+++ b/frontend/js/bespin/editor/clipboard.js
@@ -90,17 +90,17 @@ dojo.mixin(bespin.editor.clipboard, {
 
 dojo.declare("bespin.editor.clipboard.DOMEvents", null, {
     install: function(editor) {
         // * Defensively stop doing copy/cut/paste magic if you are in the command line
         var stopAction = function(e) {
             return e.target.id == "command";
         };
         var editorHasFocus = function() { 
-            return true;
+            return editor.focus;
         };
         
         var focuser = this.focuser = bespin.editor.clipboard.createHiddenTextarea();
         var onfocuser = false;
         
         // Copy
         this.beforecopyHandle = dojo.connect(document.body, "onbeforecopy", function(e) {
             if ((!editorHasFocus() && !onfocuser) || stopAction(e)) return;
@@ -111,17 +111,17 @@ dojo.declare("bespin.editor.clipboard.DO
             focuser.focus();
             focuser.select();
             
             // and we are now on focuser
             onfocuser = true;
         });
 
         this.copyHandle = dojo.connect(document.body, "oncopy", function(e) {
-            if (!editorHasFocus() && !onFocuser) return;
+            if (!editorHasFocus() && !onfocuser) return;
             if (stopAction(e)) return;
             
             var selectionText = editor.getSelectionAsText();
             if (selectionText && selectionText != '') {
                 e.clipboardData.setData('text/plain', selectionText);
                 dojo.stopEvent(e); // need a full stop, otherwise someone else will try to set copy data.
             }
 
@@ -139,17 +139,17 @@ dojo.declare("bespin.editor.clipboard.DO
             focuser.focus();
             focuser.select();
             
             // and we are now on focuser
             onfocuser = true;
         });
 
         this.cutHandle = dojo.connect(document, "cut", function(e) {
-            if (!editorHasFocus() && !onFocuser) return;
+            if (!editorHasFocus() && !onfocuser) return;
             if (stopAction(e)) return;
 
             var selectionObject = editor.getSelection();
 
             if (selectionObject) {
                 var selectionText = editor.model.getChunk(selectionObject);
 
                 if (selectionText && selectionText != '') {