From c1d5a801b4bc66e3866f815be00e11d1b20d3539 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 24 Jun 2023 14:44:36 +0200 Subject: Adding upstream version 5.3.0+dfsg. Signed-off-by: Daniel Baumann --- site/assets/js/code-examples.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'site/assets/js/code-examples.js') diff --git a/site/assets/js/code-examples.js b/site/assets/js/code-examples.js index 25486c2..e1f680e 100644 --- a/site/assets/js/code-examples.js +++ b/site/assets/js/code-examples.js @@ -4,8 +4,7 @@ /*! * JavaScript for Bootstrap's docs (https://getbootstrap.com/) - * Copyright 2011-2022 The Bootstrap Authors - * Copyright 2011-2022 Twitter, Inc. + * Copyright 2011-2023 The Bootstrap Authors * Licensed under the Creative Commons Attribution 3.0 Unported License. * For details, see https://creativecommons.org/licenses/by/3.0/. */ @@ -14,6 +13,7 @@ (() => { 'use strict' + // Insert copy to clipboard button before .highlight const btnTitle = 'Copy to clipboard' const btnEdit = 'Edit on StackBlitz' @@ -28,7 +28,7 @@ '' ].join('') - // wrap programmatically code blocks and add copy btn. + // Wrap programmatically code blocks and add copy btn. document.querySelectorAll('.highlight') .forEach(element => { if (!element.closest('.bd-example-snippet')) { // Ignore examples made be shortcode @@ -52,11 +52,12 @@ snippetButtonTooltip('.btn-edit', btnEdit) const clipboard = new ClipboardJS('.btn-clipboard', { - target: trigger => trigger.closest('.bd-code-snippet').querySelector('.highlight') + target: trigger => trigger.closest('.bd-code-snippet').querySelector('.highlight'), + text: trigger => trigger.closest('.bd-code-snippet').querySelector('.highlight').textContent.trimEnd() }) clipboard.on('success', event => { - const iconFirstChild = event.trigger.querySelector('.bi').firstChild + const iconFirstChild = event.trigger.querySelector('.bi').firstElementChild const tooltipBtn = bootstrap.Tooltip.getInstance(event.trigger) const namespace = 'http://www.w3.org/1999/xlink' const originalXhref = iconFirstChild.getAttributeNS(namespace, 'href') -- cgit v1.2.3