Improve clipboard error handling
authorLanius Trolling <lanius@laniustrolling.dev>
Tue, 14 Feb 2023 17:26:25 +0000 (12:26 -0500)
committerLanius Trolling <lanius@laniustrolling.dev>
Tue, 14 Feb 2023 17:26:25 +0000 (12:26 -0500)
src/main/resources/static/init.js

index 87c1a44f3b4afbe5c069551171128d97fbd8d998..129f816e012eabe04c72d8faa0aaf7b4160bc34b 100644 (file)
                                        })
                                        .catch(reason => {
                                                console.error("Error copying text to clipboard", reason);
+
+                                               thisElement.innerHTML = "Text copy failed";
+                                               window.setTimeout(() => {
+                                                       thisElement.innerHTML = elementHtml;
+                                                       thisElement.removeAttribute("data-copying");
+                                               }, 1500);
                                        });
 
                                thisElement.innerHTML = "Copying text...";