mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 13:41:21 +00:00
GUAC-1480: Remove use of "Allow Clipboard" extension.
This commit is contained in:
@@ -77,34 +77,15 @@ angular.module('client').factory('clipboardService', ['$injector',
|
|||||||
|
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
|
|
||||||
// First, see if allow clipboard extension is installed
|
// Copy the given value into the clipboard DOM element
|
||||||
if (window.AllowClipboard) {
|
clipboardContent.value = text;
|
||||||
|
clipboardContent.select();
|
||||||
|
|
||||||
var clipboardClient = new AllowClipboard.Client.ClipboardClient();
|
// Attempt to copy data from clipboard element into local clipboard
|
||||||
|
if (document.execCommand('copy'))
|
||||||
clipboardClient.write(text, function(success) {
|
deferred.resolve();
|
||||||
if (success)
|
else
|
||||||
deferred.resolve();
|
deferred.reject();
|
||||||
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();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
};
|
};
|
||||||
@@ -121,34 +102,15 @@ angular.module('client').factory('clipboardService', ['$injector',
|
|||||||
|
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
|
|
||||||
// First, see if allow clipboard extension is installed
|
// Clear and select the clipboard DOM element
|
||||||
if (window.AllowClipboard) {
|
clipboardContent.value = '';
|
||||||
|
clipboardContent.select();
|
||||||
|
|
||||||
var clipboardClient = new AllowClipboard.Client.ClipboardClient();
|
// Attempt paste local clipboard into clipboard DOM element
|
||||||
|
if (document.execCommand('paste'))
|
||||||
clipboardClient.read(function(success, data) {
|
deferred.resolve(clipboardContent.value);
|
||||||
if (success)
|
else
|
||||||
deferred.resolve(data);
|
deferred.reject();
|
||||||
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();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user