We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 568d2cf commit 390d4d1Copy full SHA for 390d4d1
layouts/partials/footer.html
@@ -106,9 +106,17 @@
106
copybutton.classList.add('copy-code');
107
copybutton.innerHTML = 'copy';
108
109
+ function copyingDone() {
110
+ copybutton.innerText = 'copied!';
111
+ setTimeout(() => {
112
+ copybutton.innerText = 'copy';
113
+ }, 2000);
114
+ }
115
+
116
copybutton.addEventListener('click', (cb) => {
117
if ('clipboard' in navigator) {
118
navigator.clipboard.writeText(codeblock.textContent);
119
+ copyingDone();
120
return;
121
}
122
@@ -119,6 +127,7 @@
127
selection.addRange(range);
128
try {
129
document.execCommand('copy');
130
131
} catch (e) {};
123
132
selection.removeRange(range);
124
133
});
0 commit comments