diff --git a/apps/files/src/components/FileEntryMixin.ts b/apps/files/src/components/FileEntryMixin.ts index 0831c50afd6f8..ec23364d2db3f 100644 --- a/apps/files/src/components/FileEntryMixin.ts +++ b/apps/files/src/components/FileEntryMixin.ts @@ -7,7 +7,7 @@ import type { PropType } from 'vue' import type { FileSource } from '../types.ts' import { openConflictPicker } from '@nextcloud/dialogs' -import { FileType, Folder, getFileActions, File as NcFile, Node, NodeStatus, Permission } from '@nextcloud/files' +import { FileType, Folder, getFileActions, File as NcFile, Node, NodeStatus, Permission, type View } from '@nextcloud/files' import { t } from '@nextcloud/l10n' import { extname } from '@nextcloud/paths' import { isPublicShare } from '@nextcloud/sharing/public' @@ -15,10 +15,12 @@ import { generateUrl } from '@nextcloud/router' import { getConflicts, getUploader } from '@nextcloud/upload' import { vOnClickOutside } from '@vueuse/components' import { relative } from 'path' +import { storeToRefs } from 'pinia' import Vue, { computed, defineComponent } from 'vue' import { action as sidebarAction } from '../actions/sidebarAction.ts' import { onDropInternalFiles } from '../services/DropService.ts' +import { useActiveStore } from '../store/active.ts' import { getDragAndDropPreview } from '../utils/dragUtils.ts' import { hashCode } from '../utils/hashUtils.ts' import { isDownloadable } from '../utils/permissions.ts' @@ -26,6 +28,13 @@ import logger from '../logger.ts' Vue.directive('onClickOutside', vOnClickOutside) +type FileActionContext = { + nodes: Node[] + view: View + folder: Folder + contents: Node[] +} + const actions = getFileActions() export default defineComponent({ @@ -59,6 +68,15 @@ export default defineComponent({ } }, + setup() { + const { activeFolder, activeView } = storeToRefs(useActiveStore()) + + return { + activeFolder, + activeView, + } + }, + data() { return { dragover: false, @@ -229,6 +247,19 @@ export default defineComponent({ } }, + fileActionView(): View { + return this.activeView ?? this.currentView + }, + + fileActionContext(): FileActionContext { + return { + nodes: [this.source], + view: this.fileActionView, + folder: this.activeFolder!, + contents: this.nodes, + } + }, + /** * Sorted actions that are enabled for this node */ @@ -246,7 +277,7 @@ export default defineComponent({ // In case something goes wrong, since we don't want to break // the entire list, we filter out actions that throw an error. try { - return action.enabled([this.source], this.currentView) + return (action.enabled as (context: FileActionContext) => boolean)(this.fileActionContext) } catch (error) { logger.error('Error while checking action', { action, error }) return false diff --git a/apps/files/src/components/FilesListVirtual.vue b/apps/files/src/components/FilesListVirtual.vue index eeaaae250b168..f603554bea7bf 100644 --- a/apps/files/src/components/FilesListVirtual.vue +++ b/apps/files/src/components/FilesListVirtual.vue @@ -803,6 +803,7 @@ export default defineComponent({ display: flex; align-items: center; text-align: start; + cursor: pointer; // Fill cell height and width width: 100%; height: 100%; @@ -826,8 +827,13 @@ export default defineComponent({ } } + span.files-list__row-name-link { + cursor: pointer; + } + .files-list__row-name-text { color: var(--color-main-text); + cursor: pointer; // Make some space for the outline padding: var(--default-grid-baseline) calc(2 * var(--default-grid-baseline)); padding-inline-start: -10px; @@ -998,6 +1004,7 @@ export default defineComponent({ .files-list__row-name-text { margin: 0; + cursor: pointer; // Ensure that the outline is not too close to the text. margin-inline-start: -4px; padding: 0px 4px;