From 65ab0c11238a3bcf1d512dbfe4715d0215e798df Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 3 Feb 2026 11:42:35 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/16548 --- app/src/mobile/util/touch.ts | 14 +++++++++++--- app/src/types/index.d.ts | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.ts index 919181bc3..b68fb1908 100644 --- a/app/src/mobile/util/touch.ts +++ b/app/src/mobile/util/touch.ts @@ -27,13 +27,22 @@ const popSide = (render = true) => { }; export const handleTouchEnd = (event: TouchEvent, app: App) => { + const target = event.target as HTMLElement; + console.log(event.target); + const wysisygElement = hasClosestByClassName(target, "protyle-wysiwyg", true); + if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || + (wysisygElement && wysisygElement.getAttribute("data-readonly") === "false")) { + window.JSAndroid.showKeyboard(); + } else { + window.JSAndroid.hideKeyboard(); + } + if (isIPhone() && globalTouchEnd(event, yDiff, time, app)) { event.stopImmediatePropagation(); event.preventDefault(); return; } isFirstMove = true; - const target = event.target as HTMLElement; if (!clientY || typeof yDiff === "undefined" || target.tagName === "AUDIO" || hasClosestByClassName(target, "b3-dialog", true) || @@ -67,8 +76,7 @@ export const handleTouchEnd = (event: TouchEvent, app: App) => { const isXScroll = Math.abs(xDiff) > Math.abs(yDiff); const modelElement = hasClosestByAttribute(target, "id", "model", true); if (modelElement) { - if (isXScroll && firstDirection === "toRight" && !lastClientX && - !hasClosestByClassName(target, "protyle-wysiwyg", true)) { + if (isXScroll && firstDirection === "toRight" && !lastClientX && !wysisygElement) { closeModel(); } return; diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index f7f9045f0..3ea673675 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -235,7 +235,6 @@ interface Window { toCanvas: (element: Element) => Promise toBlob: (element: Element) => Promise }; - siyuan: ISiyuan; JSAndroid: { returnDesktop(): void @@ -249,6 +248,7 @@ interface Window { readHTMLClipboard(): string getBlockURL(): string hideKeyboard(): void + showKeyboard(): void print(title: string, html: string): void getScreenWidthPx(): number exit(): void