feat: support custom emojis from other servers

This commit is contained in:
Anthony Fu 2022-11-23 07:42:20 +08:00
parent f3a0a5af3f
commit 6d66bbbc5d
10 changed files with 40 additions and 16 deletions

View file

@ -1,16 +1,24 @@
import type { Emoji } from 'masto'
import type { PropType } from 'vue'
import { emojisArrayToObject } from '~/composables/utils'
export default defineComponent({
props: {
content: {
type: String,
required: true,
},
emojis: {
type: Array as PropType<Emoji[]>,
},
},
setup(props) {
const serverInfos = useServerInfo(currentServer.value)
const emojiObject = emojisArrayToObject(props.emojis || [])
return () => h(
'div',
{ class: 'rich-content' },
contentToVNode(props.content, undefined, serverInfos.value?.customEmojis),
contentToVNode(props.content, undefined, emojiObject),
)
},
})