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/18263
Vanessa4046bcc70124
diff --git a/app/src/layout/dock/agent/AgentComposer.ts b/app/src/layout/dock/agent/AgentComposer.tsindex 2d9cb9a906..d3d7d57269 100644--- a/app/src/layout/dock/agent/AgentComposer.ts+++ b/app/src/layout/dock/agent/AgentComposer.ts@@ -168,12 +168,14 @@ export function mountComposer(host: HTMLElement, onSend: () => void, onChange?:};updatePlaceholder();- wysiwyg.element.addEventListener("input", () => {+ // Protyle 的粘贴、块删除和程序化插入会直接修改 DOM,不一定派发 input,需以实际 DOM 变化为准刷新状态。+ const contentObserver = new MutationObserver(() => {updatePlaceholder();if (onChange) {onChange();}});+ contentObserver.observe(wysiwyg.element, {childList: true, characterData: true, subtree: true});// capture 阶段拦截 hint 选择、Enter 发送、历史翻页;undo/redo 交给 protyle 的 keydown(调 LocalUndo)。wysiwyg.element.addEventListener("keydown", (event: KeyboardEvent) => {@@ -234,7 +236,10 @@ export function mountComposer(host: HTMLElement, onSend: () => void, onChange?:return {focus: () => protyle.focus(),- destroy: () => protyle.destroy(),+ destroy: () => {+ contentObserver.disconnect();+ protyle.destroy();+ },getSendData: () => {const references: { id: string; title: string }[] = [];wysiwyg.element.querySelectorAll('[data-type~="block-ref"]').forEach((ref) => {