🎨 When the current spaced repetition is completed, supports choose whether to continue https://github.com/siyuan-note/siyuan/issues/7943

This commit is contained in:
Liang Ding 2023-04-12 10:01:08 +08:00
parent fbf6b84a91
commit a7bc65108e
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
6 changed files with 17 additions and 7 deletions

View file

@ -258,12 +258,12 @@ export const openCardByData = (cardsData: { cards: ICard[], unreviewedCount: num
deckID: selectElement?.value,
notebook: titleElement.getAttribute("data-notebookid"),
reviewedCards: blocks
}, (treeCards) => {
}, (result) => {
index = 0;
blocks = treeCards.data.cards;
blocks = result.data.cards;
if (blocks.length === 0) {
if (treeCards.data.unreviewedCount > 0) {
newRound(countElement, editor, actionElements);
if (result.data.unreviewedCount > 0) {
newRound(countElement, editor, actionElements, result.data.unreviewedCount);
} else {
allDone(countElement, editor, actionElements);
}
@ -354,12 +354,12 @@ const allDone = (countElement: Element, editor: Protyle, actionElements: NodeLis
actionElements[1].classList.add("fn__none");
};
const newRound = (countElement: Element, editor: Protyle, actionElements: NodeListOf<Element>) => {
const newRound = (countElement: Element, editor: Protyle, actionElements: NodeListOf<Element>, unreviewedCount: number) => {
countElement.classList.add("fn__none");
editor.protyle.element.classList.add("fn__none");
const emptyElement = editor.protyle.element.nextElementSibling;
emptyElement.innerHTML = `<div>🆕</div>
<button data-type="newround" class="b3-button">Start</button>`;
emptyElement.innerHTML = `<div>♻️ ${window.siyuan.languages.continueReview2.replace("${count}", unreviewedCount)}</div>
<button data-type="newround" class="b3-button">${window.siyuan.languages.continueReview1}</button>`;
emptyElement.classList.remove("fn__none");
actionElements[0].classList.add("fn__none");
actionElements[1].classList.add("fn__none");