mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
fix(files): keep current folder on drag-n-drop
When drag and drop a file we only want to scroll to the uploaded file not changing the current view. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
4775ce4266
commit
1f6fe21527
1 changed files with 10 additions and 8 deletions
|
|
@ -29,7 +29,6 @@
|
|||
<script lang="ts">
|
||||
import type { Folder } from '@nextcloud/files'
|
||||
import type { PropType } from 'vue'
|
||||
import type { RawLocation } from 'vue-router'
|
||||
|
||||
import { showError } from '@nextcloud/dialogs'
|
||||
import { Permission } from '@nextcloud/files'
|
||||
|
|
@ -111,7 +110,7 @@ export default defineComponent({
|
|||
mainContent.addEventListener('drop', this.onContentDrop)
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
beforeUnmount() {
|
||||
const mainContent = window.document.getElementById('app-content-vue') as HTMLElement
|
||||
mainContent.removeEventListener('dragover', this.onDragOver)
|
||||
mainContent.removeEventListener('dragleave', this.onDragLeave)
|
||||
|
|
@ -204,16 +203,19 @@ export default defineComponent({
|
|||
&& upload.source.replace(folder.source, '').split('/').length === 2)
|
||||
|
||||
if (lastUpload !== undefined) {
|
||||
const fileid = String(lastUpload.response!.headers['oc-fileid']).split(/(oc|nc)/, 2)[0]!
|
||||
logger.debug('Scrolling to last upload in current folder', { lastUpload })
|
||||
const location: RawLocation = {
|
||||
path: this.$route.path,
|
||||
// Keep params but change file id
|
||||
this.$router.push({
|
||||
name: this.$route.name!,
|
||||
params: {
|
||||
// Keep params but change file id
|
||||
...this.$route.params,
|
||||
fileid: String(lastUpload.response!.headers['oc-fileid']),
|
||||
fileid,
|
||||
},
|
||||
}
|
||||
this.$router.push(location)
|
||||
query: {
|
||||
dir: this.$route.query.dir,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
this.dragover = false
|
||||
|
|
|
|||
Loading…
Reference in a new issue