From 02aaee6050758dcce7ee9728464056de9b790d35 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Fri, 23 Dec 2022 02:21:52 +0100 Subject: [PATCH] client: select folder when entering it As a convenience when a user is in the "select a folder" dialog, opens a folder an then clicks on the checkmark, the currently open folder is selected. --- packages/client/src/components/drive.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/client/src/components/drive.vue b/packages/client/src/components/drive.vue index ec985ea9d..3b9ebd85c 100644 --- a/packages/client/src/components/drive.vue +++ b/packages/client/src/components/drive.vue @@ -98,7 +98,6 @@ import { uploadFile, uploads } from '@/scripts/upload'; const props = withDefaults(defineProps<{ initialFolder?: foundkey.entities.DriveFolder; - type?: string; multiple?: boolean; select?: 'file' | 'folder' | null; }>(), { @@ -133,7 +132,14 @@ let draghover = $ref(false); // (自分自身の階層にドロップできないようにするためのフラグ) let isDragSource = $ref(false); -watch($$(folder), () => emit('cd', folder)); +watch($$(folder), () => { + emit('cd', folder) + if (props.select === 'folder') { + // convenience: entering a folder selects it + selected = [folder]; + emit('change-selection', selected); + } +}); function onStreamDriveFileCreated(file: foundkey.entities.DriveFile) { addFile(file, true);