mirror of
https://github.com/vector-im/element-web.git
synced 2025-10-17 18:32:20 +02:00
Sort emoji by shortcodes for autocomplete so that :-1 and :+1 first results are correct
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
c000583099
commit
3a0e1aeeaf
@ -100,6 +100,10 @@ export default class EmojiProvider extends AutocompleteProvider {
|
||||
|
||||
// then sort by score (Infinity if matchedString not in shortname)
|
||||
sorters.push((c) => score(matchedString, c.shortname));
|
||||
// then sort by max score of all shortcodes, trim off the `:`
|
||||
sorters.push((c) => {
|
||||
return Math.min.apply(null, c.emoji.shortcodes.map(s => score(matchedString.substring(1), s)));
|
||||
});
|
||||
// If the matchedString is not empty, sort by length of shortname. Example:
|
||||
// matchedString = ":bookmark"
|
||||
// completions = [":bookmark:", ":bookmark_tabs:", ...]
|
||||
|
Loading…
x
Reference in New Issue
Block a user