forked from enviPath/enviPy
fix: handle line-clamp issue with news
This commit is contained in:
@ -63,17 +63,17 @@ class DiscourseAPI {
|
|||||||
* @returns {string} Cleaned excerpt
|
* @returns {string} Cleaned excerpt
|
||||||
*/
|
*/
|
||||||
extractExcerpt(excerpt) {
|
extractExcerpt(excerpt) {
|
||||||
if (!excerpt) return 'Click to read more...';
|
if (!excerpt) return 'Click to read more';
|
||||||
|
|
||||||
// Remove HTML tags and clean up
|
// Remove HTML tags and clean up; collapse whitespace; do not add manual ellipsis
|
||||||
return excerpt
|
return excerpt
|
||||||
.replace(/<[^>]*>/g, '') // Remove HTML tags
|
.replace(/<[^>]*>/g, '') // Remove HTML tags
|
||||||
.replace(/ /g, ' ') // Replace with spaces
|
.replace(/ /g, ' ') // Replace with spaces
|
||||||
.replace(/&/g, '&') // Replace & with &
|
.replace(/&/g, '&') // Replace & with &
|
||||||
.replace(/</g, '<') // Replace < with <
|
.replace(/</g, '<') // Replace < with <
|
||||||
.replace(/>/g, '>') // Replace > with >
|
.replace(/>/g, '>') // Replace > with >
|
||||||
|
.replace(/\s+/g, ' ') // Collapse all whitespace/newlines
|
||||||
.trim()
|
.trim()
|
||||||
.substring(0, 200) + '...'; // Limit length
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -192,7 +192,9 @@
|
|||||||
${topic.title}
|
${topic.title}
|
||||||
</a>
|
</a>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="text-sm line-clamp-4 mb-2 h-20 text-ellipsis wrap-break-word overflow-hidden">${topic.excerpt}</p>
|
<div class="text-sm line-clamp-4 break-words" >
|
||||||
|
${topic.excerpt}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-row items-center justify-between">
|
<div class="flex flex-row items-center justify-between">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user