From 2ed4b215d23786d8caf6b7980257686c2d86923d Mon Sep 17 00:00:00 2001 From: jakubnakielskixebia Date: Thu, 25 Jul 2024 12:54:05 +0200 Subject: [PATCH] fix: copied btn text mechanism --- src/xebia_email_signature/static/scripts-new.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/xebia_email_signature/static/scripts-new.js b/src/xebia_email_signature/static/scripts-new.js index a9f499f..e71bb01 100644 --- a/src/xebia_email_signature/static/scripts-new.js +++ b/src/xebia_email_signature/static/scripts-new.js @@ -589,14 +589,16 @@ function signatureCopyHtmlInit() { function setBtnActionText(btn, text) { let btnTextEl = btn.querySelector('span'); - let btnOriginalText = btnTextEl.innerText; + let btnOriginalText = btn.dataset.originalText || btnTextEl.innerText; + btn.disabled = true; + btn.dataset.originalText = btnOriginalText; btnTextEl.innerText = text; - if (!btnTextEl.textTimeout) { - btnTextEl.textTimeout = setTimeout(() => { - btnTextEl.innerText = btnOriginalText; - }, 3000); - } + + btnTextEl.textTimeout = setTimeout(() => { + btnTextEl.innerText = btnOriginalText; + btn.disabled = false; + }, 1000); } async function iframePrepare(options = {}) {