File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change 1
1
// Tightly coupled to `render-codeblock.html` for element targeting
2
- const copyToClipBoard = ( ( clipboard ) => async ( button ) => {
3
- const codeBlockId = button . getAttribute ( 'data-id-codeblock' ) ;
2
+ const copyToClipBoard = ( ( clipboard ) => async ( button , codeBlockId ) => {
4
3
const codeBlock = document
5
4
. getElementById ( codeBlockId )
6
5
. getElementsByClassName ( 'highlight' ) [ 0 ] ;
Original file line number Diff line number Diff line change 6
6
{{- if $isSingleLine -}}
7
7
< div class ="code-block " data-mf ="true " style ="display: none; ">
8
8
< div class ="code-container ">
9
- < button onclick ="copyToClipBoard(this) " data-id-codeblock =" {{ $codeBlockId }} " class ="code-copy-button " type ="button "> Copy</ button >
9
+ < button onclick ="copyToClipBoard(this, {{ $codeBlockId }}) " class ="code-copy-button " type ="button "> Copy</ button >
10
10
< div class ="highlight-v2 single-line " id ="{{ $codeBlockId }} ">
11
11
{{ $result.Wrapped }}
12
12
</ div >
18
18
< span class ="code-type "> {{ .Type }}</ span >
19
19
{{- end -}}
20
20
< div class ="code-container ">
21
- < button onclick ="copyToClipBoard(this) " data-id-codeblock =" {{ $codeBlockId }} " class ="code-copy-button multi-line " type ="button "> Copy</ button >
21
+ < button onclick ="copyToClipBoard(this, {{ $codeBlockId }}) " class ="code-copy-button multi-line " type ="button "> Copy</ button >
22
22
< div class ="highlight-v2 " id ="{{ $codeBlockId }} ">
23
23
{{ $result.Wrapped }}
24
24
</ div >
You can’t perform that action at this time.
0 commit comments