Allow dropping on empty space below tree
This commit is contained in:
parent
412ee0b35f
commit
01cc14a6ee
2 changed files with 19 additions and 2 deletions
|
@ -1,5 +1,7 @@
|
|||
<script>
|
||||
import { setContext } from "svelte"
|
||||
import { dndStore } from "./dndStore"
|
||||
import { notifications } from "@budibase/bbui"
|
||||
|
||||
let scrollRef
|
||||
|
||||
|
@ -50,9 +52,23 @@
|
|||
setContext("scroll", {
|
||||
scrollTo,
|
||||
})
|
||||
|
||||
const onDrop = async () => {
|
||||
try {
|
||||
await dndStore.actions.drop()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
notifications.error("Error saving component")
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div bind:this={scrollRef}>
|
||||
<div
|
||||
bind:this={scrollRef}
|
||||
on:drop={onDrop}
|
||||
ondragover="return false"
|
||||
ondragenter="return false"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
|
|
|
@ -68,7 +68,8 @@
|
|||
closedNodes = closedNodes
|
||||
}
|
||||
|
||||
const onDrop = async () => {
|
||||
const onDrop = async e => {
|
||||
e.stopPropagation()
|
||||
try {
|
||||
await dndStore.actions.drop()
|
||||
} catch (error) {
|
||||
|
|
Loading…
Reference in a new issue