Hard-cap list view description snippet at 180 chars
line-clamp wasn't clamping reliably; truncate in JS instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,11 +6,12 @@ import { createDownload, toggleQueue, toggleLike, dismissDiscovery, getSettings
|
|||||||
|
|
||||||
function snippetText(desc) {
|
function snippetText(desc) {
|
||||||
if (!desc) return "";
|
if (!desc) return "";
|
||||||
return desc
|
const s = desc
|
||||||
.replace(/https?:\/\/\S+/g, "") // strip URLs
|
.replace(/https?:\/\/\S+/g, "")
|
||||||
.replace(/\n+/g, " ") // flatten newlines
|
.replace(/\n+/g, " ")
|
||||||
.replace(/\s{2,}/g, " ") // collapse whitespace
|
.replace(/\s{2,}/g, " ")
|
||||||
.trim();
|
.trim();
|
||||||
|
return s.length > 180 ? s.slice(0, 180).trimEnd() + "…" : s;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatDuration(secs) {
|
function formatDuration(secs) {
|
||||||
|
|||||||
Reference in New Issue
Block a user