Add "copy to clipboard" button for code blocks (#2812)
* Add copy-to-clipboard button and JS * Ignore line numbers if present * Rewrite heading permalink code to use vanilla JS * README: Add credits to zenorocha/clipboard.js (MIT License) @iBug really wants a place here in the Credits section :P * Add .no-copy for hiding the button, update docs * Add td.rouge-code to selectors * Fix navigator.clipboard branch * Add screenreader text for copy button * Restore focus to the button after copying * Add site-wide enable switch
This commit is contained in:
@ -9,8 +9,11 @@
|
||||
{%- comment %} https://docs.google.com/presentation/d/1rmxwWa9P6_xHqonmh5ONXRS-jPc5XKbnv99Rjkhe04s/present {% endcomment -%}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<script>
|
||||
<script type="text/javascript">
|
||||
document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/g, '') + ' js ';
|
||||
{% if site.enable_copy_code_button -%}
|
||||
window.enable_copy_code_button = true;
|
||||
{%- endif %}
|
||||
</script>
|
||||
|
||||
<!-- For all browsers -->
|
||||
|
Reference in New Issue
Block a user