2022-11-22 23:42:20 +00:00
|
|
|
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,
|
|
|
|
},
|
2022-11-22 23:42:20 +00:00
|
|
|
emojis: {
|
|
|
|
type: Array as PropType<Emoji[]>,
|
|
|
|
},
|
2022-11-20 21:21:53 +00:00
|
|
|
},
|
|
|
|
setup(props) {
|
2022-11-22 23:42:20 +00:00
|
|
|
const emojiObject = emojisArrayToObject(props.emojis || [])
|
|
|
|
|
2022-11-22 23:08:36 +00:00
|
|
|
return () => h(
|
|
|
|
'div',
|
|
|
|
{ class: 'rich-content' },
|
2022-11-22 23:42:20 +00:00
|
|
|
contentToVNode(props.content, undefined, emojiObject),
|
2022-11-22 23:08:36 +00:00
|
|
|
)
|
2022-11-20 21:21:53 +00:00
|
|
|
},
|
|
|
|
})
|