diff --git a/www/ServerStatus.js b/www/ServerStatus.js index 0c105c63..770deecb 100644 --- a/www/ServerStatus.js +++ b/www/ServerStatus.js @@ -76,11 +76,9 @@ Ext.define('PBS.ServerStatus', { { xtype: 'button', iconCls: 'fa fa-clipboard', - handler: function(button) { - window.getSelection().selectAllChildren( - document.getElementById('pkgversions'), - ); - document.execCommand("copy"); + handler: async function(button) { + let el = document.getElementById('pkgversions'); + await navigator.clipboard.writeText(el.textContent); }, text: gettext('Copy'), }, diff --git a/www/panel/NodeInfo.js b/www/panel/NodeInfo.js index 454986ef..9d741e45 100644 --- a/www/panel/NodeInfo.js +++ b/www/panel/NodeInfo.js @@ -45,10 +45,9 @@ Ext.define('PBS.NodeInfoPanel', { { xtype: 'button', iconCls: 'fa fa-clipboard', - handler: function(b) { + handler: async function(b) { var el = document.getElementById('fingerprintField'); - el.select(); - document.execCommand("copy"); + await navigator.clipboard.writeText(el.value); }, text: gettext('Copy'), }, diff --git a/www/window/DatastoreRepoInfo.js b/www/window/DatastoreRepoInfo.js index e862d7ad..2f2db477 100644 --- a/www/window/DatastoreRepoInfo.js +++ b/www/window/DatastoreRepoInfo.js @@ -113,15 +113,14 @@ Ext.define('PBS.form.CopyField', { iconCls: 'fa fa-clipboard x-btn-icon-el-default-toolbar-small', baseCls: 'x-btn', cls: 'x-btn-default-toolbar-small proxmox-inline-button', - handler: function() { + handler: async function() { let me = this; let field = me.up('pbsCopyField'); let el = field.getComponent('inputField')?.inputEl; if (!el?.dom) { return; } - el.dom.select(); - document.execCommand("copy"); + await navigator.clipboard.writeText(el.dom.value); }, text: gettext('Copy'), }, diff --git a/www/window/TokenEdit.js b/www/window/TokenEdit.js index 80540212..c1856be8 100644 --- a/www/window/TokenEdit.js +++ b/www/window/TokenEdit.js @@ -203,9 +203,9 @@ Ext.define('PBS.window.TokenShow', { ], buttons: [ { - handler: function(b) { - document.getElementById('token-secret-value').select(); - document.execCommand("copy"); + handler: async function(b) { + let el = document.getElementById('token-secret-value'); + await navigator.clipboard.writeText(el.value); }, text: gettext('Copy Secret Value'), },