mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 02:19:05 +08:00
fix(web): reserve default copy behavior (#1693)
This commit is contained in:
parent
2e588ae221
commit
5789d76582
@ -197,13 +197,13 @@ export const useClipboardUploader = ({ visionConfig, onUpload, files }: useClipb
|
|||||||
const { handleLocalFileUpload } = useLocalFileUploader({ limit, onUpload, disabled })
|
const { handleLocalFileUpload } = useLocalFileUploader({ limit, onUpload, disabled })
|
||||||
|
|
||||||
const handleClipboardPaste = useCallback((e: ClipboardEvent<HTMLTextAreaElement>) => {
|
const handleClipboardPaste = useCallback((e: ClipboardEvent<HTMLTextAreaElement>) => {
|
||||||
e.preventDefault()
|
// reserve native text copy behavior
|
||||||
const file = e.clipboardData?.files[0]
|
const file = e.clipboardData?.files[0]
|
||||||
|
// when copyed file, prevent default action
|
||||||
if (!file)
|
if (file) {
|
||||||
return
|
e.preventDefault()
|
||||||
|
handleLocalFileUpload(file)
|
||||||
handleLocalFileUpload(file)
|
}
|
||||||
}, [handleLocalFileUpload])
|
}, [handleLocalFileUpload])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user