fix masto link handling

This commit is contained in:
FloatingGhost 2022-01-29 13:09:55 +00:00
parent 1bc05e87e4
commit 41991bcac2

View file

@ -110,9 +110,19 @@ export default Vue.component('RichContent', {
const renderLink = (attrs, children) => {
const updatedLink = attrs['href'].replace(/&/g, '&')
const updatedChildren = children.map(child => child.replace(attrs['href'], updatedLink))
const updatedChildren = children.map(child => {
if (typeof child === 'string') {
return child.replace(attrs['href'], updatedLink)
}
if (child[0] === '<span>') {
return <span>
{ child[1] }
</span>
}
return child[1]
})
return <a {...{ attrs }} href={updatedLink}>
{ updatedChildren }
{ ...updatedChildren }
</a>
}
// Processor to use with html_tree_converter