Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions layouts/partials/hooks/body-end.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
document.body.appendChild(target);
}
target.value = document.getElementById(elem).innerText;
target.value = target.value.replace(/\n\n/gm,"\n").trim();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ayushtamra

I think this may be the wrong fix. If the original bug / behavior changes within Hugo then what gets copied could be different from what you get when you download the example.

At a minimum, this needs a clear comment that explains why the replace() happens.

Copy link
Author

@ayushtamra ayushtamra Jun 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback @sftim I would like to mention that maybe its related to the execCommand() which is doing the copy here.
Also I have seen an question posted on StackOverflow(don't know if it makes sense): https://stackoverflow.com/questions/34477425/javascript-execcommandcopy-copies-text-but-adds-extra-white-space-to-value
But I am sure to look into and learn if there is any issues related with hugo

// select the content
target.select();

Expand Down