Update form components to handle pasted files
This commit is contained in:
parent
160927a5a6
commit
e623cc5ead
@ -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}
|
||||
|
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user