From efbc2bf81489cad24ed0a066a302e0a44696fe85 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 3 Feb 2026 20:32:03 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/16548 --- app/src/mobile/util/touch.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.ts index 33690a962..3299e6343 100644 --- a/app/src/mobile/util/touch.ts +++ b/app/src/mobile/util/touch.ts @@ -29,10 +29,25 @@ const popSide = (render = true) => { export const handleTouchEnd = (event: TouchEvent, app: App) => { const target = event.target as HTMLElement; const wysisygElement = hasClosestByClassName(target, "protyle-wysiwyg", true); - if (!yDiff) { - if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || + if (!yDiff || Math.abs(yDiff) < 10) { + if ((["INPUT", "TEXTAREA"].includes(target.tagName) && target.getAttribute("readonly") !== "true") || (wysisygElement && wysisygElement.getAttribute("data-readonly") === "false")) { - window.JSAndroid?.showKeyboard(); + if (target.tagName === "INPUT" || target.tagName === "TEXTAREA") { + target.setAttribute("readonly", "false"); + setTimeout(() => { + target.removeAttribute("readonly"); + window.JSAndroid?.showKeyboard(); + }, 0); + } else { + const editElement = hasClosestByAttribute(target, "contenteditable", "true"); + if (editElement) { + editElement.setAttribute("contenteditable", "false"); + setTimeout(() => { + editElement.setAttribute("contenteditable", "true"); + window.JSAndroid?.showKeyboard(); + }, 0); + } + } } else { window.JSAndroid?.hideKeyboard(); }