mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
🚨
This commit is contained in:
parent
c8b05a6b96
commit
ac8748d161
13 changed files with 36 additions and 36 deletions
|
|
@ -203,7 +203,7 @@ ${window.siyuan.languages.account8}`;
|
|||
account.bindEvent(element);
|
||||
showMessage(window.siyuan.languages.refreshUser, 3000);
|
||||
account.onSetaccount();
|
||||
processSync()
|
||||
processSync();
|
||||
});
|
||||
});
|
||||
element.querySelector("#logout").addEventListener("click", () => {
|
||||
|
|
@ -213,7 +213,7 @@ ${window.siyuan.languages.account8}`;
|
|||
element.innerHTML = account.genHTML();
|
||||
account.bindEvent(element);
|
||||
account.onSetaccount();
|
||||
processSync()
|
||||
processSync();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -224,7 +224,7 @@ ${window.siyuan.languages.account8}`;
|
|||
element.innerHTML = account.genHTML();
|
||||
account.bindEvent(element);
|
||||
account.onSetaccount();
|
||||
processSync()
|
||||
processSync();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -372,7 +372,7 @@ ${window.siyuan.languages.account8}`;
|
|||
},
|
||||
_afterLogin(userResponse: IWebSocketData, element: Element) {
|
||||
window.siyuan.user = userResponse.data;
|
||||
processSync()
|
||||
processSync();
|
||||
if (element.classList.contains("account") && !needSubscribe("")) {
|
||||
const dialogElement = hasClosestByClassName(element, "b3-dialog--open");
|
||||
if (dialogElement) {
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ export const repos = {
|
|||
showMessage(window.siyuan.languages._kernel[123]);
|
||||
return;
|
||||
}
|
||||
fetchPost("/api/sync/setSyncEnable", {enabled: switchElement.checked}, (response) => {
|
||||
fetchPost("/api/sync/setSyncEnable", {enabled: switchElement.checked}, () => {
|
||||
window.siyuan.config.sync.enabled = switchElement.checked;
|
||||
processSync();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ export const progressBackgroundTask = (tasks:{action:string}[]) => {
|
|||
backgroundTaskElement.setAttribute("data-tasks", JSON.stringify(tasks));
|
||||
backgroundTaskElement.innerHTML = tasks[0].action + "<div><div></div></div>";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const bootSync = () => {
|
||||
fetchPost("/api/sync/getBootSync", {}, response => {
|
||||
|
|
@ -335,31 +335,31 @@ export const downloadProgress = (data: { id: string, percent: number }) => {
|
|||
};
|
||||
|
||||
export const processSync = (data?: IWebSocketData) => {
|
||||
const iconElement = document.querySelector(isMobile()?"#menuSyncNow" : "#barSync")
|
||||
const iconElement = document.querySelector(isMobile()?"#menuSyncNow" : "#barSync");
|
||||
if (!iconElement) {
|
||||
return;
|
||||
}
|
||||
const useElement = iconElement.querySelector("use")
|
||||
const useElement = iconElement.querySelector("use");
|
||||
if (!data) {
|
||||
if (!window.siyuan.config.sync.enabled || (0 === window.siyuan.config.sync.provider && needSubscribe(""))) {
|
||||
iconElement.classList.add("toolbar__item--active");
|
||||
iconElement.setAttribute("aria-label", window.siyuan.languages["_kernel"]["53"]);
|
||||
useElement.setAttribute("xlink:href", "#iconCloudOff")
|
||||
useElement.setAttribute("xlink:href", "#iconCloudOff");
|
||||
} else {
|
||||
iconElement.classList.remove("toolbar__item--active");
|
||||
useElement.setAttribute("xlink:href", "#iconCloudSucc")
|
||||
useElement.setAttribute("xlink:href", "#iconCloudSucc");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (data.code === 0) { // syncing
|
||||
iconElement.classList.add("toolbar__item--active");
|
||||
useElement.setAttribute("xlink:href", "#iconCloudSync")
|
||||
useElement.setAttribute("xlink:href", "#iconCloudSync");
|
||||
} else if (data.code === 2) { // error
|
||||
iconElement.classList.remove("toolbar__item--active");
|
||||
useElement.setAttribute("xlink:href", "#iconCloudError")
|
||||
useElement.setAttribute("xlink:href", "#iconCloudError");
|
||||
} else if (data.code === 1) { // success
|
||||
iconElement.classList.remove("toolbar__item--active");
|
||||
useElement.setAttribute("xlink:href", "#iconCloudSucc")
|
||||
useElement.setAttribute("xlink:href", "#iconCloudSucc");
|
||||
}
|
||||
iconElement.setAttribute("aria-label", data.msg);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ export const initStatus = () => {
|
|||
iconHTML: Constants.ZWSP,
|
||||
label: item.action
|
||||
}).element);
|
||||
})
|
||||
});
|
||||
const rect = target.getBoundingClientRect();
|
||||
window.siyuan.menus.menu.popup({x: rect.right, y: rect.top}, true);
|
||||
event.stopPropagation();
|
||||
|
|
|
|||
|
|
@ -388,13 +388,13 @@ const genImportMenu = (notebookId: string, pathString: string) => {
|
|||
formData.append("notebook", notebookId);
|
||||
formData.append("toPath", pathString);
|
||||
fetchPost("/api/import/importSY", formData, () => {
|
||||
let files
|
||||
let files;
|
||||
/// #if MOBILE
|
||||
files = window.siyuan.mobile.files
|
||||
files = window.siyuan.mobile.files;
|
||||
/// #else
|
||||
files = (getDockByType("file").data["file"] as Files);
|
||||
/// #endif
|
||||
const liElement = files.element.querySelector(`[data-path="${pathString}"]`)
|
||||
const liElement = files.element.querySelector(`[data-path="${pathString}"]`);
|
||||
const toggleElement = liElement.querySelector(".b3-list-item__arrow--open");
|
||||
if (toggleElement) {
|
||||
toggleElement.classList.remove("b3-list-item__arrow--open");
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ window.openFileByURL = (openURL) => {
|
|||
if (openURL && /^siyuan:\/\/blocks\/\d{14}-\w{7}/.test(openURL)) {
|
||||
openMobileFileById(openURL.substr(16, 22),
|
||||
getSearch("focus", openURL) === "1" ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]);
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ export const initFramework = () => {
|
|||
mountHelp();
|
||||
}
|
||||
const transactionTipElement = document.getElementById("transactionTip");
|
||||
transactionTipElement.innerHTML = `${window.siyuan.languages.waitSync} <button class="b3-button">${window.siyuan.languages.syncNow}</button>`
|
||||
transactionTipElement.innerHTML = `${window.siyuan.languages.waitSync} <button class="b3-button">${window.siyuan.languages.syncNow}</button>`;
|
||||
transactionTipElement.querySelector(".b3-button").addEventListener(getEventName(), () => {
|
||||
syncGuide();
|
||||
});
|
||||
|
|
@ -162,7 +162,7 @@ export const initFramework = () => {
|
|||
});
|
||||
}
|
||||
});
|
||||
return
|
||||
return;
|
||||
}
|
||||
setEmpty();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ const showAccountInfo = (modelElement: HTMLElement, modelMainElement: Element) =
|
|||
window.siyuan.user = null;
|
||||
closePanel();
|
||||
document.getElementById("menuAccount").innerHTML = `<svg class="b3-list-item__graphic"><use xlink:href="#iconAccount"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.login}</span>`;
|
||||
processSync()
|
||||
processSync();
|
||||
});
|
||||
});
|
||||
modelMainElement.querySelector("#deactivateUser").addEventListener(getEventName(), () => {
|
||||
|
|
@ -71,7 +71,7 @@ const showAccountInfo = (modelElement: HTMLElement, modelMainElement: Element) =
|
|||
window.siyuan.user = null;
|
||||
closePanel();
|
||||
document.getElementById("menuAccount").innerHTML = `<svg class="b3-list-item__graphic"><use xlink:href="#iconAccount"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.login}</span>`;
|
||||
processSync()
|
||||
processSync();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -94,7 +94,7 @@ const showAccountInfo = (modelElement: HTMLElement, modelMainElement: Element) =
|
|||
} else {
|
||||
menuAccountElement.innerHTML = `<svg class="b3-list-item__graphic"><use xlink:href="#iconAccount"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.login}</span>`;
|
||||
}
|
||||
processSync()
|
||||
processSync();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
@ -174,7 +174,7 @@ ${accountHTML}
|
|||
<svg class="b3-list-item__graphic"><use xlink:href="#iconQuit"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.safeQuit}</span>
|
||||
</div>`;
|
||||
// 只能用 click,否则无法上下滚动 https://github.com/siyuan-note/siyuan/issues/6628
|
||||
processSync()
|
||||
processSync();
|
||||
menuElement.addEventListener("click", (event) => {
|
||||
let target = event.target as HTMLElement;
|
||||
while (target && !target.isEqualNode(menuElement)) {
|
||||
|
|
@ -669,7 +669,7 @@ ${accountHTML}
|
|||
closePanel();
|
||||
document.getElementById("menuAccount").innerHTML = `<img class="b3-list-item__graphic" src="${window.siyuan.user.userAvatarURL}"/>
|
||||
<span class="b3-list-item__text">${window.siyuan.user.userName}</span>`;
|
||||
processSync()
|
||||
processSync();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -686,7 +686,7 @@ ${accountHTML}
|
|||
closePanel();
|
||||
document.getElementById("menuAccount").innerHTML = `<img class="b3-list-item__graphic" src="${window.siyuan.user.userAvatarURL}"/>
|
||||
<span class="b3-list-item__text">${window.siyuan.user.userName}</span>`;
|
||||
processSync()
|
||||
processSync();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export const onMessage = (data: IWebSocketData) => {
|
|||
case"syncing":
|
||||
processSync(data);
|
||||
if (data.code !== 0) {
|
||||
document.getElementById("transactionTip").classList.add("fn__none")
|
||||
document.getElementById("transactionTip").classList.add("fn__none");
|
||||
}
|
||||
break;
|
||||
case "create":
|
||||
|
|
|
|||
|
|
@ -76,11 +76,11 @@ export const exportImage = (id: string) => {
|
|||
}, Constants.TIMEOUT_TRANSITION);
|
||||
});
|
||||
const previewElement = exportDialog.element.querySelector("#preview") as HTMLElement;
|
||||
const foldElement = (exportDialog.element.querySelector("#keepFold") as HTMLInputElement)
|
||||
const foldElement = (exportDialog.element.querySelector("#keepFold") as HTMLInputElement);
|
||||
foldElement.addEventListener("change", () => {
|
||||
btnsElement[0].setAttribute("disabled", "disabled");
|
||||
btnsElement[1].setAttribute("disabled", "disabled");
|
||||
btnsElement[1].parentElement.insertAdjacentHTML("afterend", `<div class="fn__loading"><img height="128px" width="128px" src="stage/loading-pure.svg"></div>`)
|
||||
btnsElement[1].parentElement.insertAdjacentHTML("afterend", "<div class=\"fn__loading\"><img height=\"128px\" width=\"128px\" src=\"stage/loading-pure.svg\"></div>");
|
||||
window.siyuan.storage[Constants.LOCAL_EXPORTIMG].keepFold = foldElement.checked;
|
||||
fetchPost("/api/export/exportPreviewHTML", {
|
||||
id,
|
||||
|
|
@ -88,7 +88,7 @@ export const exportImage = (id: string) => {
|
|||
image: true,
|
||||
}, (response) => {
|
||||
refreshPreview(response);
|
||||
})
|
||||
});
|
||||
});
|
||||
const refreshPreview = (response: IWebSocketData) => {
|
||||
previewElement.innerHTML = response.data.content;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ const promiseTransaction = () => {
|
|||
/// #if MOBILE
|
||||
if ((0 !== window.siyuan.config.sync.provider || (0 === window.siyuan.config.sync.provider && !needSubscribe(""))) &&
|
||||
window.siyuan.config.repo.key && window.siyuan.config.sync.enabled) {
|
||||
document.getElementById("transactionTip").classList.remove("fn__none")
|
||||
document.getElementById("transactionTip").classList.remove("fn__none");
|
||||
}
|
||||
/// #endif
|
||||
if (response.data[0].doOperations[0].action === "setAttrs") {
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ const setSync = (key?: string, dialog?: Dialog) => {
|
|||
});
|
||||
btnElement.addEventListener("click", () => {
|
||||
dialog.destroy();
|
||||
fetchPost("/api/sync/setSyncEnable", {enabled: true}, (response) => {
|
||||
fetchPost("/api/sync/setSyncEnable", {enabled: true}, () => {
|
||||
window.siyuan.config.sync.enabled = true;
|
||||
processSync();
|
||||
confirmDialog(window.siyuan.languages.syncConfGuide4, window.siyuan.languages.syncConfGuide5, () => {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import {addGA, initAssets, setInlineStyle, setMode} from "./assets";
|
|||
import {renderSnippet} from "../config/util/snippets";
|
||||
import {openFileById} from "../editor/util";
|
||||
import {focusByRange} from "../protyle/util/selection";
|
||||
import {exitSiYuan, processSync, progressLoading} from "../dialog/processSystem";
|
||||
import {exitSiYuan, processSync} from "../dialog/processSystem";
|
||||
import {openSetting} from "../config";
|
||||
import {getSearch} from "./functions";
|
||||
import {initStatus} from "../layout/status";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue