Skip to content

Commit

Permalink
fixed copy code buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
pokepetter committed May 13, 2024
1 parent e46d973 commit b906a24
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/documentation_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
document.getElementById("checkbox").checked = checked;
function copy_to_clipboard(containerid) {
var range = document.createRange();
range.selectNode(containerid); //changed here
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
document.execCommand("copy");
window.getSelection().removeAllRanges();
var range = document.createRange()
range.selectNode(containerid)
window.getSelection().removeAllRanges()
window.getSelection().addRange(range)
document.execCommand("copy")
window.getSelection().removeAllRanges()
}
</script>
Expand Down Expand Up @@ -720,7 +720,7 @@ def html_color(value):

if data.example:
html += ' <div><gray>example:</gray></div>\n'
html += f' <div class="example" id="{name}_example"><button class="copy_code_button" onclick="copy_to_clipboard({name}_example)">copy</button>{data.example}\n</div>\n'
html += f' <div class="example"><button class="copy_code_button" onclick="copy_to_clipboard({name}_example)">copy</button><p id="{name}_example">{data.example}</p>\n</div>\n'

html = html.replace('<gray></gray>', '')

Expand Down

0 comments on commit b906a24

Please sign in to comment.