refactor: html parsing
This commit is contained in:
parent
d76e4bfaa5
commit
6944a74653
8 changed files with 152 additions and 124 deletions
|
@ -4,27 +4,23 @@ defineOptions({
|
|||
name: 'ContentRich',
|
||||
})
|
||||
|
||||
const { content, emojis, markdown = true } = defineProps<{
|
||||
const {
|
||||
content,
|
||||
emojis,
|
||||
markdown = true,
|
||||
} = defineProps<{
|
||||
content: string
|
||||
markdown?: boolean
|
||||
emojis?: Emoji[]
|
||||
markdown?: boolean
|
||||
}>()
|
||||
|
||||
const useEmojis = computed(() => {
|
||||
const result: Emoji[] = []
|
||||
if (emojis)
|
||||
result.push(...emojis)
|
||||
|
||||
result.push(...currentCustomEmojis.value.emojis)
|
||||
|
||||
return emojisArrayToObject(result)
|
||||
})
|
||||
const emojisObject = useEmojisFallback(() => emojis)
|
||||
|
||||
export default () => h(
|
||||
'span',
|
||||
{ class: 'content-rich', dir: 'auto' },
|
||||
contentToVNode(content, {
|
||||
emojis: useEmojis.value,
|
||||
emojis: emojisObject.value,
|
||||
markdown,
|
||||
}),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue