diff --git a/src/gui/card-ui.tsx b/src/gui/card-ui.tsx index 2ff5fbab..6c784d3a 100644 --- a/src/gui/card-ui.tsx +++ b/src/gui/card-ui.tsx @@ -183,6 +183,22 @@ export class CardUI { // #region -> Functions & helpers + // Scroll the asking/answer into view for long context. + private _scrollClozeIntoView(showAnswer: boolean): void { + if (!this.settings.scrollToCloze) { + return; + } + const el = this.content.querySelector(".cloze") as HTMLElement; + if (el) { + requestAnimationFrame(() => { + el.scrollIntoView({ + behavior: showAnswer ? "auto" : this.settings.scrollBehavior, + block: this.settings.scrollBlock, + }); + }); + } + } + private async _drawContent() { this.resetButton.disabled = true; @@ -212,8 +228,7 @@ export class CardUI { this.content, this._currentQuestion.questionText.textDirection, ); - // Set scroll position back to top - this.content.scrollTop = 0; + this._scrollClozeIntoView(false); // Update response buttons this._resetResponseButtons(); @@ -556,7 +571,7 @@ export class CardUI { } } - private _showAnswer(): void { + private async _showAnswer() { const timeNow = now(); if ( this.lastPressed && @@ -583,11 +598,12 @@ export class CardUI { this.plugin, this._currentNote.filePath, ); - wrapper.renderMarkdownWrapper( + await wrapper.renderMarkdownWrapper( this._currentCard.back, this.content, this._currentQuestion.questionText.textDirection, ); + this._scrollClozeIntoView(true); // Show response buttons this.answerButton.addClass("sr-is-hidden"); diff --git a/src/gui/settings.tsx b/src/gui/settings.tsx index 20dc2092..a6902a9f 100644 --- a/src/gui/settings.tsx +++ b/src/gui/settings.tsx @@ -719,6 +719,49 @@ export class SRSettingTab extends PluginSettingTab { this.display(); }); }); + new Setting(containerEl) + .setName(t("SCROLL_TO_CLOZE_AUTO")) + .setDesc(t("SCROLL_TO_CLOZE_AUTO_DESC")) + .addToggle((toggle) => + toggle.setValue(this.plugin.data.settings.scrollToCloze).onChange(async (value) => { + this.plugin.data.settings.scrollToCloze = value; + await this.plugin.savePluginData(); + }), + ); + + new Setting(containerEl) + .setName(t("SCROLL_BEHAVIOR")) + .setDesc(t("SCROLL_BEHAVIOR_DESC")) + .addDropdown((dropdown) => + dropdown + .addOptions({ + auto: "Auto (instant)", + smooth: "Smooth (animated)", + }) + .setValue(this.plugin.data.settings.scrollBehavior) + .onChange(async (value: "auto" | "smooth") => { + this.plugin.data.settings.scrollBehavior = value; + await this.plugin.savePluginData(); + }), + ); + + new Setting(containerEl) + .setName(t("SCROLL_BLOCK")) + .setDesc(t("SCROLL_BLOCK_DESC")) + .addDropdown((dropdown) => + dropdown + .addOptions({ + start: "Start (top of view)", + center: "Center (middle of view)", + end: "End (bottom of view)", + nearest: "Nearest (minimum scroll)", + }) + .setValue(this.plugin.data.settings.scrollBlock) + .onChange(async (value: "start" | "center" | "end" | "nearest") => { + this.plugin.data.settings.scrollBlock = value; + await this.plugin.savePluginData(); + }), + ); containerEl.createEl("h3", { text: t("GROUP_FLASHCARDS_NOTES") }); new Setting(containerEl) diff --git a/src/lang/locale/ar.ts b/src/lang/locale/ar.ts index 22b458c5..1a2482be 100644 --- a/src/lang/locale/ar.ts +++ b/src/lang/locale/ar.ts @@ -101,6 +101,15 @@ export default { "يجب ضبطها على 100 ٪ على الهاتف المحمول أو إذا كان لديك صور كبيرة جدًا", RESET_DEFAULT: "إعادة تعيين إلى الافتراضي", CARD_MODAL_WIDTH_PERCENT: "نسبة عرض البطاقة", + SCROLL_TO_CLOZE_AUTO: "Auto-scroll to cloze", + SCROLL_TO_CLOZE_AUTO_DESC: + "Automatically scroll the hidden cloze deletion (e.g., [...]) into view when the card is shown.", + SCROLL_BEHAVIOR: "Scroll behavior", + SCROLL_BEHAVIOR_DESC: + "Choose how the card scrolls to the hidden cloze — instantly or smoothly with animation.", + SCROLL_BLOCK: "Scroll position", + SCROLL_BLOCK_DESC: + "Define where the hidden cloze will appear in the view after scrolling — top, center, bottom, or nearest visible.", RANDOMIZE_CARD_ORDER: "ترتيب بطاقة عشوائي أثناء المراجعة؟", REVIEW_CARD_ORDER_WITHIN_DECK: "Order cards in a deck are displayed during review", REVIEW_CARD_ORDER_NEW_FIRST_SEQUENTIAL: "Sequentially within a deck (All new cards first)", diff --git a/src/lang/locale/cz.ts b/src/lang/locale/cz.ts index a2d284d7..67a4b606 100644 --- a/src/lang/locale/cz.ts +++ b/src/lang/locale/cz.ts @@ -104,6 +104,15 @@ export default { "Mělo by být nastaveno na 100% na mobilu nebo když používáte velké obrázky", RESET_DEFAULT: "Resetovat výchozí nastavení", CARD_MODAL_WIDTH_PERCENT: "Šířka kartiček v procentech", + SCROLL_TO_CLOZE_AUTO: "Auto-scroll to cloze", + SCROLL_TO_CLOZE_AUTO_DESC: + "Automatically scroll the hidden cloze deletion (e.g., [...]) into view when the card is shown.", + SCROLL_BEHAVIOR: "Scroll behavior", + SCROLL_BEHAVIOR_DESC: + "Choose how the card scrolls to the hidden cloze — instantly or smoothly with animation.", + SCROLL_BLOCK: "Scroll position", + SCROLL_BLOCK_DESC: + "Define where the hidden cloze will appear in the view after scrolling — top, center, bottom, or nearest visible.", RANDOMIZE_CARD_ORDER: "Náhodně změnit pořadí kartiček během revize?", REVIEW_CARD_ORDER_WITHIN_DECK: "Order cards in a deck are displayed during review", REVIEW_CARD_ORDER_NEW_FIRST_SEQUENTIAL: "Sequentially within a deck (All new cards first)", diff --git a/src/lang/locale/de.ts b/src/lang/locale/de.ts index a0443850..c0b57e47 100644 --- a/src/lang/locale/de.ts +++ b/src/lang/locale/de.ts @@ -111,6 +111,15 @@ export default { "Auf kleinen Bildschirmen (z.B. Smartphones) oder bei sehr grossen Bildern sollte dieser Wert auf 100% gesetzt werden.", RESET_DEFAULT: "Standardeinstellung wiederherstellen", CARD_MODAL_WIDTH_PERCENT: "Breite einer Lernkarte in Prozent", + SCROLL_TO_CLOZE_AUTO: "Auto-scroll to cloze", + SCROLL_TO_CLOZE_AUTO_DESC: + "Automatically scroll the hidden cloze deletion (e.g., [...]) into view when the card is shown.", + SCROLL_BEHAVIOR: "Scroll behavior", + SCROLL_BEHAVIOR_DESC: + "Choose how the card scrolls to the hidden cloze — instantly or smoothly with animation.", + SCROLL_BLOCK: "Scroll position", + SCROLL_BLOCK_DESC: + "Define where the hidden cloze will appear in the view after scrolling — top, center, bottom, or nearest visible.", RANDOMIZE_CARD_ORDER: "Während der Wiederhoung die Reihenfolge zufällig mischen?", REVIEW_CARD_ORDER_WITHIN_DECK: "Reihenfolge der Karten innerhalb eines Stapels während der Wiederholung", diff --git a/src/lang/locale/en.ts b/src/lang/locale/en.ts index 5f9f0aed..0bc61d5b 100644 --- a/src/lang/locale/en.ts +++ b/src/lang/locale/en.ts @@ -104,6 +104,15 @@ export default { "Should be set to 100% on mobile or if you have very large images", RESET_DEFAULT: "Reset to default", CARD_MODAL_WIDTH_PERCENT: "Flashcard Width Percentage", + SCROLL_TO_CLOZE_AUTO: "Auto-scroll to cloze", + SCROLL_TO_CLOZE_AUTO_DESC: + "Automatically scroll the hidden cloze deletion (e.g., [...]) into view when the card is shown.", + SCROLL_BEHAVIOR: "Scroll behavior", + SCROLL_BEHAVIOR_DESC: + "Choose how the card scrolls to the hidden cloze — instantly or smoothly with animation.", + SCROLL_BLOCK: "Scroll position", + SCROLL_BLOCK_DESC: + "Define where the hidden cloze will appear in the view after scrolling — top, center, bottom, or nearest visible.", RANDOMIZE_CARD_ORDER: "Randomize card order during review?", REVIEW_CARD_ORDER_WITHIN_DECK: "Order cards in a deck are displayed during review", REVIEW_CARD_ORDER_NEW_FIRST_SEQUENTIAL: "Sequentially within a deck (All new cards first)", diff --git a/src/lang/locale/es.ts b/src/lang/locale/es.ts index e8e444ee..734895e8 100644 --- a/src/lang/locale/es.ts +++ b/src/lang/locale/es.ts @@ -104,6 +104,15 @@ export default { CARD_MODAL_SIZE_PERCENT_DESC: "Debería ser establecido en 100% si tienes imágenes grandes", RESET_DEFAULT: "Reiniciar a la configuración por defecto", CARD_MODAL_WIDTH_PERCENT: "Porcentaje del ancho de las tarjetas de memoria", + SCROLL_TO_CLOZE_AUTO: "Auto-scroll to cloze", + SCROLL_TO_CLOZE_AUTO_DESC: + "Automatically scroll the hidden cloze deletion (e.g., [...]) into view when the card is shown.", + SCROLL_BEHAVIOR: "Scroll behavior", + SCROLL_BEHAVIOR_DESC: + "Choose how the card scrolls to the hidden cloze — instantly or smoothly with animation.", + SCROLL_BLOCK: "Scroll position", + SCROLL_BLOCK_DESC: + "Define where the hidden cloze will appear in the view after scrolling — top, center, bottom, or nearest visible.", RANDOMIZE_CARD_ORDER: "¿Aleatorizar el orden de las tarjetas para revisión?", REVIEW_CARD_ORDER_WITHIN_DECK: "Order cards in a deck are displayed during review", REVIEW_CARD_ORDER_NEW_FIRST_SEQUENTIAL: "Sequentially within a deck (All new cards first)", diff --git a/src/lang/locale/fr.ts b/src/lang/locale/fr.ts index 960ac83f..f7aba216 100644 --- a/src/lang/locale/fr.ts +++ b/src/lang/locale/fr.ts @@ -105,6 +105,15 @@ export default { CARD_MODAL_SIZE_PERCENT_DESC: "Devrait être 100% sur mobile ou en cas de grandes images", RESET_DEFAULT: "Réinitialiser les paramètres", CARD_MODAL_WIDTH_PERCENT: "Pourcentage de largeur de la flashcard", + SCROLL_TO_CLOZE_AUTO: "Auto-scroll to cloze", + SCROLL_TO_CLOZE_AUTO_DESC: + "Automatically scroll the hidden cloze deletion (e.g., [...]) into view when the card is shown.", + SCROLL_BEHAVIOR: "Scroll behavior", + SCROLL_BEHAVIOR_DESC: + "Choose how the card scrolls to the hidden cloze — instantly or smoothly with animation.", + SCROLL_BLOCK: "Scroll position", + SCROLL_BLOCK_DESC: + "Define where the hidden cloze will appear in the view after scrolling — top, center, bottom, or nearest visible.", RANDOMIZE_CARD_ORDER: "Apprendre les cartes dans un ordre aléatoire ?", REVIEW_CARD_ORDER_WITHIN_DECK: "Ordre d'affichage des cartes d'un paquet pendant les révisions", REVIEW_CARD_ORDER_NEW_FIRST_SEQUENTIAL: "Dans l'ordre du paquet (Nouvelles cartes d'abord)", diff --git a/src/lang/locale/it.ts b/src/lang/locale/it.ts index 9f3d62fd..88884fd7 100644 --- a/src/lang/locale/it.ts +++ b/src/lang/locale/it.ts @@ -107,6 +107,15 @@ export default { "Dovrebbe essere 100% se sei su telefono o se hai immagini molto grandi", RESET_DEFAULT: "Reimposta alle impostazioni iniziali", CARD_MODAL_WIDTH_PERCENT: "Percentuale di larghezza delle schede", + SCROLL_TO_CLOZE_AUTO: "Auto-scroll to cloze", + SCROLL_TO_CLOZE_AUTO_DESC: + "Automatically scroll the hidden cloze deletion (e.g., [...]) into view when the card is shown.", + SCROLL_BEHAVIOR: "Scroll behavior", + SCROLL_BEHAVIOR_DESC: + "Choose how the card scrolls to the hidden cloze — instantly or smoothly with animation.", + SCROLL_BLOCK: "Scroll position", + SCROLL_BLOCK_DESC: + "Define where the hidden cloze will appear in the view after scrolling — top, center, bottom, or nearest visible.", RANDOMIZE_CARD_ORDER: "Rendere casuale l'ordine delle schede durante la revisione?", REVIEW_CARD_ORDER_WITHIN_DECK: "L'ordine in cui le schede saranno visualizzate all'interno del mazzo", diff --git a/src/lang/locale/ja.ts b/src/lang/locale/ja.ts index b0be8d3b..2ea2c7b5 100644 --- a/src/lang/locale/ja.ts +++ b/src/lang/locale/ja.ts @@ -107,6 +107,15 @@ export default { "モバイル版、または非常に大きなサイズの画像がある場合には100%にする必要があります。", RESET_DEFAULT: "デフォルト値にリセットする", CARD_MODAL_WIDTH_PERCENT: "フラッシュカードの横サイズのパーセンテージ", + SCROLL_TO_CLOZE_AUTO: "Auto-scroll to cloze", + SCROLL_TO_CLOZE_AUTO_DESC: + "Automatically scroll the hidden cloze deletion (e.g., [...]) into view when the card is shown.", + SCROLL_BEHAVIOR: "Scroll behavior", + SCROLL_BEHAVIOR_DESC: + "Choose how the card scrolls to the hidden cloze — instantly or smoothly with animation.", + SCROLL_BLOCK: "Scroll position", + SCROLL_BLOCK_DESC: + "Define where the hidden cloze will appear in the view after scrolling — top, center, bottom, or nearest visible.", RANDOMIZE_CARD_ORDER: "レビュー中のカードの順番をランダムにしますか?", REVIEW_CARD_ORDER_WITHIN_DECK: "Order cards in a deck are displayed during review", REVIEW_CARD_ORDER_NEW_FIRST_SEQUENTIAL: "Sequentially within a deck (All new cards first)", diff --git a/src/lang/locale/ko.ts b/src/lang/locale/ko.ts index e7dc5912..149a223b 100644 --- a/src/lang/locale/ko.ts +++ b/src/lang/locale/ko.ts @@ -105,6 +105,15 @@ export default { "모바일 버전 혹은 매우 큰 이미지가 있는 경우 100%로 설정해야 합니다.", RESET_DEFAULT: "기본값으로 초기화", CARD_MODAL_WIDTH_PERCENT: "플래시카드 너비 비율", + SCROLL_TO_CLOZE_AUTO: "Auto-scroll to cloze", + SCROLL_TO_CLOZE_AUTO_DESC: + "Automatically scroll the hidden cloze deletion (e.g., [...]) into view when the card is shown.", + SCROLL_BEHAVIOR: "Scroll behavior", + SCROLL_BEHAVIOR_DESC: + "Choose how the card scrolls to the hidden cloze — instantly or smoothly with animation.", + SCROLL_BLOCK: "Scroll position", + SCROLL_BLOCK_DESC: + "Define where the hidden cloze will appear in the view after scrolling — top, center, bottom, or nearest visible.", RANDOMIZE_CARD_ORDER: "리뷰중인 카드의 순서를 랜덤으로 두시겠습니까?", REVIEW_CARD_ORDER_WITHIN_DECK: "Order cards in a deck are displayed during review", REVIEW_CARD_ORDER_NEW_FIRST_SEQUENTIAL: "Sequentially within a deck (All new cards first)", diff --git a/src/lang/locale/pl.ts b/src/lang/locale/pl.ts index 11ad51de..029244d2 100644 --- a/src/lang/locale/pl.ts +++ b/src/lang/locale/pl.ts @@ -104,6 +104,15 @@ export default { "Powinno być ustawione na 100% na urządzeniach mobilnych lub gdy masz bardzo duże obrazy", RESET_DEFAULT: "Zresetuj do domyślnych", CARD_MODAL_WIDTH_PERCENT: "Procentowa szerokość fiszki", + SCROLL_TO_CLOZE_AUTO: "Auto-scroll to cloze", + SCROLL_TO_CLOZE_AUTO_DESC: + "Automatically scroll the hidden cloze deletion (e.g., [...]) into view when the card is shown.", + SCROLL_BEHAVIOR: "Scroll behavior", + SCROLL_BEHAVIOR_DESC: + "Choose how the card scrolls to the hidden cloze — instantly or smoothly with animation.", + SCROLL_BLOCK: "Scroll position", + SCROLL_BLOCK_DESC: + "Define where the hidden cloze will appear in the view after scrolling — top, center, bottom, or nearest visible.", RANDOMIZE_CARD_ORDER: "Czy losować kolejność kart podczas przeglądu?", REVIEW_CARD_ORDER_WITHIN_DECK: "Kolejność kart w talii wyświetlana podczas przeglądania", REVIEW_CARD_ORDER_NEW_FIRST_SEQUENTIAL: diff --git a/src/lang/locale/pt-br.ts b/src/lang/locale/pt-br.ts index 472bbc25..efcb8444 100644 --- a/src/lang/locale/pt-br.ts +++ b/src/lang/locale/pt-br.ts @@ -107,6 +107,15 @@ export default { "Deveria estar configurado em 100% em dispositivos móveis ou se você tem imagens muito grandes", RESET_DEFAULT: "Reiniciar para a pré-definição", CARD_MODAL_WIDTH_PERCENT: "Porcentagem de Largura do Flashcard", + SCROLL_TO_CLOZE_AUTO: "Auto-scroll to cloze", + SCROLL_TO_CLOZE_AUTO_DESC: + "Automatically scroll the hidden cloze deletion (e.g., [...]) into view when the card is shown.", + SCROLL_BEHAVIOR: "Scroll behavior", + SCROLL_BEHAVIOR_DESC: + "Choose how the card scrolls to the hidden cloze — instantly or smoothly with animation.", + SCROLL_BLOCK: "Scroll position", + SCROLL_BLOCK_DESC: + "Define where the hidden cloze will appear in the view after scrolling — top, center, bottom, or nearest visible.", RANDOMIZE_CARD_ORDER: "Aleatorizar a ordem das cartas durante a revisão?", REVIEW_CARD_ORDER_WITHIN_DECK: "Order cards in a deck are displayed during review", REVIEW_CARD_ORDER_NEW_FIRST_SEQUENTIAL: "Sequentially within a deck (All new cards first)", diff --git a/src/lang/locale/ru.ts b/src/lang/locale/ru.ts index 7edb42c8..55c23792 100644 --- a/src/lang/locale/ru.ts +++ b/src/lang/locale/ru.ts @@ -112,6 +112,15 @@ export default { "Если пользуетесь мобильным телефоном, выставьте 100%. Иначе у вас будут огромные изображения", RESET_DEFAULT: "Настройки по-умолчанию", CARD_MODAL_WIDTH_PERCENT: "Ширина карточки в процентах", + SCROLL_TO_CLOZE_AUTO: "Auto-scroll to cloze", + SCROLL_TO_CLOZE_AUTO_DESC: + "Automatically scroll the hidden cloze deletion (e.g., [...]) into view when the card is shown.", + SCROLL_BEHAVIOR: "Scroll behavior", + SCROLL_BEHAVIOR_DESC: + "Choose how the card scrolls to the hidden cloze — instantly or smoothly with animation.", + SCROLL_BLOCK: "Scroll position", + SCROLL_BLOCK_DESC: + "Define where the hidden cloze will appear in the view after scrolling — top, center, bottom, or nearest visible.", RANDOMIZE_CARD_ORDER: "Случайный порядок карт во время изучения?", REVIEW_CARD_ORDER_WITHIN_DECK: "Порядок отображения карт колоды во время изучения", REVIEW_CARD_ORDER_NEW_FIRST_SEQUENTIAL: diff --git a/src/lang/locale/tr.ts b/src/lang/locale/tr.ts index 4988957f..ac306ba1 100644 --- a/src/lang/locale/tr.ts +++ b/src/lang/locale/tr.ts @@ -104,6 +104,15 @@ export default { "Mobilde veya çok büyük resimleriniz varsa %100 olarak ayarlayın.", RESET_DEFAULT: "Varsayılana sıfırla", CARD_MODAL_WIDTH_PERCENT: "Flash Kart Genişlik Yüzdesi", + SCROLL_TO_CLOZE_AUTO: "Auto-scroll to cloze", + SCROLL_TO_CLOZE_AUTO_DESC: + "Automatically scroll the hidden cloze deletion (e.g., [...]) into view when the card is shown.", + SCROLL_BEHAVIOR: "Scroll behavior", + SCROLL_BEHAVIOR_DESC: + "Choose how the card scrolls to the hidden cloze — instantly or smoothly with animation.", + SCROLL_BLOCK: "Scroll position", + SCROLL_BLOCK_DESC: + "Define where the hidden cloze will appear in the view after scrolling — top, center, bottom, or nearest visible.", RANDOMIZE_CARD_ORDER: "İnceleme sırasında kart sırasını rastgele yap?", REVIEW_CARD_ORDER_WITHIN_DECK: "İnceleme sırasında bir destede kartların görüntülenme sırası", REVIEW_CARD_ORDER_NEW_FIRST_SEQUENTIAL: "Sıralı olarak (önce tüm yeni kartlar)", diff --git a/src/lang/locale/zh-cn.ts b/src/lang/locale/zh-cn.ts index eecfd814..8e69460a 100644 --- a/src/lang/locale/zh-cn.ts +++ b/src/lang/locale/zh-cn.ts @@ -98,6 +98,12 @@ export default { CARD_MODAL_SIZE_PERCENT_DESC: "请在移动端使用并需要浏览较大图片时设为100%", RESET_DEFAULT: "重置为默认", CARD_MODAL_WIDTH_PERCENT: "卡片宽度百分比", + SCROLL_TO_CLOZE_AUTO: "自动滚动到遮盖词", + SCROLL_TO_CLOZE_AUTO_DESC: "当卡片显示时,自动滚动使完形填空(如 [...])出现在视图中。", + SCROLL_BEHAVIOR: "滚动方式", + SCROLL_BEHAVIOR_DESC: "选择滚动到完形填空的方式:立即跳转或使用平滑动画。", + SCROLL_BLOCK: "滚动位置", + SCROLL_BLOCK_DESC: "定义滚动后完形填空在视图中的位置:顶部、中间、底部或最邻近可见处。", RANDOMIZE_CARD_ORDER: "复习时随机显示卡片?", REVIEW_CARD_ORDER_WITHIN_DECK: "复习时卡片组内的卡片排序", REVIEW_CARD_ORDER_NEW_FIRST_SEQUENTIAL: "卡片组内顺序 (全部新卡片优先)", diff --git a/src/lang/locale/zh-tw.ts b/src/lang/locale/zh-tw.ts index ccca8997..438027d1 100644 --- a/src/lang/locale/zh-tw.ts +++ b/src/lang/locale/zh-tw.ts @@ -99,6 +99,12 @@ export default { CARD_MODAL_SIZE_PERCENT_DESC: "在移動端或需要較大圖片時應設定為100%", RESET_DEFAULT: "重置為預設值", CARD_MODAL_WIDTH_PERCENT: "卡片寬度百分比", + SCROLL_TO_CLOZE_AUTO: "自動捲動至完形填空", + SCROLL_TO_CLOZE_AUTO_DESC: "當卡片顯示時,自動捲動以使完形填空(例如 [...])出現在畫面中。", + SCROLL_BEHAVIOR: "捲動行為", + SCROLL_BEHAVIOR_DESC: "選擇捲動至完形填空的方式:立即跳轉或使用平滑動畫。", + SCROLL_BLOCK: "捲動位置", + SCROLL_BLOCK_DESC: "定義捲動後完形填空在畫面中的位置:頂部、中間、底部或最鄰近可見處。", RANDOMIZE_CARD_ORDER: "復習時隨機顯示卡片?", REVIEW_CARD_ORDER_WITHIN_DECK: "復習時牌組內的卡片排序", REVIEW_CARD_ORDER_NEW_FIRST_SEQUENTIAL: "牌組內順序 (全部新卡片優先)", diff --git a/src/question-type.ts b/src/question-type.ts index b11c2174..403c76ce 100644 --- a/src/question-type.ts +++ b/src/question-type.ts @@ -112,11 +112,11 @@ class QuestionTypeCloze implements IQuestionTypeHandler { export class QuestionTypeClozeFormatter implements IClozeFormatter { asking(answer?: string, hint?: string): string { - return `${!hint ? "[...]" : `[${hint}]`}`; + return `${!hint ? "[...]" : `[${hint}]`}`; } showingAnswer(answer: string, _hint?: string): string { - return `${answer}`; + return `${answer}`; } hiding(answer?: string, hint?: string): string { diff --git a/src/settings.ts b/src/settings.ts index d2c8a3da..a490d24d 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -41,6 +41,9 @@ export interface SRSettings { showIntervalInReviewButtons: boolean; flashcardHeightPercentage: number; flashcardWidthPercentage: number; + scrollToCloze: boolean; + scrollBehavior: "auto" | "smooth"; + scrollBlock: "start" | "center" | "end" | "nearest"; flashcardEasyText: string; flashcardGoodText: string; flashcardHardText: string; @@ -101,6 +104,9 @@ export const DEFAULT_SETTINGS: SRSettings = { showIntervalInReviewButtons: true, flashcardHeightPercentage: Platform.isMobile ? 100 : 80, flashcardWidthPercentage: Platform.isMobile ? 100 : 40, + scrollToCloze: true, + scrollBehavior: "auto", + scrollBlock: "center", flashcardEasyText: t("EASY"), flashcardGoodText: t("GOOD"), flashcardHardText: t("HARD"), diff --git a/tests/unit/note-question-parser.test.ts b/tests/unit/note-question-parser.test.ts index 5d9f6737..45bc56ad 100644 --- a/tests/unit/note-question-parser.test.ts +++ b/tests/unit/note-question-parser.test.ts @@ -602,8 +602,8 @@ Stop trying ==to milk the crowd== for sympathy. // доить толпу topicPathList: TopicPathList.fromPsv("#flashcards/English", 3), // #flashcards/English is on the 4th line, line number 3 cards: [ new Card({ - front: "Stop trying [...] for sympathy. // доить толпу", - back: "Stop trying to milk the crowd for sympathy. // доить толпу", + front: "Stop trying [...] for sympathy. // доить толпу", + back: "Stop trying to milk the crowd for sympathy. // доить толпу", }), ], }, diff --git a/tests/unit/question-type.test.ts b/tests/unit/question-type.test.ts index c8e78786..6d2d8b76 100644 --- a/tests/unit/question-type.test.ts +++ b/tests/unit/question-type.test.ts @@ -85,16 +85,16 @@ test("CardType.Cloze", () => { ), ).toEqual([ new CardFrontBack( - "This is a really very interesting and [...] and great test", - "This is a really very interesting and fascinating and great test", + "This is a really very interesting and [...] and great test", + "This is a really very interesting and fascinating and great test", ), new CardFrontBack( - "This is a really very interesting and fascinating and [...] test", - "This is a really very interesting and fascinating and great test", + "This is a really very interesting and fascinating and [...] test", + "This is a really very interesting and fascinating and great test", ), new CardFrontBack( - "This is a really very [...] and fascinating and great test", - "This is a really very interesting and fascinating and great test", + "This is a really very [...] and fascinating and great test", + "This is a really very interesting and fascinating and great test", ), ]); });