Skip to content

Commit

Permalink
Added click-to-copy for build templates
Browse files Browse the repository at this point in the history
  • Loading branch information
berdandy committed Oct 20, 2024
1 parent 97e56c8 commit 699aa3b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion templates/shortcodes/chatlink.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
`{{code}}`
<script>
function BUILDCODE__hideCopyAlert() {
document.getElementById("copycode").innerHTML = "click to copy";
}
function BUILDCODE__copyCode() {
navigator.clipboard.writeText("{{code}}");
document.getElementById("copycode").innerHTML = "code copied";
setTimeout(BUILDCODE__hideCopyAlert, 2000);
}
</script>

<span onclick='BUILDCODE__copyCode()'>

`{{code}}` <span id="copycode">click to copy</span>

</span>

---

Expand Down

0 comments on commit 699aa3b

Please sign in to comment.