Skip to content

Commit

Permalink
fix #9005
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Oct 4, 2023
1 parent c8908cf commit 828eeee
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 4 deletions.
2 changes: 2 additions & 0 deletions app/appearance/langs/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@
"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",
"flashcardSuperBlockTip": "After enabling, the first child block of a super block is recognized as a question, and the rest of the child blocks are recognized as answers",
"flashcardHeading": "Heading Block Carding",
"flashcardHeadingTip": "After enabling, the heading block is recognized as a question, and the rest of the child blocks are recognized as answers",
"flashcardDeck": "Deck",
"flashcardDeckTip": "After enabling, the card deck classification is supported. This is a historical compatibility option, it is not recommended to enable it unless necessary, and it is recommended to use <code class='fn__code'>Quick make card</code>",
"flashcardFSRSParamRequestRetention": "FSRS Request Retention",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@
"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",
"flashcardSuperBlockTip": "Después de habilitar, el primer bloque secundario de un súper bloque se reconoce como una pregunta y el resto de los bloques secundarios se reconocen como respuestas",
"flashcardHeading": "Tarjeta de bloque de encabezado",
"flashcardHeadingTip": "Después de habilitarlo, el bloque de encabezado se reconoce como una pregunta y el resto de los bloques secundarios se reconocen como respuestas",
"flashcardDeck": "Mazo",
"flashcardDeckTip": "Después de habilitar, se admite la clasificación del mazo de cartas. Esta es una opción de compatibilidad histórica, no se recomienda habilitarla a menos que sea necesario, y se recomienda usar <code class='fn__code'>Quick make card</code>",
"flashcardFSRSParamRequestRetention": "Retención de solicitud FSRS",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@
"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",
"flashcardSuperBlockTip": "Après l'activation, le premier bloc enfant d'un super bloc est reconnu comme une question, et les autres blocs enfants sont reconnus comme des réponses",
"flashcardHeading": "Carte de bloc d'en-tête",
"flashcardHeadingTip": "Après activation, le bloc d'en-tête est reconnu comme une question et le reste des blocs enfants sont reconnus comme des réponses",
"flashcardDeck": "Deck",
"flashcardDeckTip": "Après l'activation, la classification du jeu de cartes est prise en charge. Il s'agit d'une option de compatibilité historique, il n'est pas recommandé de l'activer sauf si nécessaire, et il est recommandé d'utiliser <code class='fn__code'>Quick make card</code>",
"flashcardFSRSParamRequestRetention": "Rétention des requêtes FSRS",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/zh_CHT.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@
"flashcardListTip": "啟用後支持列表塊制卡,列表的第一個列表項被識別為問題,子列表識別為答案",
"flashcardSuperBlock": "超級塊制卡",
"flashcardSuperBlockTip": "啟用後支持超級塊制卡,超級塊的第一個子塊被識別為問題,其餘子塊識別為答案",
"flashcardHeading": "標題塊製卡",
"flashcardHeadingTip": "啟用後支援標題區塊製卡,標題區塊被識別為問題,其餘子區塊識別為答案",
"flashcardDeck": "卡包",
"flashcardDeckTip": "啟用後支持卡包分類。這是一個歷史兼容選項,如無必要建議不要啟用,推薦使用 <code class='fn__code'>快速制卡</code>",
"flashcardFSRSParamRequestRetention": "FSRS Request Retention",
Expand Down
2 changes: 2 additions & 0 deletions app/appearance/langs/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@
"flashcardListTip": "启用后支持列表块制卡,列表的第一个列表项被识别为问题,子列表识别为答案",
"flashcardSuperBlock": "超级块制卡",
"flashcardSuperBlockTip": "启用后支持超级块制卡,超级块的第一个子块被识别为问题,其余子块识别为答案",
"flashcardHeading": "标题块制卡",
"flashcardHeadingTip": "启用后支持标题块制卡,标题块被识别为问题,其余子块识别为答案",
"flashcardDeck": "卡包",
"flashcardDeckTip": "启用后支持卡包分类。这是一个历史兼容选项,如无必要建议不要启用,推荐使用 <code class='fn__code'>快速制卡</code>",
"flashcardFSRSParamRequestRetention": "FSRS Request Retention",
Expand Down
4 changes: 4 additions & 0 deletions app/src/assets/scss/business/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
&--hidesb .protyle-wysiwyg > .sb > div:nth-of-type(n+2):not(.protyle-attr) {
display: none;
}

&--hideh .protyle-wysiwyg > div[data-type="NodeHeading"] ~ div {
display: none;
}
}
}

Expand Down
11 changes: 9 additions & 2 deletions app/src/card/openCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export const genCardHTML = (options: {
/// #endif
return `<div class="card__main">
${iconsHTML}
<div class="card__block fn__flex-1${options.blocks.length === 0 ? " fn__none" : ""}${window.siyuan.config.flashcard.mark ? " card__block--hidemark" : ""}${window.siyuan.config.flashcard.superBlock ? " card__block--hidesb" : ""}${window.siyuan.config.flashcard.list ? " card__block--hideli" : ""}" data-type="render"></div>
<div class="card__block fn__flex-1 ${options.blocks.length === 0 ? "fn__none" : ""}
${window.siyuan.config.flashcard.mark ? "card__block--hidemark" : ""}
${window.siyuan.config.flashcard.superBlock ? "card__block--hidesb" : ""}
${window.siyuan.config.flashcard.heading ? "card__block--hideh" : ""}
${window.siyuan.config.flashcard.list ? "card__block--hideli" : ""}" data-type="render"></div>
<div class="card__empty card__empty--space${options.blocks.length === 0 ? "" : " fn__none"}" data-type="empty">
<div>🔮</div>
${window.siyuan.languages.noDueCard}
Expand Down Expand Up @@ -320,7 +324,7 @@ export const bindCardEvent = (options: {
if (actionElements[0].classList.contains("fn__none")) {
return;
}
editor.protyle.element.classList.remove("card__block--hidemark", "card__block--hideli", "card__block--hidesb");
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.blocks[index].nextDues[btnIndex];
Expand Down Expand Up @@ -460,6 +464,9 @@ const nextCard = (options: {
if (window.siyuan.config.flashcard.superBlock) {
options.editor.protyle.element.classList.add("card__block--hidesb");
}
if (window.siyuan.config.flashcard.heading) {
options.editor.protyle.element.classList.add("card__block--hideh");
}
if (window.siyuan.config.flashcard.list) {
options.editor.protyle.element.classList.add("card__block--hideli");
}
Expand Down
9 changes: 9 additions & 0 deletions app/src/config/flashcard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ export const flashcard = {
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="list" type="checkbox"${window.siyuan.config.flashcard.list ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.flashcardHeading}
<div class="b3-label__text">${window.siyuan.languages.flashcardHeadingTip}</div>
</div>
<span class="fn__space"></span>
<input class="b3-switch fn__flex-center" id="heading" type="checkbox"${window.siyuan.config.flashcard.heading ? " checked" : ""}/>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.flashcardSuperBlock}
Expand Down Expand Up @@ -119,6 +127,7 @@ export const flashcard = {
mark: (flashcard.element.querySelector("#mark") as HTMLInputElement).checked,
list: (flashcard.element.querySelector("#list") as HTMLInputElement).checked,
superBlock: (flashcard.element.querySelector("#superBlock") as HTMLInputElement).checked,
heading: (flashcard.element.querySelector("#heading") as HTMLInputElement).checked,
deck: (flashcard.element.querySelector("#deck") as HTMLInputElement).checked,
requestRetention: parseFloat((flashcard.element.querySelector("#requestRetention") as HTMLInputElement).value),
maximumInterval: parseInt((flashcard.element.querySelector("#maximumInterval") as HTMLInputElement).value),
Expand Down
6 changes: 4 additions & 2 deletions app/src/config/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ export const initConfigSearch = (element: HTMLElement, app: App) => {
// 闪卡
getLang(["riffCard", "flashcardNewCardLimit", "flashcardNewCardLimitTip", "flashcardReviewCardLimit",
"flashcardNewCardLimit", "flashcardReviewCardLimitTip", "flashcardMark", "flashcardMarkTip", "flashcardList",
"flashcardSuperBlock", "flashcardDeck", "flashcardDeckTip", "flashcardFSRSParamRequestRetention", "flashcardFSRSParamRequestRetentionTip",
"flashcardFSRSParamMaximumInterval", "flashcardFSRSParamMaximumIntervalTip", "flashcardFSRSParamWeights", "flashcardFSRSParamWeightsTip"]),
"flashcardSuperBlock", "flashcardHeading", "flashcardDeck", "flashcardDeckTip",
"flashcardFSRSParamRequestRetention", "flashcardFSRSParamRequestRetentionTip",
"flashcardFSRSParamMaximumInterval", "flashcardFSRSParamMaximumIntervalTip", "flashcardFSRSParamWeights",
"flashcardFSRSParamWeightsTip"]),

// AI
["AI"].concat(getLang(["ai", "apiTimeout", "apiTimeoutTip", "apiMaxTokens", "apiMaxTokensTip", "apiKey",
Expand Down
1 change: 1 addition & 0 deletions app/src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ interface IConfig {
mark: boolean
list: boolean
superBlock: boolean
heading: boolean
deck: boolean
requestRetention: number
maximumInterval: number
Expand Down

0 comments on commit 828eeee

Please sign in to comment.