There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(kanban): move kanban card at same group (#524)
lawvsb4362dd96851
diff --git a/libs/components/editor-core/src/kanban/kanban.ts b/libs/components/editor-core/src/kanban/kanban.tsindex 096a5239d0..d47e0ce75d 100644--- a/libs/components/editor-core/src/kanban/kanban.ts+++ b/libs/components/editor-core/src/kanban/kanban.ts@@ -278,7 +278,11 @@ export const useKanban = () => {// 1.1 Target group is not specified, just set the nowGroup as the targetGrouptargetGroup = 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 groupawait 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;}