mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 10:14:17 +08:00
Only activate overlay when dragging files [SCI-6997] (#4272)
This commit is contained in:
parent
088c4c1c94
commit
d0cc3155f1
2 changed files with 12 additions and 2 deletions
|
@ -50,7 +50,7 @@
|
|||
}
|
||||
|
||||
.sci-checkbox-container {
|
||||
margin: 10px 0;
|
||||
margin: 16px 0;
|
||||
|
||||
&.disabled {
|
||||
pointer-events: none;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div ref="stepContainer" class="step-container"
|
||||
:id="`stepContainer${step.id}`"
|
||||
@drop.prevent="dropFile"
|
||||
@dragenter.prevent="!showFileModal ? dragingFile = true : null"
|
||||
@dragenter.prevent="dragEnter($event)"
|
||||
@dragover.prevent
|
||||
:class="{ 'draging-file': dragingFile, 'showing-comments': showCommentsSidebar, 'editing-name': editingName }"
|
||||
>
|
||||
|
@ -250,6 +250,16 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
dragEnter(e) {
|
||||
if (this.showFileModal) return;
|
||||
|
||||
// Detect if dragged element is a file
|
||||
// https://stackoverflow.com/a/8494918
|
||||
let dt = e.dataTransfer;
|
||||
if (dt.types && (dt.types.indexOf ? dt.types.indexOf('Files') != -1 : dt.types.contains('Files'))) {
|
||||
this.dragingFile = true;
|
||||
}
|
||||
},
|
||||
loadAttachments() {
|
||||
$.get(this.urls.attachments_url, (result) => {
|
||||
this.attachments = result.data
|
||||
|
|
Loading…
Reference in a new issue