From e014a75fdd2bc3859d1eec4f1fde5585369dc277 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 3 Feb 2026 21:06:46 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/16548 --- app/src/mobile/util/touch.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.ts index a41375277..e4ff2c93e 100644 --- a/app/src/mobile/util/touch.ts +++ b/app/src/mobile/util/touch.ts @@ -30,17 +30,21 @@ export const handleTouchEnd = (event: TouchEvent, app: App) => { const target = event.target as HTMLElement; const wysisygElement = hasClosestByClassName(target, "protyle-wysiwyg", true); if (!yDiff || Math.abs(yDiff) < 10) { - if ((["INPUT", "TEXTAREA"].includes(target.tagName) && target.getAttribute("readonly") !== "true") || - (wysisygElement && wysisygElement.getAttribute("data-readonly") === "false")) { - if (target.tagName === "INPUT" || target.tagName === "TEXTAREA") { - target.setAttribute("virtualkeyboardpolicy", "manual"); + let editElement; + if (["INPUT", "TEXTAREA"].includes(target.tagName) && target.getAttribute("readonly") !== "true") { + editElement = target; + } else if (wysisygElement && wysisygElement.getAttribute("data-readonly") === "false") { + editElement = hasClosestByAttribute(target, "contenteditable", "true") as HTMLElement; + } + if (editElement) { + if (editElement.getAttribute("virtualkeyboardpolicy") !== "manual") { + editElement.setAttribute("virtualkeyboardpolicy", "manual"); + setTimeout(() => { + window.JSAndroid?.showKeyboard(); + }, 100); } else { - const editElement = hasClosestByAttribute(target, "contenteditable", "true"); - if (editElement) { - editElement.setAttribute("virtualkeyboardpolicy", "manual"); - } + window.JSAndroid?.showKeyboard(); } - window.JSAndroid?.showKeyboard(); } else { window.JSAndroid?.hideKeyboard(); }