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/16001
Vanessa85efea75bcc5
diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.tsindex 0557420159..22de00f9af 100644--- a/app/src/menus/commonMenuItem.ts+++ b/app/src/menus/commonMenuItem.ts@@ -24,6 +24,8 @@ import {openAssetNewWindow} from "../window/openNewWindow";import {escapeHtml} from "../util/escape";import {copyTextByType} from "../protyle/toolbar/util";import {hideElements} from "../protyle/ui/hideElements";+import {Protyle} from "../protyle";+import {getAllEditor} from "../layout/getAll";const bindAttrInput = (inputElement: HTMLInputElement, id: string) => {inputElement.addEventListener("change", () => {@@ -160,6 +162,20 @@ export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: Ilet notifyHTML = "";let hasAV = false;const range = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : null;+ let ghostProtyle: Protyle;+ if (!protyle) {+ getAllEditor().find(item => {+ if (attrs.id === item.protyle.block.rootID) {+ protyle = item.protyle;+ return true;+ }+ });+ if (!protyle) {+ ghostProtyle = new Protyle(window.siyuan.ws.app, document.createElement('div'), {+ blockId: attrs.id,+ });+ }+ }Object.keys(attrs).forEach(item => {if (Constants.CUSTOM_RIFF_DECKS === item || item.startsWith("custom-sy-")) {return;@@ -247,6 +263,8 @@ export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: IfocusByRange(range);if (protyle) {hideElements(["select"], protyle);+ } else {+ ghostProtyle.destroy();}}});@@ -266,8 +284,8 @@ export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: Itarget.classList.add("item--focus");dialog.element.querySelectorAll(".custom-attr").forEach((item: HTMLElement) => {if (item.dataset.type === target.dataset.type) {- if (item.dataset.type === "NodeAttributeView" && item.innerHTML === "" && protyle) {- renderAVAttribute(item, attrs.id, protyle);+ if (item.dataset.type === "NodeAttributeView" && item.innerHTML === "") {+ renderAVAttribute(item, attrs.id, protyle || ghostProtyle.protyle);}item.classList.remove("fn__none");} else {@@ -370,7 +388,7 @@ export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: I}};-export const openAttr = (nodeElement: Element, focusName = "bookmark", protyle?: IProtyle) => {+export const openAttr = (nodeElement: Element, focusName = "bookmark", protyle: IProtyle) => {if (nodeElement.getAttribute("data-type") === "NodeThematicBreak") {return;}@@ -448,7 +466,7 @@ export const copySubMenu = (ids: string[], accelerator = true, focusElement?: El}}}];-+if (stdMarkdownId) {menuItems.push({id: "copyMarkdown",@@ -472,7 +490,7 @@ export const copySubMenu = (ids: string[], accelerator = true, focusElement?: El}});}-+return menuItems;};