Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 支持配置闪卡 https://github.com/siyuan-note/siyuan/issues/7704

Liang Ding049b780ae834
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 66016fef9c..d59c63e5f9 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 `<label class="fn__flex b3-label">
@@ -45,14 +45,14 @@ export const card = {
</label>`;
},
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 1360f0a28f..79de4e7a1f 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();