wiki-grav/plugins/page-toc/assets/page-toc-anchors.js

10 lines
328 B
JavaScript
Raw Normal View History

document.body.addEventListener('click', (event) => {
if (typeof event.target.dataset.anchorIcon !== 'undefined') {
const href = event.target.href;
navigator.clipboard.writeText(href)
.then(() => {})
.catch((error) => {
console.error('Unable to copy to clipboard the anchor', error);
});
}
}, true);