mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-14 03:04:21 +01:00
This commit is contained in:
parent
2ac8151c7a
commit
0d6939fcdf
8 changed files with 69 additions and 18 deletions
|
|
@ -311,3 +311,19 @@ export const downloadProgress = (data: { id: string, percent: number }) => {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const processSync = (data: IWebSocketData) => {
|
||||
const iconElement = document.querySelector("#barSync")
|
||||
const useElement = iconElement.querySelector("use")
|
||||
if (data.code === 0) { // syncing
|
||||
iconElement.classList.add("toolbar__item--active");
|
||||
useElement.setAttribute("xlink:href", "#iconCloudSync")
|
||||
} else if (data.code === 2) { // error
|
||||
iconElement.classList.add("toolbar__item--active");
|
||||
useElement.setAttribute("xlink:href", "#iconCloudError")
|
||||
} else if (data.code === 1) { // success
|
||||
iconElement.classList.remove("toolbar__item--active");
|
||||
useElement.setAttribute("xlink:href", "#iconCloud")
|
||||
}
|
||||
iconElement.setAttribute("aria-label", data.msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import {addBaseURL, setNoteBook} from "./util/pathName";
|
|||
import {openFileById} from "./editor/util";
|
||||
import {
|
||||
bootSync,
|
||||
downloadProgress,
|
||||
downloadProgress, processSync,
|
||||
progressLoading,
|
||||
progressStatus,
|
||||
setTitle,
|
||||
|
|
@ -44,10 +44,10 @@ class App {
|
|||
msgCallback: (data) => {
|
||||
if (data) {
|
||||
switch (data.cmd) {
|
||||
case"progress":
|
||||
case "progress":
|
||||
progressLoading(data);
|
||||
break;
|
||||
case"setLocalStorageVal":
|
||||
case "setLocalStorageVal":
|
||||
window.siyuan.storage[data.data.key] = data.data.val;
|
||||
break;
|
||||
case "rename":
|
||||
|
|
@ -89,22 +89,17 @@ class App {
|
|||
}
|
||||
});
|
||||
break;
|
||||
case"statusbar":
|
||||
case "statusbar":
|
||||
progressStatus(data);
|
||||
break;
|
||||
case"downloadProgress":
|
||||
case "downloadProgress":
|
||||
downloadProgress(data.data);
|
||||
break;
|
||||
case"txerr":
|
||||
case "txerr":
|
||||
transactionError(data);
|
||||
break;
|
||||
case"syncing":
|
||||
if (data.code === 0) {
|
||||
document.querySelector("#barSync").classList.add("toolbar__item--active");
|
||||
} else {
|
||||
document.querySelector("#barSync").classList.remove("toolbar__item--active");
|
||||
}
|
||||
document.querySelector("#barSync").setAttribute("aria-label", data.msg);
|
||||
case "syncing":
|
||||
processSync(data)
|
||||
break;
|
||||
case "refreshtheme":
|
||||
if (!window.siyuan.config.appearance.customCSS && data.data.theme.indexOf("custom.css") > -1) {
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ const initBar = () => {
|
|||
<svg class="toolbar__svg"><use xlink:href="#iconDown"></use></svg>
|
||||
</div>
|
||||
<div id="barSync" class="toolbar__item b3-tooltips b3-tooltips__se" aria-label="${window.siyuan.config.sync.stat || (window.siyuan.languages.syncNow + " " + updateHotkeyTip(window.siyuan.config.keymap.general.syncNow.custom))}">
|
||||
<svg><use xlink:href="#iconCloud"></use></svg>
|
||||
<svg><use xlink:href="#iconCloud${window.siyuan.config.sync.enabled ? "" : "Off"}"></use></svg>
|
||||
</div>
|
||||
<button id="barBack" data-menu="true" class="toolbar__item toolbar__item--disabled b3-tooltips b3-tooltips__se" aria-label="${window.siyuan.languages.goBack} ${updateHotkeyTip(window.siyuan.config.keymap.general.goBack.custom)}">
|
||||
<svg><use xlink:href="#iconBack"></use></svg>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue