Merge pull request #447 from Listwon/clipboard
Fix copy to clipboard is available only for rust snippets
This commit is contained in:
commit
a280a3003b
|
@ -202,6 +202,21 @@ $( document ).ready(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("pre code").each(function(i, block){
|
||||||
|
var pre_block = $(this).parent();
|
||||||
|
if( !pre_block.hasClass('playpen') ) {
|
||||||
|
var buttons = pre_block.find(".buttons");
|
||||||
|
if(buttons.length == 0) {
|
||||||
|
pre_block.prepend("<div class=\"buttons\"></div>");
|
||||||
|
buttons = pre_block.find(".buttons");
|
||||||
|
}
|
||||||
|
buttons.prepend("<i class=\"fa fa-copy clip-button\"><i class=\"tooltiptext\"></i></i>");
|
||||||
|
buttons.find(".clip-button").mouseout(function(e){
|
||||||
|
hideTooltip(e.currentTarget);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Process playpen code blocks
|
// Process playpen code blocks
|
||||||
$(".playpen").each(function(block){
|
$(".playpen").each(function(block){
|
||||||
var pre_block = $(this);
|
var pre_block = $(this);
|
||||||
|
@ -236,7 +251,7 @@ $( document ).ready(function() {
|
||||||
var clipboardSnippets = new Clipboard('.clip-button', {
|
var clipboardSnippets = new Clipboard('.clip-button', {
|
||||||
text: function(trigger) {
|
text: function(trigger) {
|
||||||
hideTooltip(trigger);
|
hideTooltip(trigger);
|
||||||
let playpen = $(trigger).parents(".playpen");
|
let playpen = $(trigger).parents("pre");
|
||||||
return playpen_text(playpen);
|
return playpen_text(playpen);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue