feat: handle image paste in AI toolbar textarea via onPaste handler

This commit is contained in:
2026-04-08 19:58:36 -04:00
parent b3121ed532
commit 1c864f162e

View File

@@ -33,6 +33,7 @@ import {
} from "@/components/ui/popover"; } from "@/components/ui/popover";
import { Skeleton } from "@/components/ui/skeleton"; import { Skeleton } from "@/components/ui/skeleton";
import { Textarea } from "@/components/ui/textarea"; import { Textarea } from "@/components/ui/textarea";
import { extractImageFromClipboard } from "@/lib/clipboard-image";
import { import {
SHORTCUT_DEFINITIONS, SHORTCUT_DEFINITIONS,
detectOs, detectOs,
@@ -192,6 +193,13 @@ export const AIToolbar = ({
setAiPrompt(""); setAiPrompt("");
} }
}} }}
onPaste={(e) => {
const image = extractImageFromClipboard(e.clipboardData ?? null);
if (image) {
e.preventDefault();
onImageSelect(image);
}
}}
/> />
{/* Attached image preview */} {/* Attached image preview */}