File tree 1 file changed +16
-1
lines changed 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,21 @@ $( document ).ready(function() {
201
201
}
202
202
} ) ;
203
203
} ) ;
204
+
205
+ $ ( "pre code" ) . each ( function ( i , block ) {
206
+ var pre_block = $ ( this ) . parent ( ) ;
207
+ if ( ! pre_block . hasClass ( 'playpen' ) ) {
208
+ var buttons = pre_block . find ( ".buttons" ) ;
209
+ if ( buttons . length == 0 ) {
210
+ pre_block . prepend ( "<div class=\"buttons\"></div>" ) ;
211
+ buttons = pre_block . find ( ".buttons" ) ;
212
+ }
213
+ buttons . prepend ( "<i class=\"fa fa-copy clip-button\"><i class=\"tooltiptext\"></i></i>" ) ;
214
+ buttons . find ( ".clip-button" ) . mouseout ( function ( e ) {
215
+ hideTooltip ( e . currentTarget ) ;
216
+ } ) ;
217
+ }
218
+ } ) ;
204
219
205
220
// Process playpen code blocks
206
221
$ ( ".playpen" ) . each ( function ( block ) {
@@ -236,7 +251,7 @@ $( document ).ready(function() {
236
251
var clipboardSnippets = new Clipboard ( '.clip-button' , {
237
252
text : function ( trigger ) {
238
253
hideTooltip ( trigger ) ;
239
- let playpen = $ ( trigger ) . parents ( ".playpen " ) ;
254
+ let playpen = $ ( trigger ) . parents ( "pre " ) ;
240
255
return playpen_text ( playpen ) ;
241
256
}
242
257
} ) ;
You can’t perform that action at this time.
0 commit comments