aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2021-06-16 01:20:20 +0300
committerHenry Jameson <me@hjkos.com>2021-06-16 01:20:20 +0300
commitad3a2fd4e5a7811107790cfba0cd83e33d2f4115 (patch)
treee478c7a7c04cf0c94fca99ba9f020d49b3e203e8 /src
parent4aac0125e591c6f2ef51bad475e79802be51f068 (diff)
fixed "invisible" spans inside links
Diffstat (limited to 'src')
-rw-r--r--src/components/rich_content/rich_content.jsx26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/components/rich_content/rich_content.jsx b/src/components/rich_content/rich_content.jsx
index c8e1af9c..ce562f13 100644
--- a/src/components/rich_content/rich_content.jsx
+++ b/src/components/rich_content/rich_content.jsx
@@ -164,17 +164,15 @@ export default Vue.component('RichContent', {
case 'a': // replace mentions with MentionLink
if (!this.handleLinks) break
if (attrs['class'] && attrs['class'].includes('mention')) {
+ // Handling mentions here
return renderMention(attrs, children, encounteredText)
- } else if (attrs['class'] && attrs['class'].includes('hashtag')) {
+ } else {
+ // Everything else will be handled in reverse pass
encounteredText = true
return item // We'll handle it later
- } else {
- attrs.target = '_blank'
- return <a {...{ attrs }}>
- { children.map(processItem) }
- </a>
}
}
+
if (children !== undefined) {
return [opener, children.map(processItem), closer]
} else {
@@ -203,16 +201,28 @@ export default Vue.component('RichContent', {
// should only be this
if (attrs['class'] && attrs['class'].includes('hashtag')) {
return renderHashtag(attrs, children, encounteredTextReverse)
+ } else {
+ attrs.target = '_blank'
+ html.includes('freenode') && console.log('PASS1', children)
+ const newChildren = [...children].reverse().map(processItemReverse).reverse()
+ html.includes('freenode') && console.log('PASS1b', newChildren)
+
+ return <a {...{ attrs }}>
+ { newChildren }
+ </a>
}
- break
case '':
return [...children].reverse().map(processItemReverse).reverse()
}
// Render tag as is
if (children !== undefined) {
+ html.includes('freenode') && console.log('PASS2', children)
+ const newChildren = Array.isArray(children)
+ ? [...children].reverse().map(processItemReverse).reverse()
+ : children
return <Tag {...{ attrs: getAttrs(opener) }}>
- { Array.isArray(children) ? [...children].reverse().map(processItemReverse).reverse() : children }
+ { newChildren }
</Tag>
} else {
return <Tag/>