Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: support click to upload file (#4749)

Liu Jib7351610b8db
diff --git a/frontend/src/components/misc/DroppableTextarea.vue b/frontend/src/components/misc/DroppableTextarea.vue
index e049a73524..b8c32cafbe 100644
--- a/frontend/src/components/misc/DroppableTextarea.vue
+++ b/frontend/src/components/misc/DroppableTextarea.vue
@@ -14,9 +14,15 @@
<div
v-if="!state.value"
- class="absolute bottom-2 left-[50%] -translate-x-1/2 pointer-events-none flex flex-col items-center justify-center border border-control-border border-dashed text-xs text-control-placeholder p-2 rounded-md"
+ class="absolute bottom-2 left-[50%] -translate-x-1/2 flex flex-col items-center justify-center border border-control-border hover:border-control-hover border-dashed text-xs text-control-placeholder hover:text-control-hover p-2 rounded-md"
>
Or drag and drop files here.
+ <input
+ type="file"
+ class="absolute inset-0 opacity-0 cursor-pointer"
+ title=""
+ @change="handleFileChange"
+ />
</div>
<div
@@ -85,7 +91,7 @@ watch(
(value) => emit("update:value", value)
);
-const onDrop = (files: File[] | null) => {
+const onDrop = (files: File[] | FileList | null) => {
// called when files are dropped on zone
const file = head(files);
if (file) {
@@ -118,5 +124,10 @@ const onDrop = (files: File[] | null) => {
}
};
+const handleFileChange = (e: Event) => {
+ const target = e.target as HTMLInputElement;
+ onDrop(target.files);
+};
+
const { isOverDropZone } = useDropZone(container, onDrop);
</script>