You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/05/03 08:46:18 UTC
[1/2] guacamole-client git commit: GUACAMOLE-559: Add support for
reading/writing clipboard contents using the Asynchronous Clipboard API.
Repository: guacamole-client
Updated Branches:
refs/heads/master 8181a9606 -> 91f19b2e0
GUACAMOLE-559: Add support for reading/writing clipboard contents using the Asynchronous Clipboard API.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/61996327
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/61996327
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/61996327
Branch: refs/heads/master
Commit: 619963277dd325745575a9f4332ab355618e2827
Parents: 8181a96
Author: Michael Jumper <mj...@apache.org>
Authored: Wed May 2 22:44:04 2018 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Wed May 2 22:54:11 2018 -0700
----------------------------------------------------------------------
.../app/clipboard/services/clipboardService.js | 40 ++++++++++++++++++++
1 file changed, 40 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/61996327/guacamole/src/main/webapp/app/clipboard/services/clipboardService.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/clipboard/services/clipboardService.js b/guacamole/src/main/webapp/app/clipboard/services/clipboardService.js
index 9000c18..cae6c0b 100644
--- a/guacamole/src/main/webapp/app/clipboard/services/clipboardService.js
+++ b/guacamole/src/main/webapp/app/clipboard/services/clipboardService.js
@@ -179,6 +179,23 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
var deferred = $q.defer();
+ try {
+
+ // Attempt to read the clipboard using the Asynchronous Clipboard
+ // API, if it's available
+ if (navigator.clipboard && navigator.clipboard.writeText) {
+ if (data.type === 'text/plain') {
+ navigator.clipboard.writeText(data.data).then(deferred.resolve, deferred.reject);
+ return deferred.promise;
+ }
+ }
+
+ }
+
+ // Ignore any hard failures to use Asynchronous Clipboard API, falling
+ // back to traditional document.execCommand()
+ catch (ignore) {}
+
// Track the originally-focused element prior to changing focus
var originalElement = document.activeElement;
pushSelection();
@@ -415,6 +432,29 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
var deferred = $q.defer();
+ try {
+
+ // Attempt to read the clipboard using the Asynchronous Clipboard
+ // API, if it's available
+ if (navigator.clipboard && navigator.clipboard.readText) {
+
+ navigator.clipboard.readText().then(function textRead(text) {
+ deferred.resolve(new ClipboardData({
+ type : 'text/plain',
+ data : text
+ }));
+ }, deferred.reject);
+
+ return deferred.promise;
+
+ }
+
+ }
+
+ // Ignore any hard failures to use Asynchronous Clipboard API, falling
+ // back to traditional document.execCommand()
+ catch (ignore) {}
+
// Track the originally-focused element prior to changing focus
var originalElement = document.activeElement;
[2/2] guacamole-client git commit: GUACAMOLE-559: Merge add support
for Asynchronous Clipboard API.
Posted by vn...@apache.org.
GUACAMOLE-559: Merge add support for Asynchronous Clipboard API.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/91f19b2e
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/91f19b2e
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/91f19b2e
Branch: refs/heads/master
Commit: 91f19b2e03cce32c964f1f06e810d84aa8b924d5
Parents: 8181a96 6199632
Author: Nick Couchman <vn...@apache.org>
Authored: Thu May 3 04:45:41 2018 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Thu May 3 04:45:41 2018 -0400
----------------------------------------------------------------------
.../app/clipboard/services/clipboardService.js | 40 ++++++++++++++++++++
1 file changed, 40 insertions(+)
----------------------------------------------------------------------