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/15989 28&29
Vanessad758a0d2186f
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex da75a4ab7c..c49f1493a1 100644--- a/app/src/menus/protyle.ts+++ b/app/src/menus/protyle.ts@@ -2,7 +2,7 @@ import {hasClosestBlock,hasClosestByAttribute,hasClosestByClassName, hasClosestByTag,- hasTopClosestByClassName+ hasTopClosestByClassName, isInEmbedBlock} from "../protyle/util/hasClosest";import {MenuItem} from "./Menu";import {focusBlock, focusByRange, focusByWbr, getEditorRange, selectAll,} from "../protyle/util/selection";@@ -2433,6 +2433,22 @@ export const tableMenu = (protyle: IProtyle, nodeElement: Element, cellElement:return {menus, removeMenus, insertMenus, otherMenus, other2Menus};};+export const setFoldById = (data: {+ id: string,+ currentNodeID: string,+}, protyle: IProtyle) => {+ Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${data.id}"]`)).find((item: Element) => {+ if (!isInEmbedBlock(item)) {+ const operations = setFold(protyle, item, true, false, true, true);+ operations.doOperations[0].context = {+ focusId: data.currentNodeID,+ };+ transaction(protyle, operations.doOperations, operations.undoOperations);+ return true;+ }+ });+};+export const setFold = (protyle: IProtyle, nodeElement: Element, isOpen?: boolean,isRemove?: boolean, addLoading = true, getOperations = false) => {if (nodeElement.getAttribute("data-type") === "NodeListItem" && nodeElement.childElementCount < 4) {diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.tsindex 06de392dde..86989d8110 100644--- a/app/src/protyle/index.ts+++ b/app/src/protyle/index.ts@@ -47,7 +47,7 @@ import {getAllModels} from "../layout/getAll";/// #endifimport {isSupportCSSHL} from "./render/searchMarkRender";import {renderAVAttribute} from "./render/av/blockAttr";-import {zoomOut} from "../menus/protyle";+import {setFoldById, zoomOut} from "../menus/protyle";export class Protyle {@@ -157,6 +157,9 @@ export class Protyle {addLoading(this.protyle, data.msg);}break;+ case "unfoldHeading":+ setFoldById(data.data, this.protyle);+ break;case "transactions":this.onTransaction(data);break;