UI: Prevent copy to clipboard double-clicks

As long as the copy confirmation is shown, it should not allow the handler to be called again.

Fixes #6632.
This commit is contained in:
Dennis Reimann
2025-03-17 19:29:18 +01:00
parent a82e9ab871
commit 4bcf2ae830

View File

@@ -1,4 +1,5 @@
function confirmCopy(el, message) {
if (el.dataset.clipboardConfirming) return;
const hasIcon = !!el.innerHTML.match('icon-actions-copy')
const confirmHTML = `<span class="text-success">${message}</span>`;
if (hasIcon) {
@@ -10,7 +11,7 @@ function confirmCopy(el, message) {
el.style.minHeight = height + 'px';
el.innerHTML = confirmHTML;
}
el.dataset.clipboardConfirming = true;
el.dataset.clipboardConfirming = 'true';
if (el.dataset.clipboardHandler) {
clearTimeout(parseInt(el.dataset.clipboardHandler));
}