merge change from alexiskander
authorKevin Dangoor <kdangoor@mozilla.com>
Fri, 18 Sep 2009 11:30:19 -0400
changeset 2671 90f1efe632b2c53351da8828c5e813421bc502f3
parent 2667 52883c04c34088978399cc6ba9f9fafe85851105 (current diff)
parent 2670 1a6cdb90863a18576870599decf0d3d948eeedac (diff)
child 2674 1b5e2cab3a70e40c5c7700cf1dc83870cd6ee827
push id1131
push userkdangoor@mozilla.com
push dateFri, 18 Sep 2009 15:31:56 +0000
merge change from alexiskander
--- a/frontend/js/bespin/bespin.js
+++ b/frontend/js/bespin/bespin.js
@@ -58,17 +58,17 @@ dojo.mixin(bespin, {
     /** Holds the timeouts so they can be cleared later */
     _lazySubscriptionTimeout: {},
 
     /**
      * Given a topic and a set of parameters, publish onto the bus.
      * maps onto dojo.publish but lets us abstract away for the future
      */
     publish: function(topic, args) {
-        if (window.globalStorage && window.globalStorage[location.hostname].debug) {
+        if (window.globalStorage && window.globalStorage[location.hostname] && window.globalStorage[location.hostname].debug) {
             console.log("Publish", topic, args);
         }
 
         bespin._eventLog[topic] = true;
         dojo.publish("bespin:" + topic, dojo.isArray(args) ? args : [ args || {} ]);
     },
 
     /**
--- 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 != '') {