diff --git a/src/components/Option/Playground/PlaygroundForm.tsx b/src/components/Option/Playground/PlaygroundForm.tsx index 64c3683..a694149 100644 --- a/src/components/Option/Playground/PlaygroundForm.tsx +++ b/src/components/Option/Playground/PlaygroundForm.tsx @@ -71,7 +71,11 @@ export const PlaygroundForm = ({ dropedFile }: Props) => { } } } - + const handlePaste = (e: React.ClipboardEvent) => { + if (e.clipboardData.files.length > 0) { + onInputChange(e.clipboardData.files[0]) + } + } React.useEffect(() => { if (dropedFile) { onInputChange(dropedFile) @@ -219,6 +223,7 @@ export const PlaygroundForm = ({ dropedFile }: Props) => { ref={textareaRef} className="px-2 py-2 w-full resize-none bg-transparent focus-within:outline-none focus:ring-0 focus-visible:ring-0 ring-0 dark:ring-0 border-0 dark:text-gray-100" required + onPaste={handlePaste} rows={1} style={{ minHeight: "60px" }} tabIndex={0} diff --git a/src/components/Sidepanel/Chat/form.tsx b/src/components/Sidepanel/Chat/form.tsx index a5a0a2e..08c0659 100644 --- a/src/components/Sidepanel/Chat/form.tsx +++ b/src/components/Sidepanel/Chat/form.tsx @@ -83,6 +83,12 @@ export const SidepanelForm = ({ dropedFile }: Props) => { } } + const handlePaste = (e: React.ClipboardEvent) => { + if (e.clipboardData.files.length > 0) { + onInputChange(e.clipboardData.files[0]) + } + } + const { onSubmit, selectedModel, @@ -178,6 +184,7 @@ export const SidepanelForm = ({ dropedFile }: Props) => { ref={textareaRef} className="px-2 py-2 w-full resize-none bg-transparent focus-within:outline-none focus:ring-0 focus-visible:ring-0 ring-0 dark:ring-0 border-0 dark:text-gray-100" required + onPaste={handlePaste} rows={1} style={{ minHeight: "60px" }} tabIndex={0}