Skip to content

Commit dd04617

Browse files
authored
fix: remove return carriage from copied text (#36)
1 parent bd0cf8d commit dd04617

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

assets/js/code-copy.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ function CopyCode(clipboard) {
66
button.innerHTML = '<i class="fas fa-copy"></i> Copy';
77

88
button.addEventListener('click', function() {
9-
clipboard.writeText(codeBlock.textContent).then(
9+
// removes return carriage from copied text
10+
clipboard.writeText(codeBlock.textContent.replace(/\n$/g, "")).then(
1011
function() {
1112
button.blur(); /* Chrome fix */
1213
button.innerHTML = '<i class="fas fa-check"></i> Copied!';

0 commit comments

Comments
 (0)