wiki-grav/plugins/page-toc/assets/page-toc-anchors.js
2022-06-06 18:16:01 +02:00

10 lines
328 B
JavaScript

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);