From f71ae18de5c611c91bed8e4756a79abcf6910dd7 Mon Sep 17 00:00:00 2001 From: 1bl4z3r <34515568+1bl4z3r@users.noreply.github.com> Date: Sat, 21 Oct 2023 12:37:07 +0530 Subject: [PATCH] Update code-copy.js https://github.com/Track3/hermit/pull/137/ --- assets/js/code-copy.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/js/code-copy.js b/assets/js/code-copy.js index 68036c8..5c7db78 100644 --- a/assets/js/code-copy.js +++ b/assets/js/code-copy.js @@ -36,7 +36,11 @@ var codeEl = containerEl.firstElementChild; copyBtn.addEventListener('click', function() { try { - var selection = selectText(codeEl); + if(codeEl.firstElementChild instanceof HTMLTableElement) { + var selection = selectText(codeEl.firstElementChild.firstElementChild.firstElementChild.lastElementChild); + } else { + var selection = selectText(codeEl); + } document.execCommand('copy'); selection.removeAllRanges();