瀏覽代碼

:iphone: fix https://github.com/siyuan-note/siyuan/issues/7600

Vanessa 2 年之前
父節點
當前提交
e1569cf1ea
共有 2 個文件被更改,包括 9 次插入4 次删除
  1. 1 1
      app/src/menus/Menu.ts
  2. 8 3
      app/src/mobile/util/MobileBackFoward.ts

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

@@ -16,7 +16,7 @@ export class Menu {
             const target = event.target as Element;
             if (isMobile()) {
                 const titleElement = hasClosestByClassName(target, "b3-menu__title");
-                if (titleElement) {
+                if (titleElement || (typeof event.detail === "string" && event.detail === "back")) {
                     const lastShowElements = this.element.querySelectorAll(".b3-menu__item--show");
                     if (lastShowElements.length > 0) {
                         lastShowElements[lastShowElements.length - 1].classList.remove("b3-menu__item--show");

+ 8 - 3
app/src/mobile/util/MobileBackFoward.ts

@@ -109,9 +109,14 @@ export const goForward = () => {
 };
 
 export const goBack = () => {
-    if (window.JSAndroid && window.siyuan.backStack.length < 1) {
-        window.JSAndroid.returnDesktop();
-        return;
+    if (window.JSAndroid) {
+        if (window.siyuan.menus.menu.element.classList.contains("b3-menu--fullscreen") && !window.siyuan.menus.menu.element.classList.contains("fn__none")) {
+            window.siyuan.menus.menu.element.dispatchEvent(new CustomEvent("click", {detail: "back"}))
+            return;
+        } else if (window.siyuan.backStack.length < 1) {
+            window.JSAndroid.returnDesktop();
+            return;
+        }
     }
     if (window.siyuan.backStack.length < 1) {
         return;