Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Close actions after creating directory and enter it automatically #1302

Merged
merged 1 commit into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/components/FilePicker/FilePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ import FilePickerBreadcrumbs from './FilePickerBreadcrumbs.vue'
import FilePickerNavigation from './FilePickerNavigation.vue'

import { emit as emitOnEventBus } from '@nextcloud/event-bus'
import { davRootPath } from '@nextcloud/files'
import { NcDialog, NcEmptyContent } from '@nextcloud/vue'
import { join } from 'path'
import { computed, onMounted, ref, toRef } from 'vue'
import { showError } from '../../toast'
import { useDAVFiles } from '../../composables/dav'
Expand Down Expand Up @@ -282,7 +280,8 @@ const noFilesDescription = computed(() => {
*/
const onCreateFolder = async (name: string) => {
try {
await createDirectory(name)
const folder = await createDirectory(name)
currentPath.value = folder.path
// emit event bus to force files app to reload that file if needed
emitOnEventBus('files:node:created', files.value.filter((file) => file.basename === name)[0])
} catch (error) {
Expand Down
4 changes: 4 additions & 0 deletions lib/components/FilePicker/FilePickerBreadcrumbs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
:force-menu="true"
:force-name="true"
:menu-name="t('New')"
:open.sync="actionsOpen"
type="secondary"
@close="newNodeName = ''">
<template #icon>
Expand Down Expand Up @@ -68,6 +69,8 @@ const emit = defineEmits<{
(e: 'create-node', name: string): void
}>()

const actionsOpen = ref(false)

/**
* Input on the "new node" menu
*/
Expand Down Expand Up @@ -104,6 +107,7 @@ const onSubmit = function() {
const name = newNodeName.value.trim()

if (validateInput()) {
actionsOpen.value = false
emit('create-node', name)
newNodeName.value = ''
}
Expand Down