fixes #81 right-click opens context menu

This commit is contained in:
Milos Stojanovic
2020-05-17 10:18:03 +02:00
parent 35692d10c7
commit 7b12997f33
3 changed files with 25 additions and 1 deletions

View File

@@ -6,6 +6,8 @@
* zip adapter fix
* composer update dependencies
* npm update / audit fix
* right-click opens single file context menu
* fixes #81, #86
## 7.4.0 - 2020-05-09 ✌️

View File

@@ -91,6 +91,7 @@
:checked-rows.sync="checked"
:loading="isLoading"
:checkable="can('batchDownload') || can('write') || can('zip')"
@contextmenu="rightClick"
>
<template slot-scope="props">
<b-table-column :label="lang('Name')" :custom-sort="sortByName" field="data.name" sortable>
@@ -109,7 +110,7 @@
<b-table-column id="single-actions" width="51">
<b-dropdown v-if="props.row.type != 'back'" :disabled="checked.length > 0" aria-role="list" position="is-bottom-left">
<button slot="trigger" class="button is-small">
<button :ref="'ref-single-action-button-'+props.row.path" slot="trigger" class="button is-small">
<b-icon icon="ellipsis-h" size="is-small" />
</button>
@@ -263,6 +264,13 @@ export default {
this.download(item)
}
},
rightClick(row, event) {
if (row.type == 'back') {
return
}
event.preventDefault()
this.$refs['ref-single-action-button-'+row.path].click()
},
selectDir() {
this.$modal.open({
parent: this,

View File

@@ -111,6 +111,20 @@ describe('Browser', () => {
cy.contains('tr.type-file', 'Unzip')
cy.contains('tr.type-file', 'Delete')
cy.contains('tr.type-file', 'Copy link')
// click on single file action button
cy.get('.dropdown-trigger').last().click()
cy.get('.dropdown-content').last().contains('Download').should('be.visible')
// close context menu
cy.get('.dropdown-trigger').last().click()
cy.get('.dropdown-content').last().contains('Download').should('not.be.visible')
// right-click on the file row should also open context menu
cy.get('tr.type-file').last().rightclick()
cy.get('.dropdown-content').last().contains('Download').should('be.visible')
// close context menu with another right-click
cy.get('tr.type-file').last().rightclick()
cy.get('.dropdown-content').last().contains('Download').should('not.be.visible')
})
it('New folder and file', () => {