mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 支持配置闪卡 https://github.com/siyuan-note/siyuan/issues/7704 https://github.com/siyuan-note/siyuan/issues/7695 https://github.com/siyuan-note/siyuan/issues/7703 https://github.com/siyuan-note/siyuan/issues/7701 https://github.com/siyuan-note/siyuan/issues/7702 https://github.com/siyuan-note/siyuan/issues/7724
This commit is contained in:
parent
9d9747c59c
commit
1db4f8103b
11 changed files with 54 additions and 48 deletions
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"flashcardDailyNewCardLimit": "Daily New Card Limit",
|
||||
"flashcardDailyNewCardLimitTip": "If there are many new cards, you can set the number of daily new cards to review through this item",
|
||||
"flashcardDailyReviewCardLimit": "Daily Review Card Limit",
|
||||
"flashcardDailyReviewCardLimitTip": "If there are many review cards, you can set the number of daily review through this item",
|
||||
"flashcardNewCardLimit": "New Card Limit",
|
||||
"flashcardNewCardLimitTip": "If there are many new cards, you can set the number of new cards to review through this item",
|
||||
"flashcardReviewCardLimit": "Review Card Limit",
|
||||
"flashcardReviewCardLimitTip": "If there are many review cards, you can set the number of review through this item",
|
||||
"flashcardList": "List Carding",
|
||||
"flashcardListTip": "After enabling, the first list item of a list is recognized as a question, and the rest of the lite items are recognized as answers",
|
||||
"flashcardSuperBlock": "Super Block Carding",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"flashcardDailyNewCardLimit": "Límite diario de tarjetas nuevas",
|
||||
"flashcardDailyNewCardLimitTip": "Si hay muchas tarjetas nuevas, puede establecer la cantidad de tarjetas nuevas diarias para revisar a través de este elemento",
|
||||
"flashcardDailyReviewCardLimit": "Límite de tarjeta de revisión diaria",
|
||||
"flashcardDailyReviewCardLimitTip": "Si hay muchas tarjetas de revisión, puede establecer el número de revisión diaria a través de este elemento",
|
||||
"flashcardNewCardLimit": "Límite de tarjeta nueva",
|
||||
"flashcardNewCardLimitTip": "Si hay muchas tarjetas nuevas, puede establecer la cantidad de tarjetas nuevas para revisar a través de este elemento",
|
||||
"flashcardReviewCardLimit": "Revisar límite de tarjeta",
|
||||
"flashcardReviewCardLimitTip": "Si hay muchas tarjetas de revisión, puede establecer el número de revisión a través de este elemento",
|
||||
"flashcardList": "Lista de tarjetas",
|
||||
"flashcardListTip": "Después de habilitar, el primer elemento de una lista se reconoce como una pregunta, y el resto de los elementos básicos se reconocen como respuestas",
|
||||
"flashcardSuperBlock": "Carda de súper bloque",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"flashcardDailyNewCardLimit": "Limite quotidienne de nouvelles cartes",
|
||||
"flashcardDailyNewCardLimitTip": "S'il y a beaucoup de nouvelles cartes, vous pouvez définir le nombre de nouvelles cartes quotidiennes à examiner via cet élément",
|
||||
"flashcardDailyReviewCardLimit": "Limite quotidienne de la carte de révision",
|
||||
"flashcardDailyReviewCardLimitTip": "S'il y a plusieurs fiches d'avis, vous pouvez définir le nombre d'avis quotidiens via cet élément",
|
||||
"flashcardNewCardLimit": "Nouvelle limite de carte",
|
||||
"flashcardNewCardLimitTip": "S'il y a beaucoup de nouvelles cartes, vous pouvez définir le nombre de nouvelles cartes à examiner via cet élément",
|
||||
"flashcardReviewCardLimit": "Revoir la limite de la carte",
|
||||
"flashcardReviewCardLimitTip": "S'il y a plusieurs cartes d'avis, vous pouvez définir le nombre d'avis via cet élément",
|
||||
"flashcardList": "Fiche de liste",
|
||||
"flashcardListTip": "Après l'activation, le premier élément d'une liste est reconnu comme une question, et le reste des éléments légers sont reconnus comme des réponses",
|
||||
"flashcardSuperBlock": "Carte Super Block",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"flashcardDailyNewCardLimit": "每日新卡上限",
|
||||
"flashcardDailyNewCardLimitTip": "如果新卡較多,可以通過該項設置新卡複習的數量",
|
||||
"flashcardDailyReviewCardLimit": "每日復習卡上限",
|
||||
"flashcardDailyReviewCardLimitTip": "如果復習卡較多,可以通過該項設置每日復習的數量",
|
||||
"flashcardNewCardLimit": "新卡上限",
|
||||
"flashcardNewCardLimitTip": "如果新卡較多,可以通過該項設置新卡複習的數量",
|
||||
"flashcardReviewCardLimit": "復習卡上限",
|
||||
"flashcardReviewCardLimitTip": "如果復習卡較多,可以通過該項設置復習的數量",
|
||||
"flashcardList": "列表塊制卡",
|
||||
"flashcardListTip": "啟用後支持列表塊制卡,列表的第一個列表項被識別為問題,子列表識別為答案",
|
||||
"flashcardSuperBlock": "超級塊制卡",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"flashcardDailyNewCardLimit": "每日新卡上限",
|
||||
"flashcardDailyNewCardLimitTip": "如果新卡较多,可以通过该项设置新卡复习的数量",
|
||||
"flashcardDailyReviewCardLimit": "每日复习卡上限",
|
||||
"flashcardDailyReviewCardLimitTip": "如果复习卡较多,可以通过该项设置每日复习的数量",
|
||||
"flashcardNewCardLimit": "新卡上限",
|
||||
"flashcardNewCardLimitTip": "如果新卡较多,可以通过该项设置新卡复习的数量",
|
||||
"flashcardReviewCardLimit": "复习卡上限",
|
||||
"flashcardReviewCardLimitTip": "如果复习卡较多,可以通过该项设置复习的数量",
|
||||
"flashcardList": "列表块制卡",
|
||||
"flashcardListTip": "启用后支持列表块制卡,列表的第一个列表项被识别为问题,子列表识别为答案",
|
||||
"flashcardSuperBlock": "超级块制卡",
|
||||
|
|
|
|||
|
|
@ -5,19 +5,19 @@ export const flashcard = {
|
|||
genHTML: () => {
|
||||
return `<label class="fn__flex b3-label">
|
||||
<div class="fn__flex-1">
|
||||
${window.siyuan.languages.flashcardDailyNewCardLimit}
|
||||
<div class="b3-label__text">${window.siyuan.languages.flashcardDailyNewCardLimitTip}</div>
|
||||
${window.siyuan.languages.flashcardNewCardLimit}
|
||||
<div class="b3-label__text">${window.siyuan.languages.flashcardNewCardLimitTip}</div>
|
||||
</div>
|
||||
<span class="fn__space"></span>
|
||||
<input class="b3-text-field fn__flex-center" id="dailyNewCardLimit" step="1" min="1" type="number"${window.siyuan.config.flashcard.dailyNewCardLimit ? " checked" : "" } value="${window.siyuan.config.flashcard.dailyNewCardLimit}"/>
|
||||
<input class="b3-text-field fn__flex-center" id="newCardLimit" step="1" min="1" type="number"${window.siyuan.config.flashcard.newCardLimit ? " checked" : "" } value="${window.siyuan.config.flashcard.newCardLimit}"/>
|
||||
</label>
|
||||
<label class="fn__flex b3-label">
|
||||
<div class="fn__flex-1">
|
||||
${window.siyuan.languages.flashcardDailyReviewCardLimit}
|
||||
<div class="b3-label__text">${window.siyuan.languages.flashcardDailyReviewCardLimitTip}</div>
|
||||
${window.siyuan.languages.flashcardReviewCardLimit}
|
||||
<div class="b3-label__text">${window.siyuan.languages.flashcardReviewCardLimitTip}</div>
|
||||
</div>
|
||||
<span class="fn__space"></span>
|
||||
<input class="b3-text-field fn__flex-center" id="dailyReviewCardLimit" step="1" min="1" type="number"${window.siyuan.config.flashcard.dailyReviewCardLimit ? " checked" : ""} value="${window.siyuan.config.flashcard.dailyReviewCardLimit}"/>
|
||||
<input class="b3-text-field fn__flex-center" id="reviewCardLimit" step="1" min="1" type="number"${window.siyuan.config.flashcard.reviewCardLimit ? " checked" : ""} value="${window.siyuan.config.flashcard.reviewCardLimit}"/>
|
||||
</label>
|
||||
<label class="fn__flex b3-label">
|
||||
<div class="fn__flex-1">
|
||||
|
|
@ -48,8 +48,8 @@ export const flashcard = {
|
|||
flashcard.element.querySelectorAll("input").forEach((item) => {
|
||||
item.addEventListener("change", () => {
|
||||
fetchPost("/api/setting/setFlashcard", {
|
||||
dailyNewCardLimit: parseInt((flashcard.element.querySelector("#dailyNewCardLimit") as HTMLInputElement).value),
|
||||
dailyReviewCardLimit: parseInt((flashcard.element.querySelector("#dailyReviewCardLimit") as HTMLInputElement).value),
|
||||
newCardLimit: parseInt((flashcard.element.querySelector("#newCardLimit") as HTMLInputElement).value),
|
||||
reviewCardLimit: parseInt((flashcard.element.querySelector("#reviewCardLimit") as HTMLInputElement).value),
|
||||
list: (flashcard.element.querySelector("#list") as HTMLInputElement).checked,
|
||||
superBlock: (flashcard.element.querySelector("#superBlock") as HTMLInputElement).checked,
|
||||
deck: (flashcard.element.querySelector("#deck") as HTMLInputElement).checked,
|
||||
|
|
|
|||
4
app/src/types/index.d.ts
vendored
4
app/src/types/index.d.ts
vendored
|
|
@ -393,8 +393,8 @@ declare interface IConfig {
|
|||
key: string
|
||||
},
|
||||
flashcard: {
|
||||
dailyNewCardLimit: number
|
||||
dailyReviewCardLimit: number
|
||||
newCardLimit: number
|
||||
reviewCardLimit: number
|
||||
list: boolean
|
||||
superBlock: boolean
|
||||
deck: boolean
|
||||
|
|
|
|||
|
|
@ -95,12 +95,12 @@ func setFlashcard(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if 1 > flashcard.DailyNewCardLimit {
|
||||
flashcard.DailyNewCardLimit = 1
|
||||
if 1 > flashcard.NewCardLimit {
|
||||
flashcard.NewCardLimit = 1
|
||||
}
|
||||
|
||||
if 1 > flashcard.DailyReviewCardLimit {
|
||||
flashcard.DailyReviewCardLimit = 1
|
||||
if 1 > flashcard.ReviewCardLimit {
|
||||
flashcard.ReviewCardLimit = 1
|
||||
}
|
||||
|
||||
model.Conf.Flashcard = flashcard
|
||||
|
|
|
|||
|
|
@ -17,19 +17,19 @@
|
|||
package conf
|
||||
|
||||
type Flashcard struct {
|
||||
DailyNewCardLimit int `json:"dailyNewCardLimit"` // 每日新卡上限 https://github.com/siyuan-note/siyuan/issues/7695
|
||||
DailyReviewCardLimit int `json:"dailyReviewCardLimit"` // 每日复习卡上限 https://github.com/siyuan-note/siyuan/issues/7703
|
||||
List bool `json:"list"` // 是否启用列表块制卡 https://github.com/siyuan-note/siyuan/issues/7701
|
||||
SuperBlock bool `json:"superBlock"` // 是否启用超级块制卡 https://github.com/siyuan-note/siyuan/issues/7702
|
||||
Deck bool `json:"deck"` // 是否启用卡包制卡 https://github.com/siyuan-note/siyuan/issues/7724
|
||||
NewCardLimit int `json:"newCardLimit"` // 新卡上限 https://github.com/siyuan-note/siyuan/issues/7695
|
||||
ReviewCardLimit int `json:"reviewCardLimit"` // 复习卡上限 https://github.com/siyuan-note/siyuan/issues/7703
|
||||
List bool `json:"list"` // 是否启用列表块制卡 https://github.com/siyuan-note/siyuan/issues/7701
|
||||
SuperBlock bool `json:"superBlock"` // 是否启用超级块制卡 https://github.com/siyuan-note/siyuan/issues/7702
|
||||
Deck bool `json:"deck"` // 是否启用卡包制卡 https://github.com/siyuan-note/siyuan/issues/7724
|
||||
}
|
||||
|
||||
func NewFlashcard() *Flashcard {
|
||||
return &Flashcard{
|
||||
DailyNewCardLimit: 20,
|
||||
DailyReviewCardLimit: 200,
|
||||
List: true,
|
||||
SuperBlock: true,
|
||||
Deck: false,
|
||||
NewCardLimit: 20,
|
||||
ReviewCardLimit: 200,
|
||||
List: true,
|
||||
SuperBlock: true,
|
||||
Deck: false,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,11 +318,11 @@ func InitConf() {
|
|||
if nil == Conf.Flashcard {
|
||||
Conf.Flashcard = conf.NewFlashcard()
|
||||
}
|
||||
if 1 > Conf.Flashcard.DailyNewCardLimit {
|
||||
Conf.Flashcard.DailyNewCardLimit = 20
|
||||
if 1 > Conf.Flashcard.NewCardLimit {
|
||||
Conf.Flashcard.NewCardLimit = 20
|
||||
}
|
||||
if 1 > Conf.Flashcard.DailyReviewCardLimit {
|
||||
Conf.Flashcard.DailyReviewCardLimit = 200
|
||||
if 1 > Conf.Flashcard.ReviewCardLimit {
|
||||
Conf.Flashcard.ReviewCardLimit = 200
|
||||
}
|
||||
|
||||
if nil == Conf.AI {
|
||||
|
|
|
|||
|
|
@ -915,8 +915,14 @@ func getDeckDueCards(deck *riff.Deck) (ret []riff.Card) {
|
|||
fsrsCard := c.Impl().(*fsrs.Card)
|
||||
if fsrs.New == fsrsCard.State {
|
||||
newCount++
|
||||
if newCount > Conf.Flashcard.NewCardLimit {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
reviewCount++
|
||||
if reviewCount > Conf.Flashcard.ReviewCardLimit {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
ret = append(ret, c)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue