mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-10 17:24:22 +03:00
fix(kanban): move kanban card at same group (#524)
This commit is contained in:
parent
d4a77b5d7b
commit
b4362dd968
@ -278,7 +278,11 @@ export const useKanban = () => {
|
||||
// 1.1 Target group is not specified, just set the nowGroup as the targetGroup
|
||||
targetGroup = nowGroup;
|
||||
}
|
||||
if (nowGroup.id !== targetGroup.id) {
|
||||
const isChangedGroup = nowGroup.id !== targetGroup.id;
|
||||
const previousIdx = nowGroup.items.findIndex(
|
||||
card => card.id === targetCard.id
|
||||
);
|
||||
if (isChangedGroup) {
|
||||
// 1.2 Move to the target group
|
||||
await moveCardToGroup(groupBy.id, targetCard, targetGroup);
|
||||
}
|
||||
@ -297,6 +301,10 @@ export const useKanban = () => {
|
||||
await moveCardToBefore(targetCard, nowGroup.items[0].block);
|
||||
return;
|
||||
}
|
||||
// Fix move card from idx 0 to idx 1 at same group
|
||||
if (!isChangedGroup && previousIdx < idx && previousIdx !== -1) {
|
||||
idx++;
|
||||
}
|
||||
if (idx > nowGroup.items.length) {
|
||||
idx = nowGroup.items.length;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user