fix: prompt key shortcut conflict

pull/1015/head
Ramires Viana 2020-07-04 14:19:03 +00:00
parent de0b8bb7b2
commit 0d69fbd9a3
3 changed files with 24 additions and 18 deletions

View File

@ -136,12 +136,6 @@ export default {
} }
}, },
mounted() { mounted() {
window.addEventListener("keydown", event => {
if (event.keyCode === 27) {
this.closeHovers()
}
})
this.$refs.result.addEventListener('scroll', event => { this.$refs.result.addEventListener('scroll', event => {
if (event.target.offsetHeight + event.target.scrollTop >= event.target.scrollHeight - 100) { if (event.target.offsetHeight + event.target.scrollTop >= event.target.scrollHeight - 100) {
this.resultsCount += 50 this.resultsCount += 50

View File

@ -101,7 +101,7 @@ export default {
components: { Item }, components: { Item },
data: function () { data: function () {
return { return {
show: 50, showLimit: 50,
uploading: { uploading: {
id: 0, id: 0,
count: 0, count: 0,
@ -111,7 +111,7 @@ export default {
} }
}, },
computed: { computed: {
...mapState(['req', 'selected', 'user']), ...mapState(['req', 'selected', 'user', 'show']),
nameSorted () { nameSorted () {
return (this.req.sorting.by === 'name') return (this.req.sorting.by === 'name')
}, },
@ -139,14 +139,14 @@ export default {
return { dirs, files } return { dirs, files }
}, },
dirs () { dirs () {
return this.items.dirs.slice(0, this.show) return this.items.dirs.slice(0, this.showLimit)
}, },
files () { files () {
let show = this.show - this.items.dirs.length let showLimit = this.showLimit - this.items.dirs.length
if (show < 0) show = 0 if (showLimit < 0) showLimit = 0
return this.items.files.slice(0, show) return this.items.files.slice(0, showLimit)
}, },
nameIcon () { nameIcon () {
if (this.nameSorted && !this.ascOrdered) { if (this.nameSorted && !this.ascOrdered) {
@ -194,7 +194,11 @@ export default {
base64: function (name) { base64: function (name) {
return window.btoa(unescape(encodeURIComponent(name))) return window.btoa(unescape(encodeURIComponent(name)))
}, },
keyEvent (event) { keyEvent (event) {
if (this.show !== null) {
return
}
if (!event.ctrlKey && !event.metaKey) { if (!event.ctrlKey && !event.metaKey) {
return return
} }
@ -292,7 +296,7 @@ export default {
}, },
scrollEvent () { scrollEvent () {
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) { if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
this.show += 50 this.showLimit += 50
} }
}, },
dragEnter () { dragEnter () {

View File

@ -61,7 +61,8 @@ export default {
'user', 'user',
'reload', 'reload',
'multiple', 'multiple',
'loading' 'loading',
'show'
]), ]),
isPreview () { isPreview () {
return !this.loading && !this.isListing && !this.isEditor return !this.loading && !this.isListing && !this.isEditor
@ -158,10 +159,17 @@ export default {
} }
}, },
keyEvent (event) { keyEvent (event) {
// Esc! if (this.show !== null) {
if (event.keyCode === 27) { // Esc!
this.$store.commit('closeHovers') if (event.keyCode === 27) {
this.$store.commit('closeHovers')
}
return
}
// Esc!
if (event.keyCode === 27) {
// If we're on a listing, unselect all // If we're on a listing, unselect all
// files and folders. // files and folders.
if (this.isListing) { if (this.isListing) {