Browse Source

:art: https://github.com/siyuan-note/siyuan/issues/5288

Vanessa 3 years ago
parent
commit
aad1592873
3 changed files with 15 additions and 7 deletions
  1. 3 0
      app/src/assets/scss/base.scss
  2. 9 1
      app/src/util/globalShortcut.ts
  3. 3 6
      app/src/util/onGetConfig.ts

+ 3 - 0
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;

+ 9 - 1
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;
         }

+ 3 - 6
app/src/util/onGetConfig.ts

@@ -160,7 +160,7 @@ const initStatus = () => {
     const allDocks = getAllDocks();
     let menuHTML = "";
     allDocks.forEach(item => {
-        menuHTML += `<button class="b3-menu__item" data-type="${item.type}"><svg class="b3-menu__icon""><use xlink:href="#${item.icon}"></use></svg><span class="b3-menu__label">${window.siyuan.languages[item.hotkeyLangId]}</span><span class="b3-menu__accelerator">${window.siyuan.config.keymap.general[item.hotkeyLangId].custom}</span></button>`;
+        menuHTML += `<button class="b3-menu__item" data-type="${item.type}"><svg class="b3-menu__icon""><use xlink:href="#${item.icon}"></use></svg><span class="b3-menu__label">${window.siyuan.languages[item.hotkeyLangId]}</span><span class="b3-menu__accelerator">${updateHotkeyTip(window.siyuan.config.keymap.general[item.hotkeyLangId].custom)}</span></button>`;
     });
     document.getElementById("status").innerHTML = `<div id="barDock" class="toolbar__item b3-tooltips b3-tooltips__e${window.siyuan.config.readonly ? " fn__none" : ""}" aria-label="${window.siyuan.config.uiLayout.hideDock ? window.siyuan.languages.showDock : window.siyuan.languages.hideDock}">
     <svg>
@@ -185,7 +185,7 @@ const initStatus = () => {
     <svg><use xlink:href="#iconHelp"></use></svg>
 </div>`;
     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;