Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: On-screen keyboard pops up when using desktop mode on HarmonyOS and Android https://github.com/siyuan-note/siyuan/issues/18028

Daniel6e310bec4ae5
diff --git a/app/src/index.ts b/app/src/index.ts
index 50eeb07cc7..f3c4eb987d 100644
--- a/app/src/index.ts
+++ b/app/src/index.ts
@@ -293,6 +293,15 @@ window.showKeyboardToolbar = () => {
// 防止 Pad 端报错
};
window.processIOSPurchaseResponse = processIOSPurchaseResponse;
+// 移动端容器(Android/鸿蒙)启用桌面模式时,原生壳默认禁用 WebView 自身键盘行为、等待 JS 调用
+// showKeyboard 弹键盘,而桌面 bundle 不会调用它,导致键盘无法弹出。这里把键盘控制权交还给
+// WebView 自身管理(与平板走桌面 bundle 时的行为一致)
+// On-screen keyboard pops up when using desktop mode on HarmonyOS and Android https://github.com/siyuan-note/siyuan/issues/18028
+if (window.JSAndroid?.setWebViewFocusable) {
+ window.JSAndroid.setWebViewFocusable(true);
+} else if (window.JSHarmony?.setWebViewFocusable) {
+ window.JSHarmony.setWebViewFocusable(true);
+}
/// #else
ipcRenderer.send(Constants.SIYUAN_READY_TO_SHOW);
/// #endif