Skip to content

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

:art: Remove redundant settings save callbacks https://github.com/siyuan-note/siyuan/issues/19436

Daniel1fb1ab211238
diff --git a/app/src/config/tabs/editorTab.ts b/app/src/config/tabs/editorTab.ts
index c291ec6b50..7b988ff29d 100644
--- a/app/src/config/tabs/editorTab.ts
+++ b/app/src/config/tabs/editorTab.ts
@@ -90,22 +90,18 @@ const registerEditorBehaviorGroup = (tab: SettingTabBuilder) => {
].filter((item) => getHostCapabilities().localFileSystem || !["app", "folder"].includes(item.value));
const assetOpenControls = [
{
- key: "click",
label: window.siyuan.languages.assetOpenClick,
control: controlSelect("editor.assetOpen.click", {options: assetOpenOptions}),
},
{
- key: "ctrlClick",
label: window.siyuan.languages.assetOpenCtrlClick,
control: controlSelect("editor.assetOpen.ctrlClick", {options: assetOpenOptions}),
},
{
- key: "altClick",
label: window.siyuan.languages.assetOpenAltClick,
control: controlSelect("editor.assetOpen.altClick", {options: assetOpenOptions}),
},
{
- key: "shiftClick",
label: window.siyuan.languages.assetOpenShiftClick,
control: controlSelect("editor.assetOpen.shiftClick", {options: assetOpenOptions}),
},
@@ -128,7 +124,6 @@ const registerEditorBehaviorGroup = (tab: SettingTabBuilder) => {
] as StackLine[]),
controls: assetOpenControls.map((item) => ({
control: item.control,
- save: (value) => editorConfigApi.patch(`assetOpen.${item.key}`, value),
})),
});
/// #endif
diff --git a/app/src/config/tabs/fileTab.ts b/app/src/config/tabs/fileTab.ts
index b043484648..ee412335bd 100644
--- a/app/src/config/tabs/fileTab.ts
+++ b/app/src/config/tabs/fileTab.ts
@@ -95,7 +95,6 @@ const registerTabStartupGroup = (tab: SettingTabBuilder) => {
{value: 1, label: window.siyuan.languages.tabStartupNew},
{value: 2, label: window.siyuan.languages.tabStartupClose},
],
- save: (value) => fileConfigApi.patch("tabStartupMode", value),
});
};
@@ -145,15 +144,12 @@ const registerFileNewDocumentGroup = (tab: SettingTabBuilder) => {
controls: [
{
control: controlSelect("fileTree.docCreateSaveBox", {options: []}),
- save: (v) => fileConfigApi.patch("docCreateSaveBox", v),
},
{
control: controlString("fileTree.docCreateSavePath"),
- save: (v) => fileConfigApi.patch("docCreateSavePath", v),
},
{
control: controlString("fileTree.docCreateTemplatePath"),
- save: (v) => fileConfigApi.patch("docCreateTemplatePath", v),
},
],
});
@@ -179,11 +175,9 @@ const registerFileNewDocumentGroup = (tab: SettingTabBuilder) => {
controls: [
{
control: controlSelect("fileTree.refCreateSaveBox", {options: []}),
- save: (v) => fileConfigApi.patch("refCreateSaveBox", v),
},
{
control: controlString("fileTree.refCreateSavePath"),
- save: (v) => fileConfigApi.patch("refCreateSavePath", v),
},
],
});
@@ -212,11 +206,9 @@ const registerFileNewDocumentGroup = (tab: SettingTabBuilder) => {
controls: [
{
control: controlSelect("fileTree.shorthandSaveBox", {options: []}),
- save: (v) => fileConfigApi.patch("shorthandSaveBox", v),
},
{
control: controlString("fileTree.shorthandSavePath"),
- save: (v) => fileConfigApi.patch("shorthandSavePath", v),
},
],
});
diff --git a/app/src/config/tabs/syncTab.ts b/app/src/config/tabs/syncTab.ts
index c53eabb0a3..50680c931d 100644
--- a/app/src/config/tabs/syncTab.ts
+++ b/app/src/config/tabs/syncTab.ts
@@ -10,7 +10,7 @@ import {bindSyncCloudListEvent, renderSyncCloudList, setKey} from "../../sync/sy
import {Dialog} from "../../dialog";
import {genConfigItemMainHtml, genConfigItemName} from "../render/fragments";
import {getLANSyncSearchAvailability, getSyncProviderConfigKeywords} from "./syncUi";
-import {mountLANSyncStatus, mountSyncAssetDownloadMode, patchSyncConfig} from "./syncRuntime";
+import {mountLANSyncStatus, mountSyncAssetDownloadMode} from "./syncRuntime";
import {openHistory} from "../../history/history";
const registerSyncGroup = (tab: SettingTabBuilder) => {
@@ -25,7 +25,6 @@ const registerSyncGroup = (tab: SettingTabBuilder) => {
{value: 3, label: "WebDAV"},
...(["std", "docker"].includes(window.siyuan.config.system.container) ? [{value: 4, label: window.siyuan.languages.localFileSystem}] : []),
],
- save: (value) => patchSyncConfig("sync.provider", value),
});
group.slot({
key: "syncProviderConfig",
@@ -40,12 +39,10 @@ const registerSyncGroup = (tab: SettingTabBuilder) => {
group.switch("sync.enabled", {
title: window.siyuan.languages.cloudSync,
desc: window.siyuan.languages.openSyncTip2,
- save: (value) => patchSyncConfig("sync.enabled", value),
});
group.switch("sync.generateConflictDoc", {
title: window.siyuan.languages.generateConflictDoc,
desc: window.siyuan.languages.generateConflictDocTip,
- save: (value) => patchSyncConfig("sync.generateConflictDoc", value),
});
group.select("sync.mode", {
title: window.siyuan.languages.syncMode,
@@ -55,7 +52,6 @@ const registerSyncGroup = (tab: SettingTabBuilder) => {
{value: 2, label: window.siyuan.languages.syncMode2},
{value: 3, label: window.siyuan.languages.syncMode3},
],
- save: (value) => patchSyncConfig("sync.mode", value),
});
group.select("sync.assetDownloadMode", {
title: window.siyuan.languages.syncAssetDownloadMode,
@@ -64,7 +60,6 @@ const registerSyncGroup = (tab: SettingTabBuilder) => {
{value: 0, label: window.siyuan.languages.syncAssetDownloadAll},
{value: 1, label: window.siyuan.languages.syncAssetDownloadOnDemand},
],
- save: (value) => patchSyncConfig("sync.assetDownloadMode", value),
afterMount: mountSyncAssetDownloadMode,
});
group.number("sync.interval", {
@@ -73,17 +68,14 @@ const registerSyncGroup = (tab: SettingTabBuilder) => {
min: 30,
max: 43200,
unit: window.siyuan.languages.second,
- save: (value) => patchSyncConfig("sync.interval", value),
});
group.switch("sync.perception", {
title: window.siyuan.languages.syncPerception,
desc: window.siyuan.languages.syncPerceptionTip,
- save: (value) => patchSyncConfig("sync.perception", value),
});
group.switch("sync.lan.enabled", {
title: window.siyuan.languages.lanSync,
desc: `${window.siyuan.languages.lanSyncTip}<div data-type="lanSyncStatus"></div>`,
- save: (value) => patchSyncConfig("sync.lan.enabled", value),
afterMount: mountLANSyncStatus,
searchAvailability: getLANSyncSearchAvailability,
});