mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-55: Prevent clipboard events generated by the clipboardService from disturbing the operations of the guacClipboard directive.
This commit is contained in:
@@ -288,9 +288,9 @@ angular.module('clipboard').directive('guacClipboard', ['$injector',
|
||||
};
|
||||
|
||||
// Attempt to read the clipboard if it may have changed
|
||||
$window.addEventListener('copy', checkClipboard, true);
|
||||
$window.addEventListener('cut', checkClipboard, true);
|
||||
$window.addEventListener('focus', checkClipboard, true);
|
||||
$window.addEventListener('copy', checkClipboard);
|
||||
$window.addEventListener('cut', checkClipboard);
|
||||
$window.addEventListener('focus', checkClipboard);
|
||||
|
||||
// Clean up on destruction
|
||||
$scope.$on('$destroy', function destroyClipboard() {
|
||||
|
@@ -54,6 +54,22 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
|
||||
// Add clipboard target to DOM
|
||||
document.body.appendChild(clipboardContent);
|
||||
|
||||
/**
|
||||
* Stops the propogation of the given event through the DOM tree. This is
|
||||
* identical to invoking stopPropogation() on the event directly, except
|
||||
* that this function is usable as an event handler itself.
|
||||
*
|
||||
* @param {Event} e
|
||||
* The event whose propogation through the DOM tree should be stopped.
|
||||
*/
|
||||
var stopEventPropagation = function stopEventPropagation(e) {
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
// Prevent events generated due to execCommand() from disturbing external things
|
||||
clipboardContent.addEventListener('copy', stopEventPropagation);
|
||||
clipboardContent.addEventListener('paste', stopEventPropagation);
|
||||
|
||||
/**
|
||||
* A stack of past node selection ranges. A range convering the nodes
|
||||
* currently selected within the document can be pushed onto this stack
|
||||
|
Reference in New Issue
Block a user