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;
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");

View file

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