0cf5800463
Release APK / build (push) Has been cancelled
- Pass post.image[] as JSON prefillImages param when prefilling compose from an existing post (repost/edit/retry), replacing the broken single-image prefillImagePath/prefillImageId approach - MediaLibraryModal now shows the attempted URL and a clear explanation on 404, making it easier to diagnose if the Postiz version does not expose GET /media - stripHtml accepts null/undefined input and returns "" instead of throwing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 lines
636 B
TypeScript
21 lines
636 B
TypeScript
export function stripHtml(html: string | null | undefined): string {
|
|
if (!html) return "";
|
|
// Decode entities first so encoded tags like <p> are also stripped
|
|
let s = html
|
|
.replace(/&/g, "&")
|
|
.replace(/</g, "<")
|
|
.replace(/>/g, ">")
|
|
.replace(/"/g, '"')
|
|
.replace(/'/g, "'")
|
|
.replace(/ /g, " ");
|
|
// Block-level tags → newlines
|
|
s = s
|
|
.replace(/<br\s*\/?>/gi, "\n")
|
|
.replace(/<\/p>/gi, "\n")
|
|
.replace(/<\/div>/gi, "\n")
|
|
.replace(/<\/li>/gi, "\n");
|
|
// Strip all remaining tags
|
|
s = s.replace(/<[^>]+>/g, "");
|
|
return s.replace(/\n{3,}/g, "\n\n").trim();
|
|
}
|