fix: dnd - dragslot remains if we drop outside of target
This commit is contained in:
parent
764a09118c
commit
04cee2c3e3
|
@ -102,6 +102,15 @@
|
||||||
return s
|
return s
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dragend = () => {
|
||||||
|
dragDropStore.update(s => {
|
||||||
|
s.dropPosition = ""
|
||||||
|
s.targetComponent = null
|
||||||
|
s.componentToDrop = null
|
||||||
|
return s
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -122,6 +131,7 @@
|
||||||
class:selected={currentComponent === component}
|
class:selected={currentComponent === component}
|
||||||
style="padding-left: {level * 20 + 40}px"
|
style="padding-left: {level * 20 + 40}px"
|
||||||
draggable={true}
|
draggable={true}
|
||||||
|
on:dragend={dragend}
|
||||||
on:dragstart={dragstart(component)}
|
on:dragstart={dragstart(component)}
|
||||||
on:dragover={dragover(component, index)}
|
on:dragover={dragover(component, index)}
|
||||||
on:drop={drop}
|
on:drop={drop}
|
||||||
|
|
Loading…
Reference in New Issue