1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-05 00:19:59 +00:00
elk/components/common/CommonRichContent.ts
2022-11-24 11:42:03 +08:00

25 lines
516 B
TypeScript

import type { Emoji } from 'masto'
import type { PropType } from 'vue'
import { emojisArrayToObject } from '~/composables/utils'
export default defineComponent({
props: {
content: {
type: String,
required: true,
},
emojis: {
type: Array as PropType<Emoji[]>,
},
},
setup(props) {
const emojiObject = emojisArrayToObject(props.emojis || [])
return () => h(
'div',
{ class: 'rich-content' },
contentToVNode(props.content, emojiObject),
)
},
})