feat: open addmodal when dragging a file into the dashboard

This commit is contained in:
m4ximuel 2021-04-21 15:32:59 +09:00 committed by GitHub
parent 011a5bdcf5
commit 5807db5e99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -2,6 +2,7 @@
<v-dialog
v-model="dialog"
scrollable
:transition="dTransition"
:content-class="phoneLayout ? 'rounded-0' : 'rounded-form'"
max-width="500px"
:fullscreen="phoneLayout"
@ -201,9 +202,11 @@ import { FullScreenModal } from '@/mixins'
export default {
name: 'AddModal',
mixins: [Modal, FullScreenModal],
props: ['initialMagnet'],
props: ['initialMagnet', 'openSuddenly'],
data() {
return {
dTransition: 'scale-transition',
hndlDialog: true,
showWrapDrag: false,
files: [],
category: null,
@ -253,6 +256,12 @@ export default {
this.$store.commit('FETCH_CATEGORIES')
this.urls = this.initialMagnet
this.setSettings()
if (this.openSuddenly == true) {
this.dTransition = 'none'
}
},
mounted() {
this.dTransition = 'scale-transition'
},
methods: {
setSettings() {

View file

@ -1,7 +1,6 @@
<template>
<div
class="px-1 px-sm-5 pt-4 background noselect"
@dragenter.prevent="detectDragEnter()"
@click.self="resetSelected"
>
<v-row
@ -294,6 +293,7 @@ export default {
},
mounted() {
document.addEventListener('keydown', this.handleKeyboardShortcut)
document.addEventListener('dragenter', this.detectDragEnter)
},
created() {
this.$store.dispatch('INIT_INTERVALS')
@ -302,6 +302,7 @@ export default {
beforeDestroy() {
this.$store.commit('REMOVE_INTERVALS')
document.removeEventListener('keydown', this.handleKeyboardShortcut)
document.removeEventListener('dragenter', this.detectDragEnter)
},
methods: {
strTouchStart(e, data) {
@ -354,7 +355,7 @@ export default {
},
detectDragEnter() {
if (this.selected_torrents.length == 0 && this.$store.state.modals.length < 1) {
this.addModal('AddModal')
this.createModal('AddModal', { openSuddenly: true })
}
return true