Vanessa 2024-03-17 09:28:33 +08:00
parent dab89c39fa
commit cb733dc6eb
2 changed files with 19 additions and 9 deletions

View File

@ -210,11 +210,12 @@ export const bindCardEvent = async (options: {
const filterElement = options.element.querySelector('[data-type="filter"]'); const filterElement = options.element.querySelector('[data-type="filter"]');
const fetchNewRound = () => { const fetchNewRound = () => {
const currentCardType = filterElement.getAttribute("data-cardtype"); const currentCardType = filterElement.getAttribute("data-cardtype");
const docId = filterElement.getAttribute("data-id");
fetchPost(currentCardType === "all" ? "/api/riff/getRiffDueCards" : fetchPost(currentCardType === "all" ? "/api/riff/getRiffDueCards" :
(currentCardType === "doc" ? "/api/riff/getTreeRiffDueCards" : "/api/riff/getNotebookRiffDueCards"), { (currentCardType === "doc" ? "/api/riff/getTreeRiffDueCards" : "/api/riff/getNotebookRiffDueCards"), {
rootID: filterElement.getAttribute("data-id"), rootID: docId,
deckID: filterElement.getAttribute("data-id"), deckID: docId,
notebook: filterElement.getAttribute("data-id"), notebook: docId,
}, async (treeCards) => { }, async (treeCards) => {
index = 0; index = 0;
options.cardsData = treeCards.data; options.cardsData = treeCards.data;
@ -239,6 +240,7 @@ export const bindCardEvent = async (options: {
const target = event.target as HTMLElement; const target = event.target as HTMLElement;
let type = ""; let type = "";
const currentCard = options.cardsData.cards[index]; const currentCard = options.cardsData.cards[index];
const docId = filterElement.getAttribute("data-id");
if (typeof event.detail === "string") { if (typeof event.detail === "string") {
if (["1", "j", "a"].includes(event.detail)) { if (["1", "j", "a"].includes(event.detail)) {
type = "1"; type = "1";
@ -287,7 +289,15 @@ export const bindCardEvent = async (options: {
icon: "iconRefresh", icon: "iconRefresh",
label: window.siyuan.languages.reset, label: window.siyuan.languages.reset,
click() { 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({ menu.addItem({
@ -356,7 +366,7 @@ export const bindCardEvent = async (options: {
cardsData: options.cardsData, cardsData: options.cardsData,
index, index,
cardType: filterElement.getAttribute("data-cardtype") as TCardType, cardType: filterElement.getAttribute("data-cardtype") as TCardType,
id: filterElement.getAttribute("data-id"), id: docId,
title: options.title title: options.title
}, },
id: "siyuan-card" id: "siyuan-card"
@ -509,9 +519,9 @@ export const bindCardEvent = async (options: {
const currentCardType = filterElement.getAttribute("data-cardtype"); const currentCardType = filterElement.getAttribute("data-cardtype");
fetchPost(currentCardType === "all" ? "/api/riff/getRiffDueCards" : fetchPost(currentCardType === "all" ? "/api/riff/getRiffDueCards" :
(currentCardType === "doc" ? "/api/riff/getTreeRiffDueCards" : "/api/riff/getNotebookRiffDueCards"), { (currentCardType === "doc" ? "/api/riff/getTreeRiffDueCards" : "/api/riff/getNotebookRiffDueCards"), {
rootID: filterElement.getAttribute("data-id"), rootID: docId,
deckID: filterElement.getAttribute("data-id"), deckID: docId,
notebook: filterElement.getAttribute("data-id"), notebook: docId,
reviewedCards: options.cardsData.cards reviewedCards: options.cardsData.cards
}, async (result) => { }, async (result) => {
emitEvent(options.app, options.cardsData.cards[index - 1], type); emitEvent(options.app, options.cardsData.cards[index - 1], type);

View File

@ -570,7 +570,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
} else { } else {
protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.id}"]`).forEach((realItem: HTMLElement) => { protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.id}"]`).forEach((realItem: HTMLElement) => {
realItem.style.animation = ""; realItem.style.animation = "";
}) });
} }
}, 450); }, 450);
} }