elk/components/common/RichContent.ts

23 lines
557 B
TypeScript
Raw Normal View History

2022-11-21 07:14:07 +00:00
import type { Emoji } from 'masto'
2022-11-20 21:21:53 +00:00
export default defineComponent({
props: {
content: {
type: String,
required: true,
},
},
setup(props) {
2022-11-21 07:14:07 +00:00
const emojis = shallowRef<Record<string, Emoji>>({})
onMounted(() => {
const { server } = useAppCookies()
const { serverInfos } = useClientState()
if (server.value)
emojis.value = serverInfos.value[server.value].customEmojis || {}
})
return () => h('div', { class: 'rich-content' }, contentToVNode(props.content, undefined, emojis.value))
2022-11-20 21:21:53 +00:00
},
})