GUAC-1480: Use AllowClipboard and execCommand for local/remote clipboard integration.

This commit is contained in:
James Muehlner
2016-02-01 22:03:44 -08:00
parent 14889c7d73
commit 7ec53c94ce
3 changed files with 188 additions and 5 deletions

View File

@@ -35,6 +35,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
// Required services
var $location = $injector.get('$location');
var authenticationService = $injector.get('authenticationService');
var clipboardService = $injector.get('clipboardService');
var guacClientManager = $injector.get('guacClientManager');
var guacNotification = $injector.get('guacNotification');
var preferenceService = $injector.get('preferenceService');
@@ -230,11 +231,6 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
$scope.menu.shown = false;
};
// Update the model when clipboard data received from client
$scope.$on('guacClientClipboard', function clientClipboardListener(event, client, mimetype, clipboardData) {
$scope.clipboardData = clipboardData;
});
/**
* The client which should be attached to the client UI.
*
@@ -526,6 +522,19 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
});
}
// Hide status and sync local clipboard once connected
else if (connectionState === ManagedClientState.ConnectionState.CONNECTED) {
// Sync with local clipboard
clipboardService.getLocalClipboard().then(function clipboardRead(data) {
$scope.$broadcast('guacClipboard', 'text/plain', data);
});
// Hide status notification
guacNotification.showStatus(false);
}
// Hide status for all other states
else
guacNotification.showStatus(false);