diff options
Diffstat (limited to 'apps/files/src/components/FileEntry.vue')
-rw-r--r-- | apps/files/src/components/FileEntry.vue | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue index 8dc067a407d..fd61f5e3623 100644 --- a/apps/files/src/components/FileEntry.vue +++ b/apps/files/src/components/FileEntry.vue @@ -33,7 +33,7 @@ <!-- Link to file --> <td class="files-list__row-name"> - <a ref="name" v-bind="linkTo" @click="execDefaultAction"> + <a ref="name" v-bind="linkAttrs" @click="execDefaultAction"> <!-- Icon or preview --> <span class="files-list__row-icon"> <FolderIcon v-if="source.type === 'folder'" /> @@ -261,7 +261,22 @@ export default Vue.extend({ return minOpacity + (1 - minOpacity) * Math.pow((this.source.size / maxOpacitySize), 2) }, - linkTo() { + linkAttrs() { + if (this.enabledDefaultActions.length > 0) { + const action = this.enabledDefaultActions[0] + const displayName = action.displayName([this.source], this.currentView) + return { + class: ['files-list__row-default-action', 'files-list__row-action-' + action.id], + role: 'button', + title: displayName, + } + } + + /** + * A folder would never reach this point + * as it has open-folder as default action. + * Just to be safe, let's handle it. + */ if (this.source.type === 'folder') { const to = { ...this.$route, query: { dir: join(this.dir, this.source.basename) } } return { @@ -271,15 +286,6 @@ export default Vue.extend({ } } - if (this.enabledDefaultActions.length > 0) { - const action = this.enabledDefaultActions[0] - const displayName = action.displayName([this.source], this.currentView) - return { - title: displayName, - role: 'button', - } - } - return { href: this.source.source, // TODO: Use first action title ? @@ -526,11 +532,6 @@ export default Vue.extend({ } }, execDefaultAction(event) { - // Do not execute the default action on the folder, navigate instead - if (this.source.type === 'folder') { - return - } - if (this.enabledDefaultActions.length > 0) { event.preventDefault() event.stopPropagation() |