This commit is contained in:
Vanessa 2022-08-28 11:08:33 +08:00
parent ecf004a1f0
commit 129f9cd3cf
5 changed files with 12 additions and 12 deletions

View file

@ -198,6 +198,11 @@ progressLoading: 400
background-color: var(--b3-theme-background-light); background-color: var(--b3-theme-background-light);
} }
&--sync {
background-color: var(--b3-theme-primary);
color: var(--b3-theme-on-primary);
}
svg { svg {
height: 14px; height: 14px;
width: 14px; width: 14px;

View file

@ -9,7 +9,6 @@ import {addScript, addScriptSync} from "./protyle/util/addScript";
import {genUUID} from "./util/genID"; import {genUUID} from "./util/genID";
import {fetchGet, fetchPost} from "./util/fetch"; import {fetchGet, fetchPost} from "./util/fetch";
import {addBaseURL, setNoteBook} from "./util/pathName"; import {addBaseURL, setNoteBook} from "./util/pathName";
import {repos} from "./config/repos";
import {openFileById} from "./editor/util"; import {openFileById} from "./editor/util";
import { import {
bootSync, bootSync,
@ -57,13 +56,9 @@ class App {
break; break;
case"syncing": case"syncing":
if (data.code === 0) { if (data.code === 0) {
document.querySelector("#barSync svg").classList.add("fn__rotate"); document.querySelector("#barSync").classList.add("toolbar__item--sync");
document.querySelector("#barSync").classList.add("toolbar__item--active");
repos.element?.querySelector('[data-type="sync"] svg')?.classList.add("fn__rotate");
} else { } else {
document.querySelector("#barSync svg").classList.remove("fn__rotate"); document.querySelector("#barSync").classList.remove("toolbar__item--sync");
document.querySelector("#barSync").classList.remove("toolbar__item--active");
repos.element?.querySelector('[data-type="sync"] svg')?.classList.remove("fn__rotate");
} }
document.querySelector("#barSync").setAttribute("aria-label", data.msg); document.querySelector("#barSync").setAttribute("aria-label", data.msg);
break; break;

View file

@ -112,7 +112,7 @@ export const getSyncCloudList = (cloudPanelElement: Element, reload = false, cb?
}; };
export const syncGuide = (element?: Element) => { export const syncGuide = (element?: Element) => {
if (element && element.classList.contains("fn__rotate")) { if (element && element.classList.contains("toolbar__item--sync")) {
return; return;
} }
if (isMobile()) { if (isMobile()) {

View file

@ -378,7 +378,7 @@ export const globalShortcut = () => {
if (matchHotKey(window.siyuan.config.keymap.general.syncNow.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.general.syncNow.custom, event)) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
syncGuide(document.querySelector("#barSync svg")); syncGuide(document.querySelector("#barSync"));
return; return;
} }
if (matchHotKey(window.siyuan.config.keymap.general.lockScreen.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.general.lockScreen.custom, event)) {

View file

@ -182,7 +182,7 @@ const initBar = () => {
</svg> </svg>
</div> </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))}"> <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="#iconRefresh"></use></svg> <svg><use xlink:href="#iconCloud"></use></svg>
</div> </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)}"> <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> <svg>
@ -204,7 +204,7 @@ const initBar = () => {
event.stopPropagation(); event.stopPropagation();
break; break;
} else if (target.id === "barSync") { } else if (target.id === "barSync") {
syncGuide(target.firstElementChild); syncGuide(target);
event.stopPropagation(); event.stopPropagation();
break; break;
} else if (target.id === "barForward") { } else if (target.id === "barForward") {