diff options
| author | XhmikosR <[email protected]> | 2023-03-27 11:04:52 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-03-27 11:04:52 +0300 |
| commit | 1729bcca1b3a842829c9a64fe1f34fdd53465189 (patch) | |
| tree | 838cfc0669f54ce1a88a9a1120068022bbc8f4bd | |
| parent | 2bbf670fc2b230f18ba763f50498b8ee90f751c3 (diff) | |
| download | bootstrap-1729bcca1b3a842829c9a64fe1f34fdd53465189.tar.xz bootstrap-1729bcca1b3a842829c9a64fe1f34fdd53465189.zip | |
docs: remove trailing newline when copying snippets (#38321)
| -rw-r--r-- | site/assets/js/code-examples.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/site/assets/js/code-examples.js b/site/assets/js/code-examples.js index 555bd7b6f..f224500f4 100644 --- a/site/assets/js/code-examples.js +++ b/site/assets/js/code-examples.js @@ -13,6 +13,7 @@ (() => { 'use strict' + // Insert copy to clipboard button before .highlight const btnTitle = 'Copy to clipboard' const btnEdit = 'Edit on StackBlitz' @@ -27,7 +28,7 @@ '</div>' ].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 @@ -51,7 +52,8 @@ 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.parentNode.nextElementSibling.textContent.trimEnd() }) clipboard.on('success', event => { |
