mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: move row into other block
This commit is contained in:
parent
ab5b40fa51
commit
fa427fe650
@ -82,12 +82,18 @@ export const useDatabase = (viewId: string, type?: ViewLayoutTypePB) => {
|
||||
};
|
||||
|
||||
const onDragEnd: OnDragEndResponder = async (result) => {
|
||||
if (!controller) return;
|
||||
const { source, destination } = result;
|
||||
// move inside the block (group)
|
||||
const group = groups.find((g) => g.groupId === source.droppableId);
|
||||
if (!group) return;
|
||||
|
||||
if (source.droppableId === destination?.droppableId) {
|
||||
const group = groups.find((g) => g.groupId === source.droppableId);
|
||||
if (!group || !controller) return;
|
||||
// move inside the block (group)
|
||||
await controller.exchangeRow(group.rows[source.index].id, group.rows[destination.index].id);
|
||||
} else {
|
||||
// move to different block (group)
|
||||
if (!destination?.droppableId) return;
|
||||
await controller.moveRow(group.rows[source.index].id, destination.droppableId);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user