Skip to content

Commit 7a12f86

Browse files
committed
Update code-copy.js Track3/hermit#137
1 parent b5e77e1 commit 7a12f86

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

assets/js/code-copy.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@
3636
var codeEl = containerEl.firstElementChild;
3737
copyBtn.addEventListener('click', function() {
3838
try {
39-
var selection = selectText(codeEl);
39+
if(codeEl.firstElementChild instanceof HTMLTableElement) {
40+
var selection = selectText(codeEl.firstElementChild.firstElementChild.firstElementChild.lastElementChild);
41+
} else {
42+
var selection = selectText(codeEl);
43+
}
4044
document.execCommand('copy');
4145
selection.removeAllRanges();
4246

0 commit comments

Comments
 (0)