Allow pasting images into the chat input

This commit is contained in:
2026-09-11 17:25:13 -04:00
parent 2988482791
commit 1e4942e0b8
@@ -65,6 +65,22 @@ export const MessageInput = React.memo(
e.target.value = "";
};
const handlePaste = (e: React.ClipboardEvent<HTMLTextAreaElement>) => {
if (isLoading) return;
const items = e.clipboardData?.items;
if (!items) return;
for (const item of items) {
if (item.type.startsWith("image/")) {
const file = item.getAsFile();
if (file) {
e.preventDefault();
onImageSelect(file);
return;
}
}
}
};
const canSend = !isLoading && Boolean(query.trim() || pendingImage);
return (
@@ -100,6 +116,7 @@ export const MessageInput = React.memo(
ref={textareaRef}
onChange={handleQueryChange}
onKeyDown={handleKeyDown}
onPaste={handlePaste}
value={query}
rows={2}
placeholder="Ask Simba anything..."