Added support for specifying copied text for code blocks

This commit is contained in:
squidfunk 2023-10-05 17:26:24 +02:00
parent 57e598b96e
commit 48ff39a5cc
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
4 changed files with 7 additions and 7 deletions

View File

@ -249,7 +249,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.83df87ba.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.2a9e8380.min.js' | url }}"></script>
{% for script in config.extra_javascript %}
{{ script | script_tag }}
{% endfor %}

View File

@ -55,7 +55,7 @@ interface SetupOptions {
*/
function extract(el: HTMLElement): string {
el.setAttribute("data-md-copying", "")
const text = el.innerText
const text = el.getAttribute("data-clipboard-text") ?? el.innerText
el.removeAttribute("data-md-copying")
return text
}