mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-18 19:23:40 +00:00
Fix ellipsis placement
This commit is contained in:
parent
5977a4099f
commit
e2cf48eed9
@ -169,7 +169,7 @@ export const truncateContent = (content, {showEntire, maxLength, showMedia = fal
|
|||||||
const result = []
|
const result = []
|
||||||
const truncateAt = maxLength * 0.6
|
const truncateAt = maxLength * 0.6
|
||||||
|
|
||||||
for (const part of content) {
|
content.every((part, i) => {
|
||||||
const isText = [TOPIC, TEXT].includes(part.type)
|
const isText = [TOPIC, TEXT].includes(part.type)
|
||||||
const isMedia = [LINK, INVOICE].includes(part.type) || part.type.startsWith("nostr:")
|
const isMedia = [LINK, INVOICE].includes(part.type) || part.type.startsWith("nostr:")
|
||||||
|
|
||||||
@ -183,14 +183,16 @@ export const truncateContent = (content, {showEntire, maxLength, showMedia = fal
|
|||||||
|
|
||||||
result.push(part)
|
result.push(part)
|
||||||
|
|
||||||
if (length > truncateAt) {
|
if (length > truncateAt && i < content.length - 1) {
|
||||||
if (isText || (isMedia && !showMedia)) {
|
if (isText || (isMedia && !showMedia)) {
|
||||||
result.push({type: TEXT, value: "..."})
|
result.push({type: TEXT, value: "..."})
|
||||||
}
|
}
|
||||||
|
|
||||||
break
|
return false
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user