This commit is contained in:
parent
6a6fdce3dd
commit
265e93dc51
7 changed files with 54 additions and 9 deletions
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"forgetCount": "遺忘次數",
|
||||
"lastReviewTime": "最後複習時間",
|
||||
"cardStatus": "卡片狀態",
|
||||
"noSupportTip": "此功能暫不支援卡包使用",
|
||||
"insertRowTip": "新增行已被過濾,可取消過濾/搜尋/排序進行查看",
|
||||
"insertRowTip2": "新增行不參與排序",
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"forgetCount": "遗忘次数",
|
||||
"lastReviewTime": "最后复习时间",
|
||||
"cardStatus": "卡片状态",
|
||||
"noSupportTip": "该功能暂不支持卡包使用",
|
||||
"insertRowTip": "新增行已被过滤,可取消过滤/搜索/排序进行查看",
|
||||
"insertRowTip2": "新增行不参与排序",
|
||||
|
|
|
@ -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
|
||||
}, () => {
|
||||
|
|
5
app/src/types/index.d.ts
vendored
5
app/src/types/index.d.ts
vendored
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue