An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/17099
Vanessad3e876368cdc
diff --git a/app/src/boot/globalEvent/event.ts b/app/src/boot/globalEvent/event.tsindex 29ed536e9f..738e357d15 100644--- a/app/src/boot/globalEvent/event.ts+++ b/app/src/boot/globalEvent/event.ts@@ -21,6 +21,7 @@ import {openFileById} from "../../editor/util";import {checkFold} from "../../util/noRelyPCFunction";import {hideAllElements} from "../../protyle/ui/hideElements";import {dragOverScroll, stopScrollAnimation} from "./dragover";+import {setWebViewFocusable} from "../../mobile/util/mobileAppUtil";export const initWindowEvent = (app: App) => {document.body.addEventListener("mouseleave", () => {@@ -125,6 +126,9 @@ export const initWindowEvent = (app: App) => {window.siyuan.ctrlIsPressed = false;window.siyuan.shiftIsPressed = false;window.siyuan.altIsPressed = false;+ /// #if BROWSER+ setWebViewFocusable();+ /// #endif});window.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => {diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.tsindex bbd825644a..ea6a5520ad 100644--- a/app/src/mobile/index.ts+++ b/app/src/mobile/index.ts@@ -37,7 +37,7 @@ import {correctHotkey} from "../boot/globalEvent/commonHotkey";import {processIOSPurchaseResponse} from "../util/iOSPurchase";import {updateControlAlt} from "../protyle/util/hotKey";import {nbsp2space} from "../protyle/util/normalizeText";-import {callMobileAppShowKeyboard, canInput} from "./util/mobileAppUtil";+import {callMobileAppShowKeyboard, canInput, setWebViewFocusable} from "./util/mobileAppUtil";class App {public plugins: import("../plugin").Plugin[] = [];@@ -180,6 +180,9 @@ class App {window.siyuan.shiftIsPressed = false;window.siyuan.altIsPressed = false;});+ window.addEventListener("blur", (event) => {+ setWebViewFocusable();+ });// 移动端删除键 https://github.com/siyuan-note/siyuan/issues/9259window.addEventListener("keydown", (event) => {mobileKeydown(siyuanApp, event);diff --git a/app/src/mobile/util/mobileAppUtil.ts b/app/src/mobile/util/mobileAppUtil.tsindex 192f19ec2b..a998c7bbed 100644--- a/app/src/mobile/util/mobileAppUtil.ts+++ b/app/src/mobile/util/mobileAppUtil.ts@@ -30,4 +30,14 @@ export const canInput = (element: Element) => {return hasClosestByAttribute(element, "contenteditable", "true");}return false;-};\ No newline at end of file+};++export const setWebViewFocusable = () => {+ if (document.activeElement.tagName === "IFRAME") {+ if (window.JSAndroid && window.JSAndroid.setWebViewFocusable) {+ window.JSAndroid.setWebViewFocusable(true);+ } else if (window.JSHarmony && window.JSHarmony.setWebViewFocusable) {+ window.JSHarmony.setWebViewFocusable(true);+ }+ }+};diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex 291d1d552a..f682403f9f 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -254,6 +254,7 @@ interface Window {print(title: string, html: string): voidgetScreenWidthPx(): numberexit(): void+ setWebViewFocusable(enable: boolean): void};JSHarmony: {showKeyboard(): void@@ -271,6 +272,7 @@ interface Window {print(title: string, html: string): voidgetScreenWidthPx(): numberexit(): void+ setWebViewFocusable(enable: boolean): void};Protyle: import("../protyle/method").default;