Skip to content

Commit

Permalink
Add dragarea again, changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
lookacat committed Jul 11, 2022
1 parent f2a0980 commit 2b918f1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
7 changes: 7 additions & 0 deletions changelog/unreleased/bugfix-add-droparea-again
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Add Droparea again

We've added the visual droparea again to indicate drag and drop
from outside the application

https://github.com/owncloud/web/issues/7080
https://github.com/owncloud/web/pull/7251
30 changes: 29 additions & 1 deletion packages/web-app-files/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<main id="files" class="oc-flex oc-height-1-1">
<main id="files" class="oc-flex oc-height-1-1" @dragenter="onDragEnter" @mouseleave="onDragLeave">
<div v-if="dragareaEnabled" class="dragarea" />
<div ref="filesListWrapper" tabindex="-1" class="files-list-wrapper oc-width-expand">
<router-view id="files-view" tabindex="0" />
</div>
Expand Down Expand Up @@ -29,6 +30,9 @@ export default defineComponent({
SideBar
},
mixins: [Mixins],
data: () => ({
dragareaEnabled: false
}),
computed: {
...mapState('Files/sidebar', {
sidebarClosed: 'closed',
Expand Down Expand Up @@ -62,6 +66,13 @@ export default defineComponent({
setActiveSidebarPanel: 'setActivePanel'
}),
onDragEnter(event) {
const hasFileInEvent = (event.dataTransfer.types || []).some((e) => e === 'Files')
this.dragareaEnabled = hasFileInEvent
},
onDragLeave() {
this.dragareaEnabled = false
},
focusSideBar(component, event) {
this.focus({
from: document.activeElement,
Expand All @@ -78,7 +89,20 @@ main {
max-height: 100%;
}
.dragarea {
background-color: rgba(60, 130, 225, 0.21);
pointer-events: none;
top: 0;
left: 0;
right: 0;
bottom: 0;
position: absolute;
z-index: 9;
border-radius: 14px;
border: 2px dashed var(--oc-color-swatch-primary-muted);
}
.files-list-wrapper {
position: relative;
overflow-y: auto;
display: grid;
grid-template-columns: 1fr;
Expand All @@ -94,6 +118,10 @@ main {
}
}
#files {
position: relative;
}
#files-sidebar {
position: relative;
overflow: hidden;
Expand Down

0 comments on commit 2b918f1

Please sign in to comment.