elk/components/content/ContentRich.ts

25 lines
516 B
TypeScript
Raw Normal View History

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