klippy icon indicating copy to clipboard operation
klippy copied to clipboard

Replace <img /> with something else (e.g. glyphicon)

Open gorgitko opened this issue 3 years ago • 0 comments

Hello,

would it be possible to use something else for klippy button than <img /> tag (defined here)? For example, glyphicons could be used, as they are integrated into Bootstrap, which is a part of rmarkdown.

Now I am using this dirty hack in Rmd file to replace klippy button images with glyphicons:

$(document).ready(function() {
  setTimeout(function() {
    $("img.octicon").each(function(i, el) {
      el.parentNode.innerHTML = '<span class="octicon glyphicon glyphicon-copy"></span>'
    });
  }, 500);
});

Why would that be needed? I am using rmdformats to style my Rmd documents and some of them are adding a gallery mode used for each <img /> (e.g. readthedown style). That is, when you click on an image, zoomed version is displayed along with navigation between images. And, unfortunately, klippy is interfering with that, so when you click on a copy button, the gallery mode is triggered.

Thanks for looking into this and many thanks for this awesome package! :heart_eyes:

gorgitko avatar Mar 09 '21 13:03 gorgitko