Skip to content

Instantly share code, notes, and snippets.

@ItsOnlyBinary
Last active September 5, 2024 12:40
Show Gist options
  • Save ItsOnlyBinary/6a3b87935f39f4b1e0d930d14164ba9a to your computer and use it in GitHub Desktop.
Save ItsOnlyBinary/6a3b87935f39f4b1e0d930d14164ba9a to your computer and use it in GitHub Desktop.
plugin-embeds-toggle.html
<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