feat: handle image paste in AI toolbar textarea via onPaste handler
This commit is contained in:
@@ -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 */}
|
||||||
|
|||||||
Reference in New Issue
Block a user