Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/16592

Vanessa9f55cd125de4
diff --git a/app/src/config/search.ts b/app/src/config/search.ts
index a4fab9d427..d15b47d106 100644
--- a/app/src/config/search.ts
+++ b/app/src/config/search.ts
@@ -2,6 +2,7 @@ import {Constants} from "../constants";
import {genItemPanel} from "./index";
import {keymap} from "./keymap";
import {App} from "../index";
+import {isPhablet} from "../protyle/util/compatibility";
const getLang = (keys: string[]) => {
const langArray: string[] = [];
@@ -106,9 +107,11 @@ export const initConfigSearch = (element: HTMLElement, app: App) => {
"vacuumDataIndex", "vacuumDataIndexTip", "rebuildDataIndex", "rebuildDataIndexTip"]),
];
const inputElement = element.querySelector(".b3-form__icon input") as HTMLInputElement;
- /// #if !BROWSER
- inputElement.focus();
- /// #endif
+ if (!isPhablet()) {
+ inputElement.focus();
+ } else {
+ (document.activeElement as HTMLElement)?.blur();
+ }
const updateTab = () => {
const indexList: number[] = [];
const inputValue = inputElement.value;
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts
index c790f992a9..85bc579290 100644
--- a/app/src/protyle/util/compatibility.ts
+++ b/app/src/protyle/util/compatibility.ts
@@ -8,6 +8,10 @@ import {clipboard, ipcRenderer} from "electron";
import {processSYLink} from "../../editor/openLink";
/// #endif
+export const isPhablet = () => {
+ return /Android|webOS|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|Tablet/i.test(navigator.userAgent) || isIPhone() || isIPad();
+};
+
export const encodeBase64 = (text: string): string => {
if (typeof Buffer !== "undefined") {
return Buffer.from(text, "utf8").toString("base64");