mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-02 02:00:49 +08:00
fix(core): filters emojipicker on label in addition to tags (#15129)
Fixes #15116 # Issue Emojipicker keyword filtering only filtered on `tags`, and not `label`. So searching for an emoji's name would not result in said emoji ending up in the result. E.G. searching "sunflower" does not make 🌻 appear # Solution Adding an extra condition to the filter function to check if the keyword is a substring of an emoji's label # Result Search results now include emojis with that `label` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Improved emoji picker search to include matches on both emoji labels and tags (case-insensitive), enabling broader search results for better discoverability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -123,8 +123,12 @@ export const EmojiGroups = memo(function EmojiGroups({
|
||||
emojiGroupList
|
||||
.map(group => ({
|
||||
...group,
|
||||
emojis: group.emojis.filter(emoji =>
|
||||
emoji.tags?.some(tag => tag.includes(keyword.toLowerCase()))
|
||||
emojis: group.emojis.filter(
|
||||
emoji =>
|
||||
emoji.label.toLowerCase().includes(keyword.toLowerCase()) ||
|
||||
emoji.tags?.some(tag =>
|
||||
tag.toLowerCase().includes(keyword.toLowerCase())
|
||||
)
|
||||
),
|
||||
}))
|
||||
.filter(group => group.emojis.length > 0)
|
||||
|
||||
Reference in New Issue
Block a user