Vanessa 2023-02-08 18:00:39 +08:00
parent dbce98d811
commit 46620cd838

View file

@ -137,7 +137,38 @@ export const syncGuide = (element?: Element) => {
setSync();
return;
}
fetchPost("/api/sync/performSync", {});
if (window.siyuan.config.sync.mode !== 3) {
fetchPost("/api/sync/performSync", {});
return;
}
const manualDialog = new Dialog({
title: window.siyuan.languages.syncMod3,
content: `<div class="b3-dialog__content">
<label>
<input type="radio" name="upload" value="true"> upload
</label>
<label>
<input type="radio" name="upload" value="false"> download
</label>
<div class="b3-dialog__action">
<button class="b3-button b3-button--cancel">${window.siyuan.languages.cancel}</button><div class="fn__space"></div>
<button class="b3-button b3-button--text">${window.siyuan.languages.confirm}</button>
</div>`,
width: isMobile() ? "80vw" : "520px",
});
const btnsElement = manualDialog.element.querySelectorAll(".b3-button");
btnsElement[0].addEventListener("click", () => {
manualDialog.destroy();
});
btnsElement[1].addEventListener("click", () => {
const uploadElement = manualDialog.element.querySelector("input[name=upload]:checked") as HTMLInputElement
if (!uploadElement) {
showMessage(window.siyuan.languages.plsChoose)
return
}
fetchPost("/api/sync/performSync", {upload: uploadElement.value === "true"});
manualDialog.destroy();
});
};
const setSync = (key?: string, dialog?: Dialog) => {