GUAC-1480: Remove use of "Allow Clipboard" extension.

Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/ca20d6a1
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/ca20d6a1
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/ca20d6a1

Branch: refs/heads/master
Commit: ca20d6a17d7b4ff8defb093caf0182e6ce16d366
Parents: b361168
Author: Michael Jumper <[email protected]>
Authored: Wed Feb 3 16:53:13 2016 -0800
Committer: Michael Jumper <[email protected]>
Committed: Wed Feb 3 16:53:13 2016 -0800

----------------------------------------------------------------------
 .../app/client/services/clipboardService.js     | 70 +++++---------------
 1 file changed, 16 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/ca20d6a1/guacamole/src/main/webapp/app/client/services/clipboardService.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/client/services/clipboardService.js 
b/guacamole/src/main/webapp/app/client/services/clipboardService.js
index 7880159..8013771 100644
--- a/guacamole/src/main/webapp/app/client/services/clipboardService.js
+++ b/guacamole/src/main/webapp/app/client/services/clipboardService.js
@@ -77,34 +77,15 @@ angular.module('client').factory('clipboardService', 
['$injector',
 
         var deferred = $q.defer();
 
-        // First, see if allow clipboard extension is installed
-        if (window.AllowClipboard) {
+        // Copy the given value into the clipboard DOM element
+        clipboardContent.value = text;
+        clipboardContent.select();
 
-            var clipboardClient = new AllowClipboard.Client.ClipboardClient();
-
-            clipboardClient.write(text, function(success) {
-                if (success)
-                    deferred.resolve();
-                else
-                    deferred.reject();
-            });
-
-        }
-
-        // Otherwise, try execCommand
-        else {
-
-            // Copy the given value into the clipboard DOM element
-            clipboardContent.value = text;
-            clipboardContent.select();
-
-            // Attempt to copy data from clipboard element into local clipboard
-            if (document.execCommand('copy'))
-                deferred.resolve();
-            else
-                deferred.reject();
-
-        }
+        // Attempt to copy data from clipboard element into local clipboard
+        if (document.execCommand('copy'))
+            deferred.resolve();
+        else
+            deferred.reject();
 
         return deferred.promise;
     };
@@ -121,34 +102,15 @@ angular.module('client').factory('clipboardService', 
['$injector',
 
         var deferred = $q.defer();
 
-        // First, see if allow clipboard extension is installed
-        if (window.AllowClipboard) {
-
-            var clipboardClient = new AllowClipboard.Client.ClipboardClient();
-
-            clipboardClient.read(function(success, data) {
-                if (success)
-                    deferred.resolve(data);
-                else
-                    deferred.reject();
-            });
-
-        }
-
-        // Otherwise, try execCommand
-        else {
-
-            // Clear and select the clipboard DOM element
-            clipboardContent.value = '';
-            clipboardContent.select();
-
-            // Attempt paste local clipboard into clipboard DOM element
-            if (document.execCommand('paste'))
-                deferred.resolve(clipboardContent.value);
-            else
-                deferred.reject();
+        // Clear and select the clipboard DOM element
+        clipboardContent.value = '';
+        clipboardContent.select();
 
-        }
+        // Attempt paste local clipboard into clipboard DOM element
+        if (document.execCommand('paste'))
+            deferred.resolve(clipboardContent.value);
+        else
+            deferred.reject();
 
         return deferred.promise;
     };

Reply via email to