An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:rotating_light:
Vanessa42ea06ce0753
diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.tsindex b02d5189b2..c136c1d72c 100644--- a/app/src/dialog/processSystem.ts+++ b/app/src/dialog/processSystem.ts@@ -157,8 +157,8 @@ export const setRefDynamicText = (data: {item.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${data.blockID}"] span[data-type="block-ref"][data-subtype="d"][data-id="${data.defBlockID}"]`).forEach(item => {item.innerHTML = data.refText;});- })-}+ });+};export const setDefRefCount = (data: {"blockID": string,@@ -169,59 +169,59 @@ export const setDefRefCount = (data: {}) => {getAllEditor().forEach(item => {if (data.rootID === data.blockID && item.protyle.block.rootID === data.rootID) {- const attrElement = item.protyle.title.element.querySelector(".protyle-attr")- const countElement = attrElement.querySelector('.popover__block')+ const attrElement = item.protyle.title.element.querySelector(".protyle-attr");+ const countElement = attrElement.querySelector(".popover__block");if (countElement) {if (data.refCount === 0) {- countElement.remove()+ countElement.remove();} else {countElement.textContent = data.refCount.toString();- countElement.setAttribute("data-id", data.refIDs.toString())+ countElement.setAttribute("data-id", data.refIDs.toString());}} else if (data.refCount > 0) {- attrElement.insertAdjacentHTML("beforeend", `<div class="protyle-attr--refcount popover__block" data-defids="["${data.blockID}"]" data-id="${data.refIDs.toString()}" style="">${data.refCount}</div>`)+ attrElement.insertAdjacentHTML("beforeend", `<div class="protyle-attr--refcount popover__block" data-defids="["${data.blockID}"]" data-id="${data.refIDs.toString()}" style="">${data.refCount}</div>`);}return;}// 不能对比 rootId,否则潜入块中的锚文本无法更新item.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${data.blockID}"]`).forEach(item => {- const countElement = item.querySelector('.protyle-attr--refcount')+ const countElement = item.querySelector(".protyle-attr--refcount");if (countElement) {if (data.refCount === 0) {- countElement.remove()+ countElement.remove();} else {countElement.textContent = data.refCount.toString();}} else if (data.refCount > 0) {- const attrElement = item.querySelector('.protyle-attr')+ const attrElement = item.querySelector(".protyle-attr");if (attrElement.childElementCount > 0) {- attrElement.lastElementChild.insertAdjacentHTML("afterend", `<div class="protyle-attr--refcount popover__block">${data.refCount}</div>`)+ attrElement.lastElementChild.insertAdjacentHTML("afterend", `<div class="protyle-attr--refcount popover__block">${data.refCount}</div>`);} else {- attrElement.innerHTML = `<div class="protyle-attr--refcount popover__block">${data.refCount}</div>${Constants.ZWSP}`+ attrElement.innerHTML = `<div class="protyle-attr--refcount popover__block">${data.refCount}</div>${Constants.ZWSP}`;}}});- })+ });let liElement;/// #if MOBILE- liElement = window.siyuan.mobile.files.element.querySelector(`li[data-node-id="${data.rootID}"]`)+ liElement = window.siyuan.mobile.files.element.querySelector(`li[data-node-id="${data.rootID}"]`);/// #else- liElement = (getDockByType("file").data.file as Files).element.querySelector(`li[data-node-id="${data.rootID}"]`)+ liElement = (getDockByType("file").data.file as Files).element.querySelector(`li[data-node-id="${data.rootID}"]`);/// #endifif (liElement) {- const counterElement = liElement.querySelector(".counter")+ const counterElement = liElement.querySelector(".counter");if (counterElement) {if (data.rootRefCount === 0) {- counterElement.remove()+ counterElement.remove();} else {- counterElement.textContent = data.rootRefCount.toString()+ counterElement.textContent = data.rootRefCount.toString();}} else if (data.rootRefCount > 0) {- liElement.insertAdjacentHTML("beforeend", `<span class="popover__block counter b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.ref}">${data.rootRefCount}</span>`)+ liElement.insertAdjacentHTML("beforeend", `<span class="popover__block counter b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.ref}">${data.rootRefCount}</span>`);}}-}+};export const lockScreen = (app: App) => {if (window.siyuan.config.readonly) {diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex 7c55d8b5b4..09af9c4bf4 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -1050,23 +1050,6 @@ export const turnsOneInto = async (options: {avRender(options.protyle.wysiwyg.element, options.protyle);};-const updateRef = (protyle: IProtyle, id: string, index = 0) => {- if (index > 6) {- return;- }- protyle.wysiwyg.element.querySelectorAll(`[data-type~="block-ref"][data-id="${id}"]`).forEach(item => {- if (item.getAttribute("data-subtype") === "d") {- fetchPost("/api/block/getRefText", {id: id}, (response) => {- item.innerHTML = response.data;- const blockElement = hasClosestBlock(item);- if (blockElement) {- updateRef(protyle, blockElement.getAttribute("data-node-id"), index + 1);- }- });- }- });-};-let transactionsTimeout: number;export const transaction = (protyle: IProtyle, doOperations: IOperation[], undoOperations?: IOperation[]) => {if (doOperations.length === 0) {