mirror of
https://github.com/jbowdre/runtimeterror.git
synced 2024-11-29 18:02:18 +00:00
don't copy line-remove (diff) lines
This commit is contained in:
parent
a829d12127
commit
40f9f38848
1 changed files with 2 additions and 2 deletions
|
@ -16,8 +16,8 @@ function createCopyButton(highlightDiv) {
|
||||||
document.querySelectorAll(".highlight").forEach((highlightDiv) => createCopyButton(highlightDiv));
|
document.querySelectorAll(".highlight").forEach((highlightDiv) => createCopyButton(highlightDiv));
|
||||||
|
|
||||||
async function copyCodeToClipboard(button, highlightDiv) {
|
async function copyCodeToClipboard(button, highlightDiv) {
|
||||||
// capture all code lines in the selected block which aren't classed `nocopy`
|
// capture all code lines in the selected block which aren't classed `nocopy` or `line-remove`
|
||||||
let codeToCopy = highlightDiv.querySelectorAll(":last-child > .torchlight > code > .line:not(.nocopy)");
|
let codeToCopy = highlightDiv.querySelectorAll(":last-child > .torchlight > code > .line:not(.nocopy, .line-remove)");
|
||||||
// now remove the first-child of each line which has class `line-number`
|
// now remove the first-child of each line which has class `line-number`
|
||||||
codeToCopy = Array.from(codeToCopy).reduce((accumulator, line) => {
|
codeToCopy = Array.from(codeToCopy).reduce((accumulator, line) => {
|
||||||
if (line.firstChild.className != "line-number") {
|
if (line.firstChild.className != "line-number") {
|
||||||
|
|
Loading…
Reference in a new issue