mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-05 00:19:59 +00:00
33 lines
660 B
TypeScript
33 lines
660 B
TypeScript
import type { Emoji } from 'masto'
|
|
import { emojisArrayToObject } from '~/composables/utils'
|
|
import { currentCustomEmojis } from '~/composables/emojis'
|
|
|
|
defineOptions({
|
|
name: 'ContentRich',
|
|
})
|
|
|
|
const { content, emojis, markdown = true } = defineProps<{
|
|
content: string
|
|
markdown?: boolean
|
|
emojis?: Emoji[]
|
|
}>()
|
|
|
|
const useEmojis = computed(() => {
|
|
const result: Emoji[] = []
|
|
if (emojis)
|
|
result.push(...emojis)
|
|
|
|
result.push(...currentCustomEmojis.value.emojis)
|
|
|
|
return emojisArrayToObject(result)
|
|
})
|
|
|
|
export default () => h(
|
|
'span',
|
|
{ class: 'content-rich' },
|
|
contentToVNode(content, {
|
|
emojis: useEmojis.value,
|
|
markdown,
|
|
}),
|
|
)
|