Allow dropping on empty space below tree

This commit is contained in:
Andrew Kingston 2022-08-30 13:32:52 +01:00
parent 412ee0b35f
commit 01cc14a6ee
2 changed files with 19 additions and 2 deletions

View File

@ -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>

View File

@ -68,7 +68,8 @@
closedNodes = closedNodes
}
const onDrop = async () => {
const onDrop = async e => {
e.stopPropagation()
try {
await dndStore.actions.drop()
} catch (error) {