Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: fix https://github.com/siyuan-note/siyuan/issues/10505

Vanessa265e93dc51b0
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json
index abad816897..f5c454a239 100644
--- a/app/appearance/langs/en_US.json
+++ b/app/appearance/langs/en_US.json
@@ -1,4 +1,7 @@
{
+ "forgetCount": "Forget to count",
+ "lastReviewTime": "Last review time",
+ "cardStatus": "Card status",
"noSupportTip": "This function does not support the use of card packages",
"insertRowTip": "The newly added rows have been filtered and can be viewed by canceling filtering/searching/sorting",
"insertRowTip2": "New rows do not participate in sorting",
diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json
index f630e6ad4c..21774ade6b 100644
--- a/app/appearance/langs/es_ES.json
+++ b/app/appearance/langs/es_ES.json
@@ -1,4 +1,7 @@
{
+ "forgetCount": "Olvídate de contar",
+ "lastReviewTime": "Última hora de revisión",
+ "cardStatus": "Estado de la tarjeta",
"noSupportTip": "Esta función no admite el uso de paquetes de tarjetas",
"insertRowTip": "Las filas recién agregadas se han filtrado y se pueden ver cancelando el filtrado/búsqueda/clasificación",
"insertRowTip2": "Las filas nuevas no participan en la clasificación",
diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json
index 9c6ee37f44..0cf0714b6a 100644
--- a/app/appearance/langs/fr_FR.json
+++ b/app/appearance/langs/fr_FR.json
@@ -1,4 +1,7 @@
{
+ "forgetCount": "Oublier de compter",
+ "lastReviewTime": "Heure de la dernière révision",
+ "cardStatus": "Statut de la carte",
"noSupportTip": "Cette fonction ne prend pas en charge l'utilisation de packages de cartes",
"insertRowTip": "Les lignes nouvellement ajoutées ont été filtrées et peuvent être visualisées en annulant le filtrage/recherche/tri",
"insertRowTip2": "Les nouvelles lignes ne participent pas au tri",
diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json
index 0c07760e23..73c6872b74 100644
--- a/app/appearance/langs/zh_CHT.json
+++ b/app/appearance/langs/zh_CHT.json
@@ -1,4 +1,7 @@
{
+ "forgetCount": "遺忘次數",
+ "lastReviewTime": "最後複習時間",
+ "cardStatus": "卡片狀態",
"noSupportTip": "此功能暫不支援卡包使用",
"insertRowTip": "新增行已被過濾,可取消過濾/搜尋/排序進行查看",
"insertRowTip2": "新增行不參與排序",
diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json
index 92a4f9e51f..6d845a0b42 100644
--- a/app/appearance/langs/zh_CN.json
+++ b/app/appearance/langs/zh_CN.json
@@ -1,4 +1,7 @@
{
+ "forgetCount": "遗忘次数",
+ "lastReviewTime": "最后复习时间",
+ "cardStatus": "卡片状态",
"noSupportTip": "该功能暂不支持卡包使用",
"insertRowTip": "新增行已被过滤,可取消过滤/搜索/排序进行查看",
"insertRowTip2": "新增行不参与排序",
diff --git a/app/src/card/openCard.ts b/app/src/card/openCard.ts
index f227269eaa..5465e05d4d 100644
--- a/app/src/card/openCard.ts
+++ b/app/src/card/openCard.ts
@@ -13,6 +13,7 @@ import {escapeHtml} from "../util/escape";
/// #if !MOBILE
import {openFile} from "../editor/util";
/// #endif
+import * as dayjs from "dayjs";
import {getDisplayName, movePathTo} from "../util/pathName";
import {App} from "../index";
import {resize} from "../protyle/util/resize";
@@ -237,6 +238,7 @@ export const bindCardEvent = async (options: {
options.element.addEventListener("click", (event: MouseEvent) => {
const target = event.target as HTMLElement;
let type = "";
+ const currentCard = options.cardsData.cards[index]
if (typeof event.detail === "string") {
if (["1", "j", "a"].includes(event.detail)) {
type = "1";
@@ -294,21 +296,46 @@ export const bindCardEvent = async (options: {
click() {
actionElements[0].classList.add("fn__none");
actionElements[1].classList.remove("fn__none");
- if (options.cardsData.cards[index].state === 0) {
+ if (currentCard.state === 0) {
options.cardsData.unreviewedNewCardCount--;
- } else {
+ } else {
options.cardsData.unreviewedOldCardCount--;
}
options.element.dispatchEvent(new CustomEvent("click", {detail: "0"}));
transaction(undefined, [{
action: "removeFlashcards",
deckID: Constants.QUICK_DECK_ID,
- blockIDs: [options.cardsData.cards[index].blockID]
+ blockIDs: [currentCard.blockID]
}]);
options.cardsData.cards.splice(index, 1);
index--;
}
})
+ menu.addSeparator()
+ menu.addItem({
+ iconHTML: "",
+ type: "readonly",
+ label: `<div class="fn__flex">
+ <div class="fn__flex-1">${window.siyuan.languages.forgetCount}</div>
+ <div class="fn__space"></div>
+ <div>${currentCard.lapses}</div>
+</div>
+<div class="fn__flex${currentCard.lastReview > 0 ? "" : " fn__none"}">
+ <div class="fn__flex-1">${window.siyuan.languages.lastReviewTime}</div>
+ <div class="fn__space"></div>
+ <div>${dayjs(currentCard.lastReview).format("YYYY-MM-DD")}</div>
+</div>
+<div class="fn__flex">
+ <div class="fn__flex-1">${window.siyuan.languages.revisionCount}</div>
+ <div class="fn__space"></div>
+ <div>${currentCard.reps}</div>
+</div>
+<div class="fn__flex">
+ <div class="fn__flex-1">${window.siyuan.languages.cardStatus}</div>
+ <div class="fn__space"></div>
+ <div class="${window.siyuan.languages.cardStatus === 0 ? "ft__primary" : "ft__success"}">${window.siyuan.languages.cardStatus === 0 ? window.siyuan.languages.flashcardNewCard : window.siyuan.languages.flashcardReviewCard}</div>
+</div>`,
+ })
const rect = target.getBoundingClientRect();
menu.open({
x: rect.left,
@@ -426,7 +453,7 @@ export const bindCardEvent = async (options: {
type = buttonElement.getAttribute("data-type");
}
}
- if (!type || !options.cardsData.cards[index]) {
+ if (!type || !currentCard) {
return;
}
event.preventDefault();
@@ -439,10 +466,10 @@ export const bindCardEvent = async (options: {
editor.protyle.element.classList.remove("card__block--hidemark", "card__block--hideli", "card__block--hidesb", "card__block--hideh");
actionElements[0].classList.add("fn__none");
actionElements[1].querySelectorAll(".b3-button").forEach((element, btnIndex) => {
- element.previousElementSibling.textContent = options.cardsData.cards[index].nextDues[btnIndex];
+ element.previousElementSibling.textContent = currentCard.nextDues[btnIndex];
});
actionElements[1].classList.remove("fn__none");
- emitEvent(options.app, options.cardsData.cards[index], type);
+ emitEvent(options.app, currentCard, type);
return;
}
} else if (type === "-2") { // 上一步
@@ -464,8 +491,8 @@ export const bindCardEvent = async (options: {
}
if (["1", "2", "3", "4", "-3"].includes(type) && actionElements[0].classList.contains("fn__none")) {
fetchPost(type === "-3" ? "/api/riff/skipReviewRiffCard" : "/api/riff/reviewRiffCard", {
- deckID: options.cardsData.cards[index].deckID,
- cardID: options.cardsData.cards[index].cardID,
+ deckID: currentCard.deckID,
+ cardID: currentCard.cardID,
rating: parseInt(type),
reviewedCards: options.cardsData.cards
}, () => {
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index cebc06bc0c..d21eb9f20b 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -218,7 +218,10 @@ interface ICard {
cardID: string
blockID: string
nextDues: IObject
- state: number // 0:新卡
+ lapses: number // 遗忘次数
+ lastReview: number // 最后复习时间
+ reps: number // 复习次数
+ state: number // 卡片状态 0:新卡
}
interface ICardData {