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: fix https://github.com/siyuan-note/siyuan/issues/5771
Vanessa0c662dc3177c
diff --git a/app/src/emoji/index.ts b/app/src/emoji/index.tsindex 4bcba17660..c1a4d9c2b9 100644--- a/app/src/emoji/index.ts+++ b/app/src/emoji/index.ts@@ -422,13 +422,13 @@ const updateFileEmoji = (unicode: string, id: string) => {/// #if MOBILEif (window.siyuan.mobileEditor.protyle.block.rootID === id) {window.siyuan.mobileEditor.protyle.background.ial.icon = unicode;- window.siyuan.mobileEditor.protyle.background.render(window.siyuan.mobileEditor.protyle.background.ial, id);+ window.siyuan.mobileEditor.protyle.background.render(window.siyuan.mobileEditor.protyle.background.ial);}/// #elsegetAllModels().editor.find(item => {if (item.editor.protyle.block.rootID === id) {item.editor.protyle.background.ial.icon = unicode;- item.editor.protyle.background.render(item.editor.protyle.background.ial, id);+ item.editor.protyle.background.render(item.editor.protyle.background.ial);item.parent.setDocIcon(unicode);return true;}diff --git a/app/src/mobile/util/MobileBackFoward.ts b/app/src/mobile/util/MobileBackFoward.tsindex 3b18947c64..b0716b5217 100644--- a/app/src/mobile/util/MobileBackFoward.ts+++ b/app/src/mobile/util/MobileBackFoward.ts@@ -36,7 +36,7 @@ const focusStack = (backStack: IBackStack) => {id: backStack.id,}, (response) => {(document.getElementById("toolbarName") as HTMLInputElement).value = response.data.name === "Untitled" ? "" : response.data.name;- protyle.background.render(response.data.ial, protyle.block.rootID);+ protyle.background.render(response.data.ial);protyle.wysiwyg.renderCustom(response.data.ial);});}@@ -56,7 +56,15 @@ const focusStack = (backStack: IBackStack) => {startID: startEndId[0],endID: startEndId[1],}, getResponse => {+ protyle.block.parentID = getResponse.data.parentID;+ protyle.block.parent2ID = getResponse.data.parent2ID;+ protyle.block.rootID = getResponse.data.rootID;protyle.block.showAll = false;+ protyle.block.mode = getResponse.data.mode;+ protyle.block.blockCount = getResponse.data.blockCount;+ protyle.block.id = getResponse.data.id;+ protyle.block.action = backStack.callback;+ protyle.wysiwyg.element.setAttribute("data-doc-type", getResponse.data.type);protyle.wysiwyg.element.innerHTML = getResponse.data.content;processRender(protyle.wysiwyg.element);highlightRender(protyle.wysiwyg.element);diff --git a/app/src/protyle/header/Background.ts b/app/src/protyle/header/Background.tsindex e3d94b081f..09840ccc9a 100644--- a/app/src/protyle/header/Background.ts+++ b/app/src/protyle/header/Background.ts@@ -82,7 +82,7 @@ export class Background {const response = JSON.parse(responseText);const style = `background-image:url("${response.data.succMap[Object.keys(response.data.succMap)[0]]}")`;this.ial["title-img"] = style;- this.render(this.ial, protyle.block.rootID);+ this.render(this.ial);fetchPost("/api/attr/setBlockAttrs", {id: protyle.block.rootID,attrs: {"title-img": style}@@ -118,7 +118,7 @@ export class Background {attrs: {"title-img": style}});} else {- this.render(this.ial, protyle.block.rootID);+ this.render(this.ial);}event.preventDefault();event.stopPropagation();@@ -207,7 +207,7 @@ export class Background {];const style = bgs[getRandom(0, bgs.length - 1)];this.ial["title-img"] = style;- this.render(this.ial, protyle.block.rootID);+ this.render(this.ial);fetchPost("/api/attr/setBlockAttrs", {id: protyle.block.rootID,attrs: {"title-img": this.ial["title-img"]}@@ -217,7 +217,7 @@ export class Background {break;} else if (type === "remove") {delete this.ial["title-img"];- this.render(this.ial, protyle.block.rootID);+ this.render(this.ial);fetchPost("/api/attr/setBlockAttrs", {id: protyle.block.rootID,attrs: {"title-img": ""}@@ -229,7 +229,7 @@ export class Background {const emoji = getRandomEmoji();if (emoji) {this.ial.icon = emoji;- this.render(this.ial, protyle.block.rootID);+ this.render(this.ial);updateFileTreeEmoji(emoji, protyle.block.rootID);updateOutlineEmoji(emoji);fetchPost("/api/attr/setBlockAttrs", {@@ -244,7 +244,7 @@ export class Background {event.stopPropagation();break;} else if (type === "tag") {- this.openTag();+ this.openTag(protyle);event.preventDefault();event.stopPropagation();break;@@ -267,7 +267,7 @@ export class Background {btnsElement[1].addEventListener("click", () => {const style = `background-image:url(${dialog.element.querySelector("input").value});`;this.ial["title-img"] = style;- this.render(this.ial, protyle.block.rootID);+ this.render(this.ial);fetchPost("/api/attr/setBlockAttrs", {id: protyle.block.rootID,attrs: {"title-img": this.ial["title-img"]}@@ -297,7 +297,7 @@ export class Background {} else {this.ial.tags = tags.toString();}- this.render(this.ial, protyle.block.rootID);+ this.render(this.ial);event.preventDefault();event.stopPropagation();break;@@ -307,12 +307,11 @@ export class Background {});}- public render(ial: IObject, id: string) {+ public render(ial: IObject) {const img = ial["title-img"];const icon = ial.icon;const tags = ial.tags;this.ial = ial;- this.element.setAttribute("data-node-id", id);if (tags) {let html = "";tags.split(",").forEach((item, index) => {@@ -360,7 +359,7 @@ export class Background {}}- private openTag() {+ private openTag(protyle:IProtyle) {fetchPost("/api/search/searchTag", {k: "",}, (response) => {@@ -384,9 +383,9 @@ export class Background {if (event.key === "Enter") {const currentElement = listElement.querySelector(".b3-list-item--focus");if (currentElement) {- this.addTags(currentElement.textContent);+ this.addTags(currentElement.textContent, protyle);} else {- this.addTags(inputElement.value);+ this.addTags(inputElement.value, protyle);}window.siyuan.menus.menu.remove();} else if (event.key === "Escape") {@@ -419,7 +418,7 @@ export class Background {if (!listItemElement) {return;}- this.addTags(listItemElement.textContent);+ this.addTags(listItemElement.textContent, protyle);});const rect = this.iconElement.nextElementSibling.getBoundingClientRect();window.siyuan.menus.menu.popup({x: rect.left, y: rect.top + rect.height});@@ -435,19 +434,18 @@ export class Background {return tags;}- private addTags(tag: string) {+ private addTags(tag: string, protyle:IProtyle) {window.siyuan.menus.menu.remove();const tags = this.getTags();if (tags.includes(tag)) {return;}tags.push(tag);- const id = this.element.getAttribute("data-node-id");fetchPost("/api/attr/setBlockAttrs", {- id,+ id:protyle.block.rootID,attrs: {"tags": tags.toString()}});this.ial.tags = tags.toString();- this.render(this.ial, id);+ this.render(this.ial);}}diff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.tsindex 32ae2104ef..a2c92e2d19 100644--- a/app/src/protyle/header/Title.ts+++ b/app/src/protyle/header/Title.ts@@ -332,7 +332,7 @@ ${window.siyuan.languages.createdAt} ${dayjs(response.data.ial.id.substr(0, 14))return false;}setTitle(response.data.ial.title);- protyle.background.render(response.data.ial, protyle.block.rootID);+ protyle.background.render(response.data.ial);protyle.wysiwyg.renderCustom(response.data.ial);this.editElement.setAttribute("data-render", "true");this.setTitle(response.data.ial.title);diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.tsindex 7df5dc7cb0..36fa17493a 100644--- a/app/src/protyle/util/onGet.ts+++ b/app/src/protyle/util/onGet.ts@@ -96,7 +96,7 @@ export const onGet = (data: IWebSocketData, protyle: IProtyle, action: string[]// 页签没有打开protyle.title.render(protyle, response, renderTitle);} else if (protyle.options.render.background) {- protyle.background.render(response.data.ial, protyle.block.rootID);+ protyle.background.render(response.data.ial);protyle.wysiwyg.renderCustom(response.data.ial);}