mirror of https://github.com/tooot-app/app
Attempt to fix super long toots breaking maintain position
This commit is contained in:
parent
f1b162a020
commit
82928f8611
|
@ -69,6 +69,7 @@ const ParseHTML: React.FC<Props> = ({
|
||||||
|
|
||||||
const [followedTags] = useAccountStorage.object('followed_tags')
|
const [followedTags] = useAccountStorage.object('followed_tags')
|
||||||
|
|
||||||
|
const MAX_ALLOWED_LINES = 30
|
||||||
const [totalLines, setTotalLines] = useState<number>()
|
const [totalLines, setTotalLines] = useState<number>()
|
||||||
const [expanded, setExpanded] = useState(highlighted)
|
const [expanded, setExpanded] = useState(highlighted)
|
||||||
|
|
||||||
|
@ -275,7 +276,12 @@ const ParseHTML: React.FC<Props> = ({
|
||||||
hint: expandHint,
|
hint: expandHint,
|
||||||
moreLines:
|
moreLines:
|
||||||
numberOfLines > 1 && typeof totalLines === 'number'
|
numberOfLines > 1 && typeof totalLines === 'number'
|
||||||
? t('HTML.moreLines', { count: totalLines - numberOfLines })
|
? t('HTML.moreLines', {
|
||||||
|
count:
|
||||||
|
totalLines === MAX_ALLOWED_LINES
|
||||||
|
? (`${totalLines - numberOfLines}+` as unknown as number)
|
||||||
|
: totalLines - numberOfLines
|
||||||
|
})
|
||||||
: ''
|
: ''
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
|
@ -304,7 +310,7 @@ const ParseHTML: React.FC<Props> = ({
|
||||||
height: numberOfLines === 1 && !expanded ? 0 : undefined
|
height: numberOfLines === 1 && !expanded ? 0 : undefined
|
||||||
}}
|
}}
|
||||||
numberOfLines={
|
numberOfLines={
|
||||||
typeof totalLines === 'number' ? (expanded ? 999 : numberOfLines) : undefined
|
typeof totalLines === 'number' ? (expanded ? 999 : numberOfLines) : MAX_ALLOWED_LINES
|
||||||
}
|
}
|
||||||
selectable={selectable}
|
selectable={selectable}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue