diff --git a/src/components/Parse/HTML.tsx b/src/components/Parse/HTML.tsx
index b42b28c8..bd0fd13a 100644
--- a/src/components/Parse/HTML.tsx
+++ b/src/components/Parse/HTML.tsx
@@ -76,9 +76,7 @@ const renderNode = ({
)
} else if (classes.includes('mention') && mentions) {
- const accountIndex = mentions.findIndex(
- mention => mention.url === href
- )
+ const accountIndex = mentions.findIndex(mention => mention.url === href)
const differentAccount = routeParams?.account
? routeParams.account.id !== mentions[accountIndex]?.id
: true
@@ -86,8 +84,7 @@ const renderNode = ({
`#${tag.name}` === content).length > 0
+ const content = node.children && node.children[0] && node.children[0].data
+ const shouldBeTag = tags && tags.filter(tag => `#${tag.name}` === content).length > 0
return (
- {(content && content !== href && content) ||
- (showFullLink ? href : domain[1])}
+ {(content && content !== href && content) || (showFullLink ? href : domain[1])}
{!shouldBeTag ? (
>()
+ const navigation = useNavigation>()
const route = useRoute()
const { colors, theme } = useTheme()
const { t, i18n } = useTranslation('componentParse')
@@ -254,7 +247,7 @@ const ParseHTML = React.memo(
return (
- {typeof totalLines === 'number' ? (
+ {typeof totalLines === 'number' || numberOfLines === 1 ? (
{
@@ -296,10 +289,7 @@ const ParseHTML = React.memo(
{
- if (
- numberOfLines === 1 ||
- nativeEvent.lines.length >= numberOfLines + 5
- ) {
+ if (numberOfLines === 1 || nativeEvent.lines.length >= numberOfLines + 5) {
setTotalLines(nativeEvent.lines.length)
}
}}
@@ -307,11 +297,7 @@ const ParseHTML = React.memo(
height: numberOfLines === 1 && !expanded ? 0 : undefined
}}
numberOfLines={
- typeof totalLines === 'number'
- ? expanded
- ? 999
- : numberOfLines
- : undefined
+ typeof totalLines === 'number' ? (expanded ? 999 : numberOfLines) : undefined
}
selectable={selectable}
/>
diff --git a/src/components/Timeline/Shared/Content.tsx b/src/components/Timeline/Shared/Content.tsx
index 25df7d5b..cfdbcbb7 100644
--- a/src/components/Timeline/Shared/Content.tsx
+++ b/src/components/Timeline/Shared/Content.tsx
@@ -9,18 +9,12 @@ export interface Props {
mentions?: Mastodon.Status['mentions']
tags?: Mastodon.Status['tags']
}
- numberOfLines?: number
highlighted?: boolean
disableDetails?: boolean
}
const TimelineContent = React.memo(
- ({
- status,
- numberOfLines,
- highlighted = false,
- disableDetails = false
- }: Props) => {
+ ({ status, highlighted = false, disableDetails = false }: Props) => {
const { t } = useTranslation('componentTimeline')
const instanceAccount = useSelector(getInstanceAccount, () => true)
@@ -46,9 +40,7 @@ const TimelineContent = React.memo(
emojis={status.emojis}
mentions={status.mentions}
tags={status.tags}
- numberOfLines={
- instanceAccount.preferences['reading:expand:spoilers'] ? 999 : 1
- }
+ numberOfLines={instanceAccount.preferences['reading:expand:spoilers'] ? 999 : 1}
expandHint={t('shared.content.expandHint')}
highlighted={highlighted}
disableDetails={disableDetails}
@@ -62,7 +54,7 @@ const TimelineContent = React.memo(
emojis={status.emojis}
mentions={status.mentions}
tags={status.tags}
- numberOfLines={highlighted ? 999 : numberOfLines}
+ numberOfLines={highlighted ? 999 : undefined}
disableDetails={disableDetails}
/>
)}