From 97b424603c430167231b263a1365bdcd8cf916d8 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 22 Mar 2023 10:00:55 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=97=AA=E5=8D=A1=20https://github.com/siyuan-note/siyuan/issu?= =?UTF-8?q?es/7704?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/config/{card.ts => flashcard.ts} | 14 +++++++------- app/src/config/index.ts | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) rename app/src/config/{card.ts => flashcard.ts} (76%) diff --git a/app/src/config/card.ts b/app/src/config/flashcard.ts similarity index 76% rename from app/src/config/card.ts rename to app/src/config/flashcard.ts index 66016fef9..d59c63e5f 100644 --- a/app/src/config/card.ts +++ b/app/src/config/flashcard.ts @@ -1,6 +1,6 @@ import {fetchPost} from "../util/fetch"; -export const card = { +export const flashcard = { element: undefined as Element, genHTML: () => { return ``; }, bindEvent: () => { - card.element.querySelectorAll("input").forEach((item) => { + flashcard.element.querySelectorAll("input").forEach((item) => { item.addEventListener("change", () => { fetchPost("/api/setting/setFlashcard", { - dailyNewCardLimit: parseInt((card.element.querySelector("#dailyNewCardLimit") as HTMLInputElement).value), - dailyReviewCardLimit: parseInt((card.element.querySelector("#dailyReviewCardLimit") as HTMLInputElement).value), - list: (card.element.querySelector("#list") as HTMLInputElement).checked, - superBlock: (card.element.querySelector("#superBlock") as HTMLInputElement).checked, - deck: (card.element.querySelector("#deck") as HTMLInputElement).checked, + dailyNewCardLimit: parseInt((flashcard.element.querySelector("#dailyNewCardLimit") as HTMLInputElement).value), + dailyReviewCardLimit: parseInt((flashcard.element.querySelector("#dailyReviewCardLimit") 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, }, response => { window.siyuan.config.flashcard = response.data; }); diff --git a/app/src/config/index.ts b/app/src/config/index.ts index 1360f0a28..79de4e7a1 100644 --- a/app/src/config/index.ts +++ b/app/src/config/index.ts @@ -12,7 +12,7 @@ import {bazaar} from "./bazaar"; import {query} from "./query"; import {Dialog} from "../dialog"; import {ai} from "./ai"; -import {card} from "./card"; +import {flashcard} from "./flashcard"; export const openSetting = () => { const exitDialog = window.siyuan.dialogs.find((item) => { @@ -87,9 +87,9 @@ export const openSetting = () => { ai.bindEvent(); break; case "card": - containerElement.innerHTML = card.genHTML(); - card.element = dialog.element.querySelector('.config__tab-container[data-name="card"]'); - card.bindEvent(); + containerElement.innerHTML = flashcard.genHTML(); + flashcard.element = dialog.element.querySelector('.config__tab-container[data-name="card"]'); + flashcard.bindEvent(); break; case "image": containerElement.innerHTML = image.genHTML();