This commit is contained in:
Vanessa 2023-01-12 17:50:18 +08:00
parent 137b437027
commit 1c90c34091
3 changed files with 13 additions and 0 deletions

View file

@ -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) {

View file

@ -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,

View file

@ -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",