Add button links plugin

pull/157/head
Cory LaViska 2020-08-03 17:05:32 -04:00
rodzic 6a3b2c995d
commit c77c0716d3
2 zmienionych plików z 20 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,19 @@
(() => {
if (!window.$docsify) {
throw new Error('Docsify must be loaded before installing this plugin.');
}
window.$docsify.plugins.push((hook, vm) => {
hook.mounted(function () {
document.addEventListener('click', event => {
const tag = event.target.tagName.toLowerCase();
const href = event.target.getAttribute('data-href');
if (tag === 'sl-button' && href) {
window.open(href);
}
});
});
});
})();

Wyświetl plik

@ -93,5 +93,6 @@
<script src="/assets/plugins/code-block/code-block.js"></script>
<script src="/assets/plugins/metadata/metadata.js"></script>
<script src="/assets/plugins/sidebar/sidebar.js"></script>
<script src="/assets/plugins/links/links.js"></script>
</body>
</html>