From cb733dc6ebb16edef77d3431aa974e6ec41d5189 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 17 Mar 2024 09:28:33 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/10326 --- app/src/card/openCard.ts | 26 ++++++++++++++++++-------- app/src/protyle/wysiwyg/transaction.ts | 2 +- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/src/card/openCard.ts b/app/src/card/openCard.ts index ec73df640..82cc7bc43 100644 --- a/app/src/card/openCard.ts +++ b/app/src/card/openCard.ts @@ -210,11 +210,12 @@ export const bindCardEvent = async (options: { const filterElement = options.element.querySelector('[data-type="filter"]'); const fetchNewRound = () => { const currentCardType = filterElement.getAttribute("data-cardtype"); + const docId = filterElement.getAttribute("data-id"); fetchPost(currentCardType === "all" ? "/api/riff/getRiffDueCards" : (currentCardType === "doc" ? "/api/riff/getTreeRiffDueCards" : "/api/riff/getNotebookRiffDueCards"), { - rootID: filterElement.getAttribute("data-id"), - deckID: filterElement.getAttribute("data-id"), - notebook: filterElement.getAttribute("data-id"), + rootID: docId, + deckID: docId, + notebook: docId, }, async (treeCards) => { index = 0; options.cardsData = treeCards.data; @@ -239,6 +240,7 @@ export const bindCardEvent = async (options: { const target = event.target as HTMLElement; let type = ""; const currentCard = options.cardsData.cards[index]; + const docId = filterElement.getAttribute("data-id"); if (typeof event.detail === "string") { if (["1", "j", "a"].includes(event.detail)) { type = "1"; @@ -287,7 +289,15 @@ export const bindCardEvent = async (options: { icon: "iconRefresh", label: window.siyuan.languages.reset, click() { - + fetchPost("/api/riff/resetRiffCards", { + type: filterElement.getAttribute("data-cardtype"), + id: docId, + deckID: Constants.QUICK_DECK_ID, + blockIDs: [currentCard.blockID], + }, () => { + // currentCard. + // genCardCount(options.cardsData, index); + }); } }); menu.addItem({ @@ -356,7 +366,7 @@ export const bindCardEvent = async (options: { cardsData: options.cardsData, index, cardType: filterElement.getAttribute("data-cardtype") as TCardType, - id: filterElement.getAttribute("data-id"), + id: docId, title: options.title }, id: "siyuan-card" @@ -509,9 +519,9 @@ export const bindCardEvent = async (options: { const currentCardType = filterElement.getAttribute("data-cardtype"); fetchPost(currentCardType === "all" ? "/api/riff/getRiffDueCards" : (currentCardType === "doc" ? "/api/riff/getTreeRiffDueCards" : "/api/riff/getNotebookRiffDueCards"), { - rootID: filterElement.getAttribute("data-id"), - deckID: filterElement.getAttribute("data-id"), - notebook: filterElement.getAttribute("data-id"), + rootID: docId, + deckID: docId, + notebook: docId, reviewedCards: options.cardsData.cards }, async (result) => { emitEvent(options.app, options.cardsData.cards[index - 1], type); diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts index 265bb5431..a875a059b 100644 --- a/app/src/protyle/wysiwyg/transaction.ts +++ b/app/src/protyle/wysiwyg/transaction.ts @@ -570,7 +570,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo: } else { protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.id}"]`).forEach((realItem: HTMLElement) => { realItem.style.animation = ""; - }) + }); } }, 450); }