Bläddra i källkod

:art: fix https://github.com/siyuan-note/siyuan/issues/7036

Vanessa 2 år sedan
förälder
incheckning
1c90c34091
3 ändrade filer med 13 tillägg och 0 borttagningar
  1. 1 0
      app/src/menus/Menu.ts
  2. 6 0
      app/src/menus/workspace.ts
  3. 6 0
      app/src/util/onGetConfig.ts

+ 1 - 0
app/src/menus/Menu.ts

@@ -77,6 +77,7 @@ export class Menu {
         this.element.classList.add("fn__none");
         this.element.classList.add("fn__none");
         this.element.classList.remove("b3-menu--list");
         this.element.classList.remove("b3-menu--list");
         this.element.removeAttribute("style");  // zIndex
         this.element.removeAttribute("style");  // zIndex
+        window.siyuan.menus.menu.element.removeAttribute("data-name");    // 标识再次点击不消失
     }
     }
 
 
     public append(element?: HTMLElement) {
     public append(element?: HTMLElement) {

+ 6 - 0
app/src/menus/workspace.ts

@@ -13,7 +13,13 @@ import {openCard} from "../card/openCard";
 import {showMessage} from "../dialog/message";
 import {showMessage} from "../dialog/message";
 
 
 export const workspaceMenu = (rect: DOMRect) => {
 export const workspaceMenu = (rect: DOMRect) => {
+    if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
+        window.siyuan.menus.menu.element.getAttribute("data-name") === "barWorkspace") {
+        window.siyuan.menus.menu.remove();
+        return;
+    }
     window.siyuan.menus.menu.remove();
     window.siyuan.menus.menu.remove();
+    window.siyuan.menus.menu.element.setAttribute("data-name", "barWorkspace");
     fetchPost("/api/system/getWorkspaces", {}, (response) => {
     fetchPost("/api/system/getWorkspaces", {}, (response) => {
         window.siyuan.menus.menu.append(new MenuItem({
         window.siyuan.menus.menu.append(new MenuItem({
             label: window.siyuan.languages.dataHistory,
             label: window.siyuan.languages.dataHistory,

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

@@ -233,7 +233,13 @@ const initBar = () => {
                 event.stopPropagation();
                 event.stopPropagation();
                 break;
                 break;
             } else if (target.id === "barMode") {
             } else if (target.id === "barMode") {
+                if (!window.siyuan.menus.menu.element.classList.contains("fn__none") &&
+                    window.siyuan.menus.menu.element.getAttribute("data-name") === "barmode") {
+                    window.siyuan.menus.menu.remove();
+                    return;
+                }
                 window.siyuan.menus.menu.remove();
                 window.siyuan.menus.menu.remove();
+                window.siyuan.menus.menu.element.setAttribute("data-name", "barmode");
                 window.siyuan.menus.menu.append(new MenuItem({
                 window.siyuan.menus.menu.append(new MenuItem({
                     label: window.siyuan.languages.themeLight,
                     label: window.siyuan.languages.themeLight,
                     icon: "iconLight",
                     icon: "iconLight",