client: improve emoji picker search #101
Loading…
Reference in a new issue
No description provided.
Delete branch "emoji-picker"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This can be merged as-is, it works quite well on several production instances (including MAB).
Remaining TODO: Levenshtein distance or similar "scoring" effect for sorting of the matches. I don't want to do it in this PR, so I mention it for future reference.
We can consider this PR to also be a test run for whether standard git trailers work in the automatic PR merge thing of gitea.
Changelog: Added
Works for me.
@ -130,0 +138,4 @@
|| emoji.keywords?.some(match) // unicode emoji
);
// TODO: sort matches by distance to query
if (max <= 0 || matches.length < max) return matches;
Checking for
matches.length < max
is not really necessary, sinceslice
is specified to deal with cases where the 2nd argument is greater than the length but this works too.I was getting some weird edge-cases with a trailing "undefined" element without it.
I can try removing it again if you'd like, but the cost of the check is basically zero relative to the rendering perf anyway.
@ -36,2 +36,4 @@
<option value="quiet">{{ i18n.ts._serverDisconnectedBehavior.quiet }}</option>
</FormSelect>
<FormRange v-model="maxCustomEmojiPicker" :min="0" :max="24" :step="1" class="_formBlock">
If this defines a maximum, maybe the setting should also have a maximum (for which it would have to be a range element).
It doesn't - the maximum is actually 0 (unlimited). I set the max in the view because I can't imagine someone wanting >24 but <inf, given the practical implications of 6 rows.
It's basically like this so the slider is actually useful rather than, you know. Setting it to 999 or whatever.
Could make it a freeform entry but then I'd have to do parsing...
Nothing stopping a value of 25 though, it just wouldn't make much sense.
What do you think?
@ -38,0 +40,4 @@
<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">
Same here of course.