From aad159287355f6fcbb92ef59a3db8b3d5bebb4f9 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 25 Jun 2022 23:47:27 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/5288 --- app/src/assets/scss/base.scss | 3 +++ app/src/util/globalShortcut.ts | 10 +++++++++- app/src/util/onGetConfig.ts | 9 +++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/src/assets/scss/base.scss b/app/src/assets/scss/base.scss index 6a252d2c3..d594a1a60 100644 --- a/app/src/assets/scss/base.scss +++ b/app/src/assets/scss/base.scss @@ -29,6 +29,8 @@ @import "viewer"; /* +.status: 2 + // 需小于 .block__popover https://github.com/siyuan-note/siyuan/issues/3515 ctrl+p 搜索: 199 @@ -235,6 +237,7 @@ progressLoading: 400 box-sizing: border-box; height: 22px; line-height: 22px; + z-index: 2; &__msg { font-size: 12px; diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.ts index 7f07654d7..bd239a172 100644 --- a/app/src/util/globalShortcut.ts +++ b/app/src/util/globalShortcut.ts @@ -33,6 +33,7 @@ import {initFileMenu, initNavigationMenu} from "../menus/navigation"; import {bindMenuKeydown} from "../menus/Menu"; import {showMessage} from "../dialog/message"; import {openHistory} from "./history"; +import {needSubscribe} from "./needSubscribe"; const getRightBlock = (element: HTMLElement, x: number, y: number) => { let index = 1; @@ -242,7 +243,14 @@ export const globalShortcut = () => { } if (event.key === "F9") { - document.getElementById("barSync").dispatchEvent(new Event("click")); + if (needSubscribe() || document.querySelector("#barSync svg").classList.contains("fn__rotate")) { + return; + } + if (!window.siyuan.config.sync.enabled) { + showMessage(window.siyuan.languages._kernel[124]); + return; + } + fetchPost("/api/sync/performSync", {}); event.preventDefault(); return; } diff --git a/app/src/util/onGetConfig.ts b/app/src/util/onGetConfig.ts index 3483832af..7123f76eb 100644 --- a/app/src/util/onGetConfig.ts +++ b/app/src/util/onGetConfig.ts @@ -160,7 +160,7 @@ const initStatus = () => { const allDocks = getAllDocks(); let menuHTML = ""; allDocks.forEach(item => { - menuHTML += ``; + menuHTML += ``; }); document.getElementById("status").innerHTML = `
@@ -185,7 +185,7 @@ const initStatus = () => {
`; const dockElement = document.getElementById("barDock"); - dockElement.addEventListener("mouseenter", () => { + dockElement.addEventListener("mousemove", () => { dockElement.querySelector(".b3-menu").classList.remove("fn__none"); }); dockElement.addEventListener("mouseleave", () => { @@ -220,16 +220,13 @@ const initStatus = () => { event.stopPropagation(); break; } else if (target.id === "barSync") { - if (needSubscribe()) { + if (needSubscribe() || target.firstElementChild.classList.contains("fn__rotate")) { return; } if (!window.siyuan.config.sync.enabled) { showMessage(window.siyuan.languages._kernel[124]); return; } - if (target.firstElementChild.classList.contains("fn__rotate")) { - return; - } fetchPost("/api/sync/performSync", {}); event.stopPropagation(); break;