diff options
| author | Aditya Telange <21258296+adityatelange@users.noreply.github.com> | 2021-04-16 10:00:08 +0530 |
|---|---|---|
| committer | Aditya Telange <21258296+adityatelange@users.noreply.github.com> | 2021-04-16 10:00:47 +0530 |
| commit | 98c17559e9c15f6ee64515f75ec22a2895b8a01f (patch) | |
| tree | 603df19dbc2a93751706b7b9e1e4b6b125c41505 /layouts | |
| parent | c3634e6ccdaa3930666b448d2b4ca9f2ec13a51f (diff) | |
Add checks for adding the copy button in code-blocks
- adds checks to put copy button for code
inside table and highlight code block
- Fixes #363
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/partials/footer.html | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 1badd4a..2c6511b 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -120,7 +120,17 @@ selection.removeRange(range); }); - container.appendChild(copybutton); + if (container.classList.contains("highlight")) { + container.appendChild(copybutton); + } else if (container.parentNode.firstChild == container) { + // td containing LineNos + } else if (codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "TABLE") { + // table containing LineNos and code + codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.appendChild(copybutton); + } else { + // code blocks not having highlight as parent class + codeblock.parentNode.appendChild(copybutton); + } }); </script> {{- end }} |
