fix: don't decode HTML entities (&foo;
) until rendering (#465)
This commit is contained in:
parent
9a7c37db24
commit
f8ebc0e99a
4 changed files with 18 additions and 5 deletions
|
@ -4,7 +4,7 @@ import type { Node } from 'ultrahtml'
|
|||
import { Fragment, h, isVNode } from 'vue'
|
||||
import type { VNode } from 'vue'
|
||||
import { RouterLink } from 'vue-router'
|
||||
import { parseMastodonHTML } from './content-parse'
|
||||
import { decodeHtml, parseMastodonHTML } from './content-parse'
|
||||
import ContentCode from '~/components/content/ContentCode.vue'
|
||||
import AccountHoverWrapper from '~/components/account/AccountHoverWrapper.vue'
|
||||
|
||||
|
@ -45,11 +45,12 @@ export function nodeToVNode(node: Node): VNode | string | null {
|
|||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function treeToVNode(
|
||||
input: Node,
|
||||
): VNode | string | null {
|
||||
if (input.type === TEXT_NODE)
|
||||
return input.value as string
|
||||
return decodeHtml(input.value)
|
||||
|
||||
if ('children' in input) {
|
||||
const node = handleNode(input)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue