diff --git a/artifacts/postiz-mobile/app/(tabs)/posts.tsx b/artifacts/postiz-mobile/app/(tabs)/posts.tsx index a2ce60f..0aa7fde 100644 --- a/artifacts/postiz-mobile/app/(tabs)/posts.tsx +++ b/artifacts/postiz-mobile/app/(tabs)/posts.tsx @@ -22,6 +22,7 @@ import { PostCard } from "@/components/PostCard"; import { PostizPost, usePostiz } from "@/context/PostizContext"; import { useColors } from "@/hooks/useColors"; import { extractError } from "@/lib/extractError"; +import { stripHtml } from "@/lib/stripHtml"; const SORT_STORAGE_KEY = "postiz_posts_sort"; @@ -193,14 +194,15 @@ export default function PostsScreen() { const showContextMenu = (post: PostizPost) => { Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium); - const preview = post.content.slice(0, 60) + (post.content.length > 60 ? "…" : ""); + const plain = stripHtml(post.content); + const preview = plain.slice(0, 60) + (plain.length > 60 ? "…" : ""); const buttons: Array<{ text: string; style?: "cancel" | "destructive" | "default"; onPress?: () => void }> = []; buttons.push({ text: "Copy text", onPress: async () => { - await Clipboard.setStringAsync(post.content); + await Clipboard.setStringAsync(stripHtml(post.content)); Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success); setCopyToast(true); setTimeout(() => setCopyToast(false), 2000); diff --git a/artifacts/postiz-mobile/assets/images/icon.png b/artifacts/postiz-mobile/assets/images/icon.png index ad57273..1070d85 100644 Binary files a/artifacts/postiz-mobile/assets/images/icon.png and b/artifacts/postiz-mobile/assets/images/icon.png differ diff --git a/artifacts/postiz-mobile/components/PostCard.tsx b/artifacts/postiz-mobile/components/PostCard.tsx index fe74f0e..5a558e6 100644 --- a/artifacts/postiz-mobile/components/PostCard.tsx +++ b/artifacts/postiz-mobile/components/PostCard.tsx @@ -12,6 +12,7 @@ import { import { Swipeable } from "react-native-gesture-handler"; import { useColors } from "@/hooks/useColors"; import { PostizPost } from "@/context/PostizContext"; +import { stripHtml } from "@/lib/stripHtml"; import { StatusBadge } from "./StatusBadge"; interface PostCardProps { @@ -118,10 +119,11 @@ export function PostCard({ post, onDelete, onLongPress, onReschedule }: PostCard : undefined; const integrations = post.integrations ?? (post.integration ? [post.integration] : []); + const plainContent = stripHtml(post.content); const truncatedContent = - post.content.length > 140 - ? post.content.slice(0, 140) + "…" - : post.content; + plainContent.length > 140 + ? plainContent.slice(0, 140) + "…" + : plainContent; return ( /gi, "\n") + .replace(/<\/p>/gi, "\n") + .replace(/<[^>]+>/g, "") + .replace(/&/g, "&") + .replace(/</g, "<") + .replace(/>/g, ">") + .replace(/"/g, '"') + .replace(/'/g, "'") + .replace(/ /g, " ") + .replace(/\n{3,}/g, "\n\n") + .trim(); +}