media drag and drop in chat view

This commit is contained in:
lemonknowsall committed 2026-01-16 22:50:31 -08:00
1 parent eb381bc37e
commit 7a4cd6cd00
1 file changed
+16 -1
+16 -1
View File
@@ -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 (
<div className="border-t p-4">
{/* Chat Input Container */}
@@ -99,7 +114,7 @@ export const ChatInput = memo(function ChatInput({
onDragEnter={onDragEnter}
onDragOver={onDragOver}
onDragLeave={onDragLeave}
onDrop={onDrop}
onDrop={handleDrop}
>
<Textarea
value={input}