aboutsummaryrefslogtreecommitdiff
path: root/src/components/rich_content
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2022-11-26 23:38:06 +0200
committerHenry Jameson <me@hjkos.com>2022-11-26 23:38:06 +0200
commit7fed35a627679e20003ee76a3015f84d395c85ac (patch)
tree1a4c0d7f2557d0a166e589a66a58619058b51654 /src/components/rich_content
parent045a222183ac47b48e14e1639e7107aa0bffb015 (diff)
fun restrained
Diffstat (limited to 'src/components/rich_content')
-rw-r--r--src/components/rich_content/rich_content.jsx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/components/rich_content/rich_content.jsx b/src/components/rich_content/rich_content.jsx
index ca075270..8a5758af 100644
--- a/src/components/rich_content/rich_content.jsx
+++ b/src/components/rich_content/rich_content.jsx
@@ -179,7 +179,7 @@ export default {
break
}
case 'span':
- if (this.handleLinks && attrs['class'] && attrs['class'].includes('h-card')) {
+ if (this.handleLinks && attrs.class && attrs.class.includes('h-card')) {
return ['', children.map(processItem), '']
}
}
@@ -213,13 +213,13 @@ export default {
const [opener, children] = item
const Tag = opener === '' ? '' : getTagName(opener)
switch (Tag) {
- case 'a': // replace mentions with MentionLink
+ case 'a': { // replace mentions with MentionLink
if (!this.handleLinks) break
const attrs = getAttrs(opener)
// should only be this
if (
- (attrs['class'] && attrs['class'].includes('hashtag')) || // Pleroma style
- (attrs['rel'] === 'tag') // Mastodon style
+ (attrs.class && attrs.class.includes('hashtag')) || // Pleroma style
+ (attrs.rel === 'tag') // Mastodon style
) {
return renderHashtag(attrs, children, encounteredTextReverse)
} else {
@@ -230,6 +230,7 @@ export default {
{ newChildren }
</a>
}
+ }
case '':
return [...children].reverse().map(processItemReverse).reverse()
}