Selaa lähdekoodia

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

Rhon Joe 1 vuosi sitten
vanhempi
commit
5789d76582
1 muutettua tiedostoa jossa 6 lisäystä ja 6 poistoa
  1. 6 6
      web/app/components/base/image-uploader/hooks.ts

+ 6 - 6
web/app/components/base/image-uploader/hooks.ts

@@ -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 {