mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-11 01:40:32 +00:00
Fix combined tones emoji
Signed-off-by: Anton Alexeyev <alexeyev.anton@gmail.com>
This commit is contained in:
parent
2d2f4dbfd5
commit
ea5616d9b2
@ -5,8 +5,8 @@
|
||||
//
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import type { Emoji } from 'emojibase'
|
||||
import type { EmojiWithGroup } from '.'
|
||||
import { EmojiButton, getEmoji, getSkinTone, emojiStore } from '.'
|
||||
import { EmojiWithGroup, getEmojiForHexcode, getSkinnedEmojiTest } from '.'
|
||||
import { EmojiButton, getSkinTone, emojiStore } from '.'
|
||||
import { Label, IconDelete, closeTooltip, ButtonBase } from '../..'
|
||||
import plugin from '../../plugin'
|
||||
import SkinToneTooltip from './SkinToneTooltip.svelte'
|
||||
@ -28,8 +28,8 @@
|
||||
const def = $emojiStore[168]
|
||||
const temp = e.skins?.find((skin) => Array.isArray(skin.tone) && skin.tone.length > 1)?.hexcode.split('-200D-')
|
||||
if (temp === undefined || temp.length < 2) return [def, def]
|
||||
const firstEmoji = getEmoji(temp[0].slice(0, -6))?.emoji ?? def
|
||||
const secondEmoji = getEmoji(temp[temp.length - 1].slice(0, -6))?.emoji ?? def
|
||||
const firstEmoji = getEmojiForHexcode(temp[0].slice(0, -6)) ?? def
|
||||
const secondEmoji = getEmojiForHexcode(temp[temp.length - 1].slice(0, -6)) ?? def
|
||||
return [firstEmoji, secondEmoji]
|
||||
}
|
||||
const emojiParts = getEmojiParts(emoji)
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
const skins: Emoji[] = emoji.skins ?? []
|
||||
const skins: Emoji[] = emoji.skins !== undefined ? [emoji, ...emoji.skins] : []
|
||||
</script>
|
||||
|
||||
<div class="flex-row-center flex-gap-1">
|
||||
|
@ -72,6 +72,10 @@ export async function updateEmojis (lang?: string): Promise<void> {
|
||||
emojiStore.set(emojis)
|
||||
}
|
||||
|
||||
export function getEmojiForHexcode (hexcode: string): EmojiWithGroup | undefined {
|
||||
return get(emojiStore).find((e) => e.hexcode === hexcode)
|
||||
}
|
||||
|
||||
export function getSkinnedEmoji (shortcode: string | undefined, skinTone?: number): Emoji | undefined {
|
||||
if (shortcode === undefined) return undefined
|
||||
const shortcodeSlice = shortcode.slice(1, -1)
|
||||
@ -148,7 +152,7 @@ export const getFrequentlyEmojis = (): EmojiWithGroup[] | undefined => {
|
||||
const parsedEmojis = JSON.parse(frequentlyEmojis)
|
||||
if (!Array.isArray(parsedEmojis)) return undefined
|
||||
const emojis = get(emojiStore)
|
||||
return emojis.filter(e => parsedEmojis.find(pe => pe.hexcode === e.hexcode) !== undefined)
|
||||
return emojis.filter(e => parsedEmojis.find(pe => pe.hexcode === e.hexcode || e.skins?.find(s => s.hexcode === pe.hexcode) !== undefined) !== undefined)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return undefined
|
||||
|
Loading…
Reference in New Issue
Block a user