diff --git a/src/components/ComposeBox.tsx b/src/components/ComposeBox.tsx index b1726112..392b6f85 100644 --- a/src/components/ComposeBox.tsx +++ b/src/components/ComposeBox.tsx @@ -227,6 +227,19 @@ export function ComposeBox({ onSuccess, placeholder = "What's on your mind?", co }; }, [user, content]); + // Extract images and videos for preview mode + const previewImages = useMemo(() => { + if (!content) return []; + const urlRegex = /https?:\/\/[^\s]+\.(jpg|jpeg|png|gif|webp|svg)(\?[^\s]*)?/gi; + return content.match(urlRegex) || []; + }, [content]); + + const previewVideos = useMemo(() => { + if (!content) return []; + const urlRegex = /https?:\/\/[^\s]+\.(mp4|webm|mov)(\?[^\s]*)?/gi; + return content.match(urlRegex) || []; + }, [content]); + const insertEmoji = useCallback((emoji: string) => { const textarea = textareaRef.current; if (textarea) { @@ -429,6 +442,27 @@ export function ComposeBox({ onSuccess, placeholder = "What's on your mind?", co