2
0

fix(editor): 🐛 Fix edge on item offset top on drop

This commit is contained in:
Baptiste Arnaud
2022-03-28 18:04:26 +02:00
parent 43fa411320
commit c64afb7073
2 changed files with 3 additions and 4 deletions

View File

@ -72,12 +72,12 @@ export const ItemNodesList = ({
if (!isDraggingOnCurrentBlock) return
const itemIndex = computeNearestPlaceholderIndex(e.pageY, placeholderRefs)
e.stopPropagation()
setDraggedItem(undefined)
createItem(draggedItem as ButtonItem, {
blockIndex,
stepIndex,
itemIndex,
})
setDraggedItem(undefined)
}
useEventListener(
'mouseup',

View File

@ -117,9 +117,8 @@ const moveStepToBlock = (
const items = stepHasItems(step) ? step.items : []
items.forEach((item) => {
const edgeIndex = typebot.edges.findIndex(byId(item.outgoingEdgeId))
edgeIndex !== -1
? (typebot.edges[edgeIndex].from.blockId = blockId)
: (newStep.outgoingEdgeId = undefined)
if (edgeIndex === -1) return
typebot.edges[edgeIndex].from.blockId = blockId
})
if (step.outgoingEdgeId) {
if (typebot.blocks[blockIndex].steps.length > stepIndex ?? 0) {