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: fix https://github.com/siyuan-note/siyuan/issues/9462
Vanessa787476064291
diff --git a/app/src/protyle/header/Background.ts b/app/src/protyle/header/Background.tsindex cf9f0cefb9..2a997d538b 100644--- a/app/src/protyle/header/Background.ts+++ b/app/src/protyle/header/Background.ts@@ -359,17 +359,7 @@ export class Background {break;} else if (type === "remove-tag") {target.parentElement.remove();- const tags = this.getTags();- fetchPost("/api/attr/setBlockAttrs", {- id: protyle.block.rootID,- attrs: {"tags": tags.toString()}- });- if (tags.length === 0) {- delete this.ial.tags;- } else {- this.ial.tags = tags.toString();- }- this.render(this.ial, protyle.block.rootID);+ this.removeTag(protyle);event.preventDefault();event.stopPropagation();break;@@ -379,6 +369,20 @@ export class Background {});}+ private removeTag(protyle: IProtyle) {+ const tags = this.getTags();+ fetchPost("/api/attr/setBlockAttrs", {+ id: protyle.block.rootID,+ attrs: {"tags": tags.toString()}+ });+ if (tags.length === 0) {+ delete this.ial.tags;+ } else {+ this.ial.tags = tags.toString();+ }+ this.render(this.ial, protyle.block.rootID);+ }+public render(ial: IObject, rootId: string) {const img = ial["title-img"];const icon = ial.icon;@@ -502,18 +506,22 @@ export class Background {});}- private getTags() {+ private getTags(removeTag?: string) {const tags: string[] = [];this.tagsElement.querySelectorAll(".b3-chip").forEach(item => {- tags.push(item.textContent.trim());+ const tagText = item.textContent.trim();+ if (removeTag && tagText === removeTag) {+ item.remove();+ }+ tags.push(tagText);});return tags;}private addTags(tag: string, protyle: IProtyle) {- window.siyuan.menus.menu.remove();- const tags = this.getTags();+ const tags = this.getTags(tag);if (tags.includes(tag)) {+ this.removeTag(protyle);return;}tags.push(tag);