Skip to content

Commit

Permalink
Merge pull request #1302 from nextcloud-libraries/fix/new-dir
Browse files Browse the repository at this point in the history
fix: Close actions after creating directory and enter it automatically
  • Loading branch information
Pytal committed Apr 13, 2024
2 parents 6444a66 + 474e161 commit 22b7fa4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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

0 comments on commit 22b7fa4

Please sign in to comment.