From a53079d2b5a309991c237ca8952025151ac2e607 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 18 Apr 2024 10:44:46 +0800 Subject: [PATCH] :art: fix https://github.com/siyuan-note/siyuan/issues/11077 --- app/src/mobile/editor.ts | 4 ++++ app/src/mobile/menu/model.ts | 1 + app/src/mobile/util/touch.ts | 10 +++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.ts index 73c12d580..468756db6 100644 --- a/app/src/mobile/editor.ts +++ b/app/src/mobile/editor.ts @@ -22,6 +22,10 @@ export const getCurrentEditor = () => { export const openMobileFileById = (app: App, id: string, action = [Constants.CB_GET_HL]) => { window.siyuan.storage[Constants.LOCAL_DOCINFO] = {id}; setStorageVal(Constants.LOCAL_DOCINFO, window.siyuan.storage[Constants.LOCAL_DOCINFO]); + const avPanelElement = document.querySelector(".av__panel"); + if (avPanelElement && !avPanelElement.classList.contains("fn__none")) { + avPanelElement.dispatchEvent(new CustomEvent("click", {detail: "close"})); + } if (window.siyuan.mobile.editor) { saveScroll(window.siyuan.mobile.editor.protyle); hideElements(["toolbar", "hint", "util"], window.siyuan.mobile.editor.protyle); diff --git a/app/src/mobile/menu/model.ts b/app/src/mobile/menu/model.ts index 3870ed0c1..16b0f844a 100644 --- a/app/src/mobile/menu/model.ts +++ b/app/src/mobile/menu/model.ts @@ -6,6 +6,7 @@ export const openModel = (obj: { }) => { const modelElement = document.getElementById("model"); modelElement.style.transform = "translateY(0px)"; + modelElement.style.zIndex = (++window.siyuan.zIndex).toString(); modelElement.querySelector(".toolbar__icon use").setAttribute("xlink:href", "#" + obj.icon); modelElement.querySelector(".toolbar__text").innerHTML = obj.title; const modelMainElement = modelElement.querySelector("#modelMain") as HTMLElement; diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.ts index fe1bdbfe4..8b0332cfa 100644 --- a/app/src/mobile/util/touch.ts +++ b/app/src/mobile/util/touch.ts @@ -15,6 +15,7 @@ let firstDirection: "toLeft" | "toRight"; let firstXY: "x" | "y"; let lastClientX: number; // 和起始方向不一致时,记录最后一次的 clientX let scrollBlock: boolean; +let isFirstMove = true; const popSide = (render = true) => { if (render) { @@ -32,6 +33,7 @@ export const handleTouchEnd = (event: TouchEvent, app: App) => { event.preventDefault(); return; } + isFirstMove = true; const target = event.target as HTMLElement; if (!clientY || typeof yDiff === "undefined" || target.tagName === "AUDIO" || @@ -153,6 +155,7 @@ export const handleTouchStart = (event: TouchEvent) => { time = 0; event.stopImmediatePropagation(); } + isFirstMove = true; scrollBlock = false; }; @@ -251,7 +254,12 @@ export const handleTouchMove = (event: TouchEvent) => { return; } } - + if (isFirstMove) { + sideMaskElement.style.zIndex = (++window.siyuan.zIndex).toString(); + document.getElementById("sidebar").style.zIndex = (++window.siyuan.zIndex).toString(); + document.getElementById("menu").style.zIndex = (++window.siyuan.zIndex).toString(); + isFirstMove = false; + } const windowWidth = window.innerWidth; const menuElement = hasClosestByAttribute(target, "id", "menu"); if (menuElement) {