mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-310: Switch clipboard service back to using textarea for contents.
This commit is contained in:
@@ -57,10 +57,9 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
|
|||||||
*
|
*
|
||||||
* @type Element
|
* @type Element
|
||||||
*/
|
*/
|
||||||
var clipboardContent = document.createElement('div');
|
var clipboardContent = document.createElement('textarea');
|
||||||
|
|
||||||
// Ensure clipboard target is selectable but not visible
|
// Ensure clipboard target is selectable but not visible
|
||||||
clipboardContent.setAttribute('contenteditable', 'true');
|
|
||||||
clipboardContent.className = 'clipboard-service-target';
|
clipboardContent.className = 'clipboard-service-target';
|
||||||
|
|
||||||
// Add clipboard target to DOM
|
// Add clipboard target to DOM
|
||||||
@@ -167,7 +166,7 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
|
|||||||
|
|
||||||
// Copy the given value into the clipboard DOM element
|
// Copy the given value into the clipboard DOM element
|
||||||
if (typeof data.data === 'string')
|
if (typeof data.data === 'string')
|
||||||
clipboardContent.textContent = data.data;
|
clipboardContent.value = data.data;
|
||||||
else {
|
else {
|
||||||
clipboardContent.innerHTML = '';
|
clipboardContent.innerHTML = '';
|
||||||
var img = document.createElement('img');
|
var img = document.createElement('img');
|
||||||
@@ -400,7 +399,7 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
|
|||||||
pushSelection();
|
pushSelection();
|
||||||
|
|
||||||
// Clear and select the clipboard DOM element
|
// Clear and select the clipboard DOM element
|
||||||
clipboardContent.innerHTML = '';
|
clipboardContent.value = '';
|
||||||
clipboardContent.focus();
|
clipboardContent.focus();
|
||||||
selectAll(clipboardContent);
|
selectAll(clipboardContent);
|
||||||
|
|
||||||
@@ -431,7 +430,7 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
|
|||||||
else
|
else
|
||||||
deferred.resolve(new ClipboardData({
|
deferred.resolve(new ClipboardData({
|
||||||
type : 'text/plain',
|
type : 'text/plain',
|
||||||
data : clipboardContent.textContent
|
data : clipboardContent.value
|
||||||
}));
|
}));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user