diff --git a/artifacts/postiz-mobile/app/(tabs)/posts.tsx b/artifacts/postiz-mobile/app/(tabs)/posts.tsx
index 0aa7fde..0e17c69 100644
--- a/artifacts/postiz-mobile/app/(tabs)/posts.tsx
+++ b/artifacts/postiz-mobile/app/(tabs)/posts.tsx
@@ -155,7 +155,7 @@ export default function PostsScreen() {
router.push({
pathname: "/(tabs)/compose",
params: {
- prefillContent: post.content,
+ prefillContent: stripHtml(post.content),
prefillIntegrationIds: integrations.map((i) => i.id).join(","),
},
});
diff --git a/artifacts/postiz-mobile/lib/stripHtml.ts b/artifacts/postiz-mobile/lib/stripHtml.ts
index 172b0d2..af3c46c 100644
--- a/artifacts/postiz-mobile/lib/stripHtml.ts
+++ b/artifacts/postiz-mobile/lib/stripHtml.ts
@@ -1,14 +1,19 @@
export function stripHtml(html: string): string {
- return html
- .replace(/
/gi, "\n")
- .replace(/<\/p>/gi, "\n")
- .replace(/<[^>]+>/g, "")
+ // 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, " ")
- .replace(/\n{3,}/g, "\n\n")
- .trim();
+ .replace(/ /g, " ");
+ // Block-level tags → newlines
+ s = s
+ .replace(/
/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();
}