fix masto link handling
This commit is contained in:
parent
1bc05e87e4
commit
41991bcac2
1 changed files with 12 additions and 2 deletions
|
@ -110,9 +110,19 @@ export default Vue.component('RichContent', {
|
||||||
|
|
||||||
const renderLink = (attrs, children) => {
|
const renderLink = (attrs, children) => {
|
||||||
const updatedLink = attrs['href'].replace(/&/g, '&')
|
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}>
|
return <a {...{ attrs }} href={updatedLink}>
|
||||||
{ updatedChildren }
|
{ ...updatedChildren }
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
// Processor to use with html_tree_converter
|
// Processor to use with html_tree_converter
|
||||||
|
|
Loading…
Reference in a new issue