fix(editor): 🐛 Fix edge on item offset top on drop
This commit is contained in:
@ -72,12 +72,12 @@ export const ItemNodesList = ({
|
|||||||
if (!isDraggingOnCurrentBlock) return
|
if (!isDraggingOnCurrentBlock) return
|
||||||
const itemIndex = computeNearestPlaceholderIndex(e.pageY, placeholderRefs)
|
const itemIndex = computeNearestPlaceholderIndex(e.pageY, placeholderRefs)
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
setDraggedItem(undefined)
|
||||||
createItem(draggedItem as ButtonItem, {
|
createItem(draggedItem as ButtonItem, {
|
||||||
blockIndex,
|
blockIndex,
|
||||||
stepIndex,
|
stepIndex,
|
||||||
itemIndex,
|
itemIndex,
|
||||||
})
|
})
|
||||||
setDraggedItem(undefined)
|
|
||||||
}
|
}
|
||||||
useEventListener(
|
useEventListener(
|
||||||
'mouseup',
|
'mouseup',
|
||||||
|
@ -117,9 +117,8 @@ const moveStepToBlock = (
|
|||||||
const items = stepHasItems(step) ? step.items : []
|
const items = stepHasItems(step) ? step.items : []
|
||||||
items.forEach((item) => {
|
items.forEach((item) => {
|
||||||
const edgeIndex = typebot.edges.findIndex(byId(item.outgoingEdgeId))
|
const edgeIndex = typebot.edges.findIndex(byId(item.outgoingEdgeId))
|
||||||
edgeIndex !== -1
|
if (edgeIndex === -1) return
|
||||||
? (typebot.edges[edgeIndex].from.blockId = blockId)
|
typebot.edges[edgeIndex].from.blockId = blockId
|
||||||
: (newStep.outgoingEdgeId = undefined)
|
|
||||||
})
|
})
|
||||||
if (step.outgoingEdgeId) {
|
if (step.outgoingEdgeId) {
|
||||||
if (typebot.blocks[blockIndex].steps.length > stepIndex ?? 0) {
|
if (typebot.blocks[blockIndex].steps.length > stepIndex ?? 0) {
|
||||||
|
Reference in New Issue
Block a user