Last active
September 5, 2024 12:40
-
-
Save ItsOnlyBinary/6a3b87935f39f4b1e0d930d14164ba9a to your computer and use it in GitHub Desktop.
plugin-embeds-toggle.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template id="embeds-toggle"> | |
<div @click="buttonClicked"> | |
<a :title="previewState ? 'Disable Embeds' : 'Enable Embeds'"> | |
<i | |
:class="['fa', previewState ? 'fa-cloud-download' : 'fa-cloud']" | |
aria-hidden="true" | |
></i> | |
</a> | |
</div> | |
</template> | |
<script> | |
kiwi.plugin('embeds-toggle', function(kiwi, log) { | |
const button = { | |
template: '#embeds-toggle', | |
props: ['network', 'buffer', 'sidebarState'], | |
computed: { | |
previewState() { | |
return kiwi.state.setting('buffers.inline_link_auto_previews'); | |
} | |
}, | |
methods: { | |
buttonClicked() { | |
console.log('clicked', this.previewState); | |
kiwi.state.setting('buffers.inline_link_auto_previews', !this.previewState); | |
kiwi.state.setting('buffers.inline_link_auto_previews_query', !this.previewState); | |
} | |
}, | |
}; | |
kiwi.addUi('header_channel', button); | |
kiwi.addUi('header_query', button); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment