dify/web/utils/emoji.ts

12 lines
303 B
TypeScript
Raw Normal View History

2024-08-08 15:29:11 +08:00
import { SearchIndex } from 'emoji-mart'
import type { Emoji } from '@emoji-mart/data'
export async function searchEmoji(value: string) {
const emojis: Emoji[] = await SearchIndex.search(value) || []
const results = emojis.map((emoji) => {
return emoji.skins[0].native
})
return results
}