1
0
Fork 0
mirror of synced 2024-06-29 11:31:06 +12:00

Allow dropping on empty space below tree

This commit is contained in:
Andrew Kingston 2022-08-30 13:32:52 +01:00
parent 6a435dec3d
commit 60289734dd
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) {