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.
This commit is contained in:
Johann150 2022-12-23 02:21:52 +01:00
parent d26e2588e3
commit 02aaee6050
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -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);