mirror of
https://github.com/jbowdre/runtimeterror.git
synced 2024-11-10 01:52:19 +00:00
don't copy line-remove (diff) lines
This commit is contained in:
parent
016b8726c8
commit
729d9335ca
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