This commit is contained in:
Vanessa 2023-03-08 10:36:33 +08:00
parent 7630cbb291
commit e1569cf1ea
2 changed files with 9 additions and 4 deletions

View File

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

View File

@ -109,9 +109,14 @@ export const goForward = () => {
}; };
export const goBack = () => { export const goBack = () => {
if (window.JSAndroid && window.siyuan.backStack.length < 1) { if (window.JSAndroid) {
window.JSAndroid.returnDesktop(); if (window.siyuan.menus.menu.element.classList.contains("b3-menu--fullscreen") && !window.siyuan.menus.menu.element.classList.contains("fn__none")) {
return; 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) { if (window.siyuan.backStack.length < 1) {
return; return;