An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: https://github.com/siyuan-note/siyuan/issues/9126
Vanessa90f1798dffc3
diff --git a/app/src/boot/globalEvent/event.ts b/app/src/boot/globalEvent/event.tsindex 963fddca18..dc98d4aaa9 100644--- a/app/src/boot/globalEvent/event.ts+++ b/app/src/boot/globalEvent/event.ts@@ -47,14 +47,12 @@ export const initWindowEvent = (app: App) => {}});- let switchDialog: Dialog;-window.addEventListener("keyup", (event) => {- windowKeyUp(app, event, switchDialog);+ windowKeyUp(app, event);});window.addEventListener("keydown", (event) => {- windowKeyDown(app, event, switchDialog);+ windowKeyDown(app, event);});window.addEventListener("blur", () => {diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.tsindex 05a630f6ef..ba5e096aff 100644--- a/app/src/boot/globalEvent/keydown.ts+++ b/app/src/boot/globalEvent/keydown.ts@@ -57,7 +57,7 @@ import {commandPanel} from "../../plugin/commandPanel";import {toggleDockBar} from "../../layout/dock/util";import {workspaceMenu} from "../../menus/workspace";-const switchDialogEvent = (app: App, event: MouseEvent, switchDialog: Dialog) => {+const switchDialogEvent = (app: App, event: MouseEvent) => {event.preventDefault();let target = event.target as HTMLElement;while (!target.isSameNode(switchDialog.element)) {@@ -815,8 +815,8 @@ const panelTreeKeydown = (app: App, event: KeyboardEvent) => {return false;};-export const windowKeyDown = (app: App, event: KeyboardEvent, switchDialog: Dialog) => {-+let switchDialog: Dialog+export const windowKeyDown = (app: App, event: KeyboardEvent) => {if (document.querySelector(".av__mask") || document.getElementById("errorLog") || event.isComposing) {return;}@@ -942,15 +942,16 @@ export const windowKeyDown = (app: App, event: KeyboardEvent, switchDialog: Dial<div class="switch-doc__path"></div></div>`,});+ switchDialog.element.setAttribute("data-key", "⌃⇥");// 需移走光标,否则编辑器会继续监听并执行按键操作switchDialog.element.querySelector("input").focus();if (isMac()) {switchDialog.element.addEventListener("contextmenu", (event) => {- switchDialogEvent(app, event, switchDialog);+ switchDialogEvent(app, event);});}switchDialog.element.addEventListener("click", (event) => {- switchDialogEvent(app, event, switchDialog);+ switchDialogEvent(app, event);});return;}diff --git a/app/src/boot/globalEvent/keyup.ts b/app/src/boot/globalEvent/keyup.tsindex 5eb5a021a1..ad51fe4485 100644--- a/app/src/boot/globalEvent/keyup.ts+++ b/app/src/boot/globalEvent/keyup.ts@@ -1,4 +1,3 @@-import {Dialog} from "../../dialog";import {fetchPost} from "../../util/fetch";import {escapeHtml} from "../../util/escape";import {openCard} from "../../card/openCard";@@ -6,10 +5,15 @@ import {getDockByType} from "../../layout/util";import {getAllTabs} from "../../layout/getAll";import {App} from "../../index";-export const windowKeyUp = (app: App,event:KeyboardEvent, switchDialog:Dialog) => {+export const windowKeyUp = (app: App,event:KeyboardEvent) => {window.siyuan.ctrlIsPressed = false;window.siyuan.shiftIsPressed = false;window.siyuan.altIsPressed = false;+ const switchDialog = window.siyuan.dialogs.find(item => {+ if (item.element.getAttribute("data-key") === "⌃⇥") {+ return true;+ }+ });if (switchDialog && switchDialog.element.parentElement) {if (event.key === "Tab") {let currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus");@@ -112,7 +116,6 @@ export const windowKeyUp = (app: App,event:KeyboardEvent, switchDialog:Dialog)});}switchDialog.destroy();- switchDialog = undefined;}}};diff --git a/app/src/boot/globalEvent/mousemove.ts b/app/src/boot/globalEvent/mousemove.tsindex 0630129dc5..16919577e7 100644--- a/app/src/boot/globalEvent/mousemove.ts+++ b/app/src/boot/globalEvent/mousemove.ts@@ -14,7 +14,7 @@ const getRightBlock = (element: HTMLElement, x: number, y: number) => {return nodeElement;};-export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }, mouseIsEnter:boolean) => {+export const windowMouseMove = (event: MouseEvent & { target: HTMLElement }, mouseIsEnter: boolean) => {if (document.body.classList.contains("body--blur")) {// 非激活状态下不执行 https://ld246.com/article/1693474547631return;