add favourite toggle
This commit is contained in:
parent
0145492773
commit
8bfac0f6ff
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<img class="emoji" :class="{jumboable}" :src="src" :alt="`;${name};`" v-tooltip="{ content: `;${name};`, delay: { show: 750, hide: 0 } }" />
|
||||
<img class="bd-emote emoji" :class="{jumboable}" :src="src" :alt="`;${name};`" v-tooltip="{ content: `;${name};`, delay: { show: 750, hide: 0 } }" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -14,7 +14,7 @@ import { request } from 'vendor';
|
|||
|
||||
import { Utils, FileUtils, ClientLogger as Logger } from 'common';
|
||||
import { DiscordApi, Settings, Globals, WebpackModules, ReactComponents, MonkeyPatch, Cache, Patcher, Database } from 'modules';
|
||||
import { VueInjector } from 'ui';
|
||||
import { VueInjector, DiscordContextMenu } from 'ui';
|
||||
|
||||
import Emote from './EmoteComponent.js';
|
||||
import Autocomplete from '../ui/components/common/Autocomplete.vue';
|
||||
|
@ -55,6 +55,16 @@ export default new class EmoteModule extends BuiltinModule {
|
|||
// Add ; prefix for autocomplete
|
||||
GlobalAc.add(';', this);
|
||||
|
||||
// Add favourite button to context menu
|
||||
DiscordContextMenu.add([
|
||||
{
|
||||
text: 'Favourite',
|
||||
type: 'toggle',
|
||||
checked: false,
|
||||
onChange: e => e
|
||||
}
|
||||
], filter => filter.closest('.bd-emote'));
|
||||
|
||||
if (!this.database.size) {
|
||||
await this.loadLocalDb();
|
||||
}
|
||||
|
@ -97,7 +107,7 @@ export default new class EmoteModule extends BuiltinModule {
|
|||
*/
|
||||
async patchMessageContent() {
|
||||
const MessageContent = await ReactComponents.getComponent('MessageContent', { selector: WebpackModules.getSelector('container', 'containerCozy', 'containerCompact', 'edited') });
|
||||
MonkeyPatch('BD:EMOTEMODULE', MessageContent.component.prototype).before('render', this.afterRenderMessageContent.bind(this));
|
||||
MonkeyPatch('BD:EMOTEMODULE', MessageContent.component.prototype).after('render', this.afterRenderMessageContent.bind(this));
|
||||
MessageContent.forceUpdateAll();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue