From 7fed35a627679e20003ee76a3015f84d395c85ac Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sat, 26 Nov 2022 23:38:06 +0200 Subject: fun restrained --- src/components/rich_content/rich_content.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/components/rich_content/rich_content.jsx') 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 } } + } case '': return [...children].reverse().map(processItemReverse).reverse() } -- cgit v1.2.3-70-g09d2