mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-19 18:13:41 -05:00
web/emoji: allow custom emojis in frequently used
This commit is contained in:
parent
808bdbc068
commit
21e2dcbc43
2 changed files with 12 additions and 5 deletions
|
@ -127,9 +127,6 @@ export default class Client {
|
|||
}
|
||||
|
||||
async incrementFrequentlyUsedEmoji(targetEmoji: string) {
|
||||
if (targetEmoji.startsWith("mxc://")) {
|
||||
return
|
||||
}
|
||||
let recentEmoji = this.store.accountData.get("io.element.recent_emoji")?.recent_emoji as
|
||||
[string, number][] | undefined
|
||||
if (!Array.isArray(recentEmoji)) {
|
||||
|
|
|
@ -199,7 +199,17 @@ export function useFilteredEmojis(query: string, params: useEmojisParams = {}):
|
|||
}
|
||||
return Array.from(params.frequentlyUsed.keys()
|
||||
.map(key => {
|
||||
const emoji = emojiMap.get(key)
|
||||
let emoji: Emoji | undefined
|
||||
if (key.startsWith("mxc://")) {
|
||||
for (const pack of params.customEmojiPacks?.values() ?? []) {
|
||||
emoji = pack.emojiMap.get(key)
|
||||
if (emoji) {
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
emoji = emojiMap.get(key)
|
||||
}
|
||||
if (!emoji) {
|
||||
return undefined
|
||||
}
|
||||
|
@ -207,7 +217,7 @@ export function useFilteredEmojis(query: string, params: useEmojisParams = {}):
|
|||
})
|
||||
.filter(emoji => emoji !== undefined))
|
||||
.filter((_emoji, index) => index < 24)
|
||||
}, [params.frequentlyUsed])
|
||||
}, [params.frequentlyUsed, params.customEmojiPacks])
|
||||
const prev = useRef<filteredEmojiCache>({
|
||||
query: "",
|
||||
result: [],
|
||||
|
|
Loading…
Add table
Reference in a new issue