client: make emoji picker suggestion count configurable

This commit is contained in:
Chloe Kudryavtsev 2022-09-01 13:20:20 -04:00
parent 538e81db56
commit 33ed6e98a7
4 changed files with 27 additions and 2 deletions

View file

@ -987,6 +987,10 @@ _serverDisconnectedBehavior:
reload: "Automatically reload" reload: "Automatically reload"
dialog: "Show warning dialog" dialog: "Show warning dialog"
quiet: "Show unobtrusive warning" quiet: "Show unobtrusive warning"
maxCustomEmojiPicker: "Maximum suggested custom emoji in picker"
maxCustomEmojiPickerDescription: "0 for unlimited"
maxUnicodeEmojiPicker: "Maximum suggested unicode emoji in picker"
maxUnicodeEmojiPickerDescription: "0 for unlimited"
_channel: _channel:
create: "Create channel" create: "Create channel"
edit: "Edit channel" edit: "Edit channel"

View file

@ -112,6 +112,8 @@ const {
reactionPickerSize, reactionPickerSize,
reactionPickerWidth, reactionPickerWidth,
reactionPickerHeight, reactionPickerHeight,
maxCustomEmojiPicker,
maxUnicodeEmojiPicker,
disableShowingAnimatedImages, disableShowingAnimatedImages,
recentlyUsedEmojis, recentlyUsedEmojis,
} = defaultStore.reactiveState; } = defaultStore.reactiveState;
@ -150,8 +152,8 @@ watch(q, () => {
return; return;
} }
searchResultCustom.value = emojiSearch(instance.emojis, 10, query); searchResultCustom.value = emojiSearch(instance.emojis, maxCustomEmojiPicker.value, query);
searchResultUnicode.value = emojiSearch(emojilist, 10, query); searchResultUnicode.value = emojiSearch(emojilist, maxUnicodeEmojiPicker.value, query);
}); });
function focus() { function focus() {

View file

@ -35,6 +35,15 @@
<option value="dialog">{{ i18n.ts._serverDisconnectedBehavior.dialog }}</option> <option value="dialog">{{ i18n.ts._serverDisconnectedBehavior.dialog }}</option>
<option value="quiet">{{ i18n.ts._serverDisconnectedBehavior.quiet }}</option> <option value="quiet">{{ i18n.ts._serverDisconnectedBehavior.quiet }}</option>
</FormSelect> </FormSelect>
<FormRange v-model="maxCustomEmojiPicker" :min="0" :max="24" :step="1" class="_formBlock">
<template #label>{{ i18n.ts.maxCustomEmojiPicker }}</template>
<template #caption>{{ i18n.ts.maxCustomEmojiPickerDescription }}</template>
</FormRange>
<FormRange v-model="maxUnicodeEmojiPicker" :min="0" :max="24" :step="1" class="_formBlock">
<template #label>{{ i18n.ts.maxUnicodeEmojiPicker }}</template>
<template #caption>{{ i18n.ts.maxUnicodeEmojiPickerDescription }}</template>
</FormRange>
</FormSection> </FormSection>
<FormSection> <FormSection>
@ -124,6 +133,8 @@ async function reloadAsk() {
const overridedDeviceKind = computed(defaultStore.makeGetterSetter('overridedDeviceKind')); const overridedDeviceKind = computed(defaultStore.makeGetterSetter('overridedDeviceKind'));
const serverDisconnectedBehavior = computed(defaultStore.makeGetterSetter('serverDisconnectedBehavior')); const serverDisconnectedBehavior = computed(defaultStore.makeGetterSetter('serverDisconnectedBehavior'));
const maxCustomEmojiPicker = computed(defaultStore.makeGetterSetter('maxCustomEmojiPicker'));
const maxUnicodeEmojiPicker = computed(defaultStore.makeGetterSetter('maxUnicodeEmojiPicker'));
const reduceAnimation = computed(defaultStore.makeGetterSetter('animation', v => !v, v => !v)); const reduceAnimation = computed(defaultStore.makeGetterSetter('animation', v => !v, v => !v));
const useBlurEffectForModal = computed(defaultStore.makeGetterSetter('useBlurEffectForModal')); const useBlurEffectForModal = computed(defaultStore.makeGetterSetter('useBlurEffectForModal'));
const useBlurEffect = computed(defaultStore.makeGetterSetter('useBlurEffect')); const useBlurEffect = computed(defaultStore.makeGetterSetter('useBlurEffect'));

View file

@ -108,6 +108,14 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device', where: 'device',
default: 'quiet' as 'quiet' | 'reload' | 'dialog', default: 'quiet' as 'quiet' | 'reload' | 'dialog',
}, },
maxCustomEmojiPicker: {
where: 'device',
default: 10,
},
maxUnicodeEmojiPicker: {
where: 'device',
default: 10,
},
nsfw: { nsfw: {
where: 'device', where: 'device',
default: 'respect' as 'respect' | 'force' | 'ignore', default: 'respect' as 'respect' | 'force' | 'ignore',