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 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' },
2022-11-24 03:42:03 +00:00
contentToVNode(props.content, emojiObject),
2022-11-22 23:08:36 +00:00
)
2022-11-20 21:21:53 +00:00
},
})