Vanessa 2022-10-09 10:33:01 +08:00
parent 2492068c4d
commit 6e7e154a3c
3 changed files with 16 additions and 0 deletions

View file

@ -108,6 +108,14 @@ export const repos = {
<span class="fn__space"></span>
<input type="checkbox" id="reposCloudSyncSwitch"${window.siyuan.config.sync.enabled ? " checked='checked'" : ""} class="b3-switch fn__flex-center">
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.generateConflictDoc}
<div class="b3-label__text">${window.siyuan.languages.generateConflictDocTip}</div>
</div>
<span class="fn__space"></span>
<input type="checkbox" id="generateConflictDoc"${window.siyuan.config.sync.generateConflictDoc ? " checked='checked'" : ""} class="b3-switch fn__flex-center">
</label>
${syncModeHTML}
<div class="b3-label">
<div class="fn__flex">
@ -146,6 +154,12 @@ ${syncModeHTML}
}
});
});
const switchConflictElement = repos.element.querySelector("#generateConflictDoc") as HTMLInputElement;
switchConflictElement.addEventListener("change", () => {
fetchPost("/api/sync/setSyncGenerateConflictDoc", {enabled: switchConflictElement.checked}, (response) => {
window.siyuan.config.sync.generateConflictDoc = switchConflictElement.checked;
});
});
const syncModeElement = repos.element.querySelector("#syncMode") as HTMLSelectElement;
syncModeElement.addEventListener("change", () => {
fetchPost("/api/sync/setSyncMode", {mode: parseInt(syncModeElement.value, 10)}, (response) => {

View file

@ -58,6 +58,7 @@ export const initConfigSearch = (element: HTMLElement) => {
// 云端
getLang(["cloudStorage", "trafficStat", "sync", "backup", "cdn", "total", "sizeLimit", "cloudBackup",
"cloudBackupTip", "updatePath", "cloudSync", "upload", "download", "syncMode", "syncModeTip",
"generateConflictDoc", "generateConflictDocTip",
"syncMode1", "syncMode2", "reposTip", "openSyncTip1", "openSyncTip2", "cloudSyncDir", "config"]),
// 账号

View file

@ -303,6 +303,7 @@ declare interface IConfig {
key: string
},
sync: {
generateConflictDoc: boolean
enabled: boolean
mode: number
synced: number