Strip emoji variation when searching emoji by emoji (#11221)

This commit is contained in:
Michael Telatynski 2023-07-12 08:26:13 +01:00 committed by GitHub
parent c5befa1ef8
commit 44615b2b04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -306,6 +306,10 @@ class EmojiPicker extends React.Component<IProps, IState> {
};
private emojiMatchesFilter = (emoji: IEmoji, filter: string): boolean => {
// If the query is an emoji containing a variation then strip it to provide more useful matches
if (filter.includes(ZERO_WIDTH_JOINER)) {
filter = filter.split(ZERO_WIDTH_JOINER, 2)[0];
}
return (
emoji.label.toLowerCase().includes(filter) ||
(Array.isArray(emoji.emoticon)