fix(web): reserve default copy behavior (#1693)

This commit is contained in:
Rhon Joe 2023-12-05 16:34:12 +08:00 committed by GitHub
parent 2e588ae221
commit 5789d76582
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -197,13 +197,13 @@ export const useClipboardUploader = ({ visionConfig, onUpload, files }: useClipb
const { handleLocalFileUpload } = useLocalFileUploader({ limit, onUpload, disabled })
const handleClipboardPaste = useCallback((e: ClipboardEvent<HTMLTextAreaElement>) => {
e.preventDefault()
// reserve native text copy behavior
const file = e.clipboardData?.files[0]
if (!file)
return
handleLocalFileUpload(file)
// when copyed file, prevent default action
if (file) {
e.preventDefault()
handleLocalFileUpload(file)
}
}, [handleLocalFileUpload])
return {