mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-11 06:35:58 +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 {
|
.sci-checkbox-container {
|
||||||
margin: 10px 0;
|
margin: 16px 0;
|
||||||
|
|
||||||
&.disabled {
|
&.disabled {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<div ref="stepContainer" class="step-container"
|
<div ref="stepContainer" class="step-container"
|
||||||
:id="`stepContainer${step.id}`"
|
:id="`stepContainer${step.id}`"
|
||||||
@drop.prevent="dropFile"
|
@drop.prevent="dropFile"
|
||||||
@dragenter.prevent="!showFileModal ? dragingFile = true : null"
|
@dragenter.prevent="dragEnter($event)"
|
||||||
@dragover.prevent
|
@dragover.prevent
|
||||||
:class="{ 'draging-file': dragingFile, 'showing-comments': showCommentsSidebar, 'editing-name': editingName }"
|
:class="{ 'draging-file': dragingFile, 'showing-comments': showCommentsSidebar, 'editing-name': editingName }"
|
||||||
>
|
>
|
||||||
|
|
@ -250,6 +250,16 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
loadAttachments() {
|
||||||
$.get(this.urls.attachments_url, (result) => {
|
$.get(this.urls.attachments_url, (result) => {
|
||||||
this.attachments = result.data
|
this.attachments = result.data
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue