File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 13
13
14
14
( ( ) => {
15
15
'use strict'
16
+
16
17
// Insert copy to clipboard button before .highlight
17
18
const btnTitle = 'Copy to clipboard'
18
19
const btnEdit = 'Edit on StackBlitz'
27
28
'</div>'
28
29
] . join ( '' )
29
30
30
- // wrap programmatically code blocks and add copy btn.
31
+ // Wrap programmatically code blocks and add copy btn.
31
32
document . querySelectorAll ( '.highlight' )
32
33
. forEach ( element => {
33
34
if ( ! element . closest ( '.bd-example-snippet' ) ) { // Ignore examples made be shortcode
51
52
snippetButtonTooltip ( '.btn-edit' , btnEdit )
52
53
53
54
const clipboard = new ClipboardJS ( '.btn-clipboard' , {
54
- target : trigger => trigger . closest ( '.bd-code-snippet' ) . querySelector ( '.highlight' )
55
+ target : trigger => trigger . closest ( '.bd-code-snippet' ) . querySelector ( '.highlight' ) ,
56
+ text : trigger => trigger . parentNode . nextElementSibling . textContent . trimEnd ( )
55
57
} )
56
58
57
59
clipboard . on ( 'success' , event => {
You can’t perform that action at this time.
0 commit comments