Vanessa 2024-02-05 22:03:43 +08:00
parent d8b4f18294
commit ddf3fc32cf
2 changed files with 11 additions and 11 deletions

View file

@ -19,8 +19,8 @@ import {resize} from "../protyle/util/resize";
import {setStorageVal} from "../protyle/util/compatibility";
import {focusByRange} from "../protyle/util/selection";
const genCardCount = (unreviewedNewCardCount: number, unreviewedOldCardCount: number,) => {
return `<span class="ft__error">1</span>
const genCardCount = (unreviewedNewCardCount: number, unreviewedOldCardCount: number, index = 1) => {
return `<span class="ft__error">${index}</span>
<span class="fn__space"></span>/<span class="fn__space"></span>
<span class="ariaLabel ft__primary" aria-label="${window.siyuan.languages.flashcardNewCard}">${unreviewedNewCardCount}</span>
<span class="fn__space"></span>+<span class="fn__space"></span>
@ -205,7 +205,7 @@ export const bindCardEvent = async (options: {
editor,
actionElements,
index,
blocks: options.cardsData.cards
cardsData: options.cardsData
});
} else {
allDone(countElement, editor, actionElements);
@ -381,7 +381,7 @@ export const bindCardEvent = async (options: {
editor,
actionElements,
index,
blocks: options.cardsData.cards
cardsData: options.cardsData
});
}
return;
@ -428,7 +428,7 @@ export const bindCardEvent = async (options: {
editor,
actionElements,
index,
blocks: options.cardsData.cards
cardsData: options.cardsData
});
}
});
@ -439,7 +439,7 @@ export const bindCardEvent = async (options: {
editor,
actionElements,
index,
blocks: options.cardsData.cards
cardsData: options.cardsData
});
});
}
@ -511,7 +511,7 @@ const nextCard = (options: {
editor: Protyle,
actionElements: NodeListOf<Element>,
index: number,
blocks: ICard[]
cardsData: ICardData
}) => {
options.editor.protyle.element.classList.add("card__block--hide");
if (window.siyuan.config.flashcard.superBlock) {
@ -530,7 +530,7 @@ const nextCard = (options: {
options.actionElements[1].classList.add("fn__none");
options.editor.protyle.element.classList.remove("fn__none");
options.editor.protyle.element.nextElementSibling.classList.add("fn__none");
options.countElement.innerHTML = (options.index + 1).toString();
options.countElement.parentElement.innerHTML = genCardCount(options.cardsData.unreviewedNewCardCount, options.cardsData.unreviewedOldCardCount, options.index + 1);
options.countElement.parentElement.classList.remove("fn__none");
if (options.index === 0) {
options.actionElements[0].firstElementChild.setAttribute("disabled", "disabled");
@ -538,11 +538,11 @@ const nextCard = (options: {
options.actionElements[0].firstElementChild.removeAttribute("disabled");
}
fetchPost("/api/block/getDocInfo", {
id: options.blocks[options.index].blockID,
id: options.cardsData.cards[options.index].blockID,
}, (response) => {
options.editor.protyle.wysiwyg.renderCustom(response.data.ial);
fetchPost("/api/filetree/getDoc", {
id: options.blocks[options.index].blockID,
id: options.cardsData.cards[options.index].blockID,
mode: 0,
size: Constants.SIZE_GET_MAX
}, (response) => {

View file

@ -494,7 +494,7 @@ const getLeaf = (liElement: HTMLElement, flashcard: boolean) => {
path: liElement.getAttribute("data-path"),
flashcard,
}, response => {
if (response.data.path === "/" && response.data.files.length === 0) {
if (response.data.files.length === 0) {
showMessage(window.siyuan.languages.emptyContent);
return;
}