Skip to content

Commit 16d38a0

Browse files
committed
fixed copy function
1 parent afd9e32 commit 16d38a0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

view/view.twig

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@
1919

2020
{# COPY TO CLIPBOARD SCRIPT #}
2121
<script>
22-
document.getElementById('copy-button').addEventListener('click', function() {
23-
var content = document.getElementById('content').innerText;
24-
navigator.clipboard.writeText(content).then(function() {
25-
console.log('Copied to clipboard!');
26-
}).catch(function(error) {
22+
document.getElementById('copy-button').addEventListener('click', function () {
23+
var content = document.getElementById('content').textContent.trim();
24+
navigator.clipboard.writeText(content).then(function () {
25+
}).catch(function (error) {
2726
console.log('Copy failed: ' + error);
2827
});
2928
});

0 commit comments

Comments
 (0)