From 7a4cd6cd00adc24c23582c2d2a43e041f571af72 Mon Sep 17 00:00:00 2001 From: lemonknowsall Date: Fri, 16 Jan 2026 22:48:34 -0800 Subject: [PATCH] media drag and drop in chat view --- src/components/Shakespeare/ChatInput.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/components/Shakespeare/ChatInput.tsx b/src/components/Shakespeare/ChatInput.tsx index 5c4fef04..3045fc6b 100644 --- a/src/components/Shakespeare/ChatInput.tsx +++ b/src/components/Shakespeare/ChatInput.tsx @@ -89,6 +89,21 @@ export const ChatInput = memo(function ChatInput({ setInput(e.target.value); }, []); + const handleDrop = useCallback((e: React.DragEvent) => { + e.preventDefault(); + e.stopPropagation(); + + // Call parent's drop handler for visual state management + onDrop(e); + + // Extract files from the drop event + const files = Array.from(e.dataTransfer.files); + if (files.length === 0) return; + + // Add all files without validation + setAttachedFiles(prev => [...prev, ...files]); + }, [onDrop]); + return (
{/* Chat Input Container */} @@ -99,7 +114,7 @@ export const ChatInput = memo(function ChatInput({ onDragEnter={onDragEnter} onDragOver={onDragOver} onDragLeave={onDragLeave} - onDrop={onDrop} + onDrop={handleDrop} >