diff --git a/src/client/app/composables/copyCode.ts b/src/client/app/composables/copyCode.ts index 6c82b1b4..224f9209 100644 --- a/src/client/app/composables/copyCode.ts +++ b/src/client/app/composables/copyCode.ts @@ -14,10 +14,15 @@ export function useCopyCode() { } const isShell = /language-(shellscript|shell|bash|sh|zsh)/.test( - parent.classList.toString() + parent.className ) - let { innerText: text = '' } = sibling + let text = '' + + sibling + .querySelectorAll('span.line:not(.diff.remove)') + .forEach((node) => (text += (node.textContent || '') + '\n')) + text = text.slice(0, -1) if (isShell) { text = text.replace(/^ *(\$|>) /gm, '').trim()