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: Reject insertion into hidden editor content https://github.com/siyuan-note/siyuan/issues/20566
Daniel0af0e0a16925
diff --git a/app/src/plugin/insertContent.test.ts b/app/src/plugin/insertContent.test.tsindex ff5bfb9bae..daef9dacbf 100644--- a/app/src/plugin/insertContent.test.ts+++ b/app/src/plugin/insertContent.test.ts@@ -154,6 +154,9 @@ const browserCases = async (sources: Record<string, string>, insertionSource: stolder.element.classList.add("fn__none");check.equal(insertEditorContent({data: "bad", editor: older.editor}, []).status, "no-editor");older.element.classList.remove("fn__none");+ older.root.classList.add("fn__none");+ check.equal(insertEditorContent({data: "bad", editor: older.editor}, []).status, "no-editor");+ older.root.classList.remove("fn__none");check.equal(older.root.innerHTML, unchanged);const stale = fixture("stale");diff --git a/app/src/plugin/insertContent.ts b/app/src/plugin/insertContent.tsindex 66ce3b1d56..895d5dc666 100644--- a/app/src/plugin/insertContent.ts+++ b/app/src/plugin/insertContent.ts@@ -22,9 +22,10 @@ export interface IInsertContentResult {"unsupported-content" | "empty-content";}-const isVisible = (editor: Protyle) => editor?.protyle.element.ownerDocument === document &&- editor.protyle.element.isConnected &&- !editor.protyle.element.closest(".fn__none, [inert]") && editor.protyle.element.getClientRects().length > 0;+const isVisible = (editor: Protyle) => editor?.protyle.wysiwyg.element.ownerDocument === document &&+ editor.protyle.wysiwyg.element.isConnected &&+ !editor.protyle.wysiwyg.element.closest(".fn__none, [inert]") &&+ editor.protyle.wysiwyg.element.getClientRects().length > 0;const getInsertionEditor = (editors: Protyle[], range?: Range) => {const visible = editors.filter(isVisible);