Skip to content

Commit f8f88f4

Browse files
committed
REFACTOR: Simplify drag-n-drop indicator logic
1 parent fe3cd8b commit f8f88f4

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

packages/frontend/src/notebook/notebook_cell.tsx

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -210,23 +210,11 @@ export function NotebookCell(props: {
210210
onDragEnter(args) {
211211
const sourceIndex = args.source.data.index as number;
212212
const targetIndex = args.self.data.index as number;
213-
const sourceCellId = args.source.data.cellId as string;
214-
215-
// Allow dropping back to original position (same cell)
216-
if (sourceCellId === props.cellId) {
217-
// Show drop indicator to allow dropping back to original position
218-
props.setCurrentDropTarget(props.cellId);
219-
setClosestEdge("top");
220-
setDropTarget(true);
221-
} else if (sourceIndex === targetIndex) {
222-
setClosestEdge(null);
223-
setDropTarget(false);
224-
} else {
225-
props.setCurrentDropTarget(props.cellId);
226-
const edge = sourceIndex < targetIndex ? "bottom" : "top";
227-
setClosestEdge(edge);
228-
setDropTarget(true);
229-
}
213+
214+
props.setCurrentDropTarget(props.cellId);
215+
const edge = sourceIndex < targetIndex ? "bottom" : "top";
216+
setClosestEdge(edge);
217+
setDropTarget(true);
230218
},
231219
onDrop() {
232220
setDropTarget(false);

0 commit comments

Comments
 (0)