From a847f254086f23932f0e9e947e87415e74d4fd5e Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 13 Sep 2022 10:23:47 -0600 Subject: [PATCH] Show success message after copying to clipboard --- api/js/egw_action/egw_action_popup.js | 5 +++-- api/lang/egw_en.lang | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/js/egw_action/egw_action_popup.js b/api/js/egw_action/egw_action_popup.js index 6059852569..8ff17e095d 100644 --- a/api/js/egw_action/egw_action_popup.js +++ b/api/js/egw_action/egw_action_popup.js @@ -791,7 +791,7 @@ export function egwPopupActionImplementation() if (successful) { // Clear message - egw.message(''); + egw.message(egw.lang("'%1' copied to clipboard", os_clipboard_caption.length > 20 ? os_clipboard_caption.substring(0, 20) + '...' : os_clipboard_caption)); window.getSelection().removeAllRanges(); return false; } @@ -970,10 +970,11 @@ function fallbackCopyTextToClipboard(event, clipboard_action, text) event.clipboardData.setData('text/plain', jQuery(clipboard_action.data.target).text().trim()); event.clipboardData.setData('text/html', jQuery(clipboard_action.data.target).html()); } + let textArea; if (!window.clipboardData) { - const textArea = document.createElement("textarea"); + textArea = document.createElement("textarea"); textArea.value = text; // Avoid scrolling to bottom diff --git a/api/lang/egw_en.lang b/api/lang/egw_en.lang index 3b88424ed4..4a312d7831 100644 --- a/api/lang/egw_en.lang +++ b/api/lang/egw_en.lang @@ -26,6 +26,7 @@ %s notranslation common en %s NoTranslation %s onchange common en %s onChange %s readonly common en %s readonly +'%1' copied to clipboard common en '%1' copied to clipboard '%1' has an invalid format common en '%1' has an invalid format '%1' has an invalid format !!! common en '%1' has an invalid format! '%1' is no php file in the egw server root (%2)! common en '%1' is no php file in the eGW server root (%2)!