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/17437
Vanessaa47491b9fa68
diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.tsindex 2d66470c36..9d18f61df2 100644--- a/app/src/dialog/processSystem.ts+++ b/app/src/dialog/processSystem.ts@@ -190,7 +190,7 @@ export const setDefRefCount = (data: {// 不能对比 rootId,否则嵌入块中的锚文本无法更新editor.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${data.blockID}"]`).forEach(item => {// 不能直接查询,否则列表中会获取到第一个列表项的 attr https://github.com/siyuan-note/siyuan/issues/12738- const countElement = item.lastElementChild.querySelector(".protyle-attr--refcount");+ const countElement = item.lastElementChild?.querySelector(".protyle-attr--refcount");if (countElement) {if (data.refCount === 0) {countElement.remove();diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex f71da0bcef..1a5f759f35 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -382,9 +382,9 @@ const updateBlock = (updateElements: Element[], protyle: IProtyle, operation: IO// 用于推送和撤销export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo: boolean) => {- if (protyle.wysiwyg.element.firstElementChild?.classList.contains("protyle-password")) {- return;- }+ if (protyle.wysiwyg.element.firstElementChild?.classList.contains("protyle-password")) {+ return;+ }const updateElements: Element[] = [];Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.id}"]`)).forEach(item => {if (!isInEmbedBlock(item)) {@@ -688,11 +688,17 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:if (updateElements.length === 0) {const tempEl = document.createElement("div");tempEl.setAttribute("data-node-id", operation.id);+ tempEl.setAttribute("data-protyle-id", protyle.element.getAttribute("data-id"));updateElements.push(tempEl);fetchPost("/api/block/getBlockDOM", {id: operation.id,}, (response) => {- document.querySelector(`.protyle-wysiwyg [data-node-id="${operation.id}"]`).outerHTML = response.data.dom;+ document.querySelectorAll(`.protyle-wysiwyg [data-node-id="${response.data.id}"]`).forEach(item => {+ if (item.getAttribute("data-protyle-id")) {+ item.outerHTML = response.data.dom;+ item.removeAttribute("data-protyle-id");+ }+ });});}let range;