diff --git a/web/pgadmin/static/js/selection/clipboard.js b/web/pgadmin/static/js/selection/clipboard.js index 9794ae7..aef1182 100644 --- a/web/pgadmin/static/js/selection/clipboard.js +++ b/web/pgadmin/static/js/selection/clipboard.js @@ -39,14 +39,19 @@ define(['sources/gettext', 'alertify'], function (gettext, alertify) { // Avoid flash of white box if rendered for any reason. textArea.style.background = 'transparent'; - - textArea.value = text; - document.body.appendChild(textArea); textArea.select(); + document.addEventListener('copy', function(e){ + e.clipboardData.setData('text/plain', text); + // We want our data, not data from any selection, to be written to the clipboard + e.preventDefault(); + }); + try { + //just copy on empty textarea so that copy event will be + // triggered on document and then we can set clipboardData document.execCommand('copy'); } catch (err) { alertify.alert(