Skip to content

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

:bug: Dismiss text selection toolbar after hiding mobile keyboard

Daniel1ac27857a55c
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index eb47cc9b79..4190d5ba09 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -20,7 +20,7 @@ import {initAssets} from "../util/assets";
import {bootSync, lockScreen} from "../dialog/processSystem";
import {initMessage, showMessage} from "../dialog/message";
import {goBack} from "./util/MobileBackFoward";
-import {activeBlur, hideKeyboardToolbar, showKeyboardToolbar} from "./util/keyboardToolbar";
+import {activeBlur, hideKeyboardToolbarByApp, showKeyboardToolbar} from "./util/keyboardToolbar";
import {
getLocalStorage,
initWindowOpenOverride,
@@ -279,7 +279,7 @@ window.goBack = goBack;
window.showMessage = showMessage;
window.processIOSPurchaseResponse = processIOSPurchaseResponse;
window.showKeyboardToolbar = showKeyboardToolbar;
-window.hideKeyboardToolbar = hideKeyboardToolbar;
+window.hideKeyboardToolbar = hideKeyboardToolbarByApp;
window.openFileByURL = (openURL) => {
const blockInfo = parseSiYuanUriInfo(openURL);
if (blockInfo != null) {
diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.ts
index 921b8efc47..580a0ac93c 100644
--- a/app/src/mobile/util/keyboardToolbar.ts
+++ b/app/src/mobile/util/keyboardToolbar.ts
@@ -706,6 +706,12 @@ export const hideKeyboardToolbar = () => {
}
};
+export const hideKeyboardToolbarByApp = () => {
+ hideKeyboardToolbar();
+ (document.activeElement as HTMLElement)?.blur();
+ getSelection()?.removeAllRanges();
+};
+
export const activeBlur = () => {
const now = Date.now();
if (now < keyboardLockUntil) {