feat: render custom server emojis on editor (#579)
This commit is contained in:
parent
847e64ef6d
commit
4d21d27f94
7 changed files with 144 additions and 9 deletions
|
@ -1,5 +1,6 @@
|
|||
import type { Emoji } from 'masto'
|
||||
import { emojisArrayToObject } from '~/composables/utils'
|
||||
import { currentCustomEmojis } from '~/composables/emojis'
|
||||
|
||||
defineOptions({
|
||||
name: 'ContentRich',
|
||||
|
@ -11,11 +12,21 @@ const { content, emojis, markdown = true } = defineProps<{
|
|||
emojis?: Emoji[]
|
||||
}>()
|
||||
|
||||
const useEmojis = computed(() => {
|
||||
const result: Emoji[] = []
|
||||
if (emojis)
|
||||
result.push(...emojis)
|
||||
|
||||
result.push(...currentCustomEmojis.value.emojis)
|
||||
|
||||
return emojisArrayToObject(result)
|
||||
})
|
||||
|
||||
export default () => h(
|
||||
'span',
|
||||
{ class: 'content-rich' },
|
||||
contentToVNode(content, {
|
||||
emojis: emojisArrayToObject(emojis || []),
|
||||
emojis: useEmojis.value,
|
||||
markdown,
|
||||
}),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue