1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-19 23:40:07 +00:00
elk/components/common/CommonRichContent.ts

25 lines
527 B
TypeScript
Raw Normal View History

import type { Emoji } from 'masto'
import type { PropType } from 'vue'
import { emojisArrayToObject } from '~/composables/utils'
2022-11-20 21:21:53 +00:00
export default defineComponent({
props: {
content: {
type: String,
required: true,
},
emojis: {
type: Array as PropType<Emoji[]>,
},
2022-11-20 21:21:53 +00:00
},
setup(props) {
const emojiObject = emojisArrayToObject(props.emojis || [])
2022-11-22 23:08:36 +00:00
return () => h(
'div',
{ class: 'rich-content' },
contentToVNode(props.content, undefined, emojiObject),
2022-11-22 23:08:36 +00:00
)
2022-11-20 21:21:53 +00:00
},
})