An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:recycle: https://github.com/siyuan-note/siyuan/issues/17563
Vanessa71fa5341247c
diff --git a/app/src/layout/Tab.ts b/app/src/layout/Tab.tsindex ba37a5675c..f5792816be 100644--- a/app/src/layout/Tab.ts+++ b/app/src/layout/Tab.ts@@ -4,7 +4,7 @@ import {Model} from "./Model";import {Editor} from "../editor";import {hasClosestByTag} from "../protyle/util/hasClosest";import {Constants} from "../constants";-import {escapeGreat, escapeHtml} from "../util/escape";+import {escapeLessThans, escapeHtml} from "../util/escape";import {unicode2Emoji} from "../emoji";import {fetchPost} from "../util/fetch";import {hideTooltip, showTooltip} from "../dialog/tooltip";@@ -73,12 +73,12 @@ export class Tab {id}, (response) => {if (!this.headElement.getAttribute("aria-label")) {- showTooltip(escapeGreat(response.data), this.headElement);+ showTooltip(escapeLessThans(response.data), this.headElement);}- this.headElement.setAttribute("aria-label", escapeGreat(response.data));+ this.headElement.setAttribute("aria-label", escapeLessThans(response.data));});} else {- this.headElement.setAttribute("aria-label", escapeGreat(this.title));+ this.headElement.setAttribute("aria-label", escapeLessThans(this.title));}});this.headElement.addEventListener("dragstart", (event: DragEvent & { target: HTMLElement }) => {diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.tsindex e74265d47c..dc390ac81d 100644--- a/app/src/layout/dock/Files.ts+++ b/app/src/layout/dock/Files.ts@@ -1,4 +1,4 @@-import {escapeAriaLabel, escapeGreat, escapeHtml} from "../../util/escape";+import {escapeAriaLabel, escapeLessThans, escapeHtml} from "../../util/escape";import {Tab} from "../Tab";import {Model} from "../Model";import {setPanelFocus} from "../util";@@ -832,7 +832,7 @@ export class Files extends Model {const liElement = this.element.querySelector(`li[data-node-id="${data.data.rootID}"]`);if (liElement) {liElement.setAttribute("data-count", data.data.subFileCount);- liElement.querySelector(".ariaLabel")?.setAttribute("aria-label", this.genDocAriaLabel(data.data, escapeGreat));+ liElement.querySelector(".ariaLabel")?.setAttribute("aria-label", this.genDocAriaLabel(data.data, escapeLessThans));if (data.data.subFileCount === 0) {liElement.querySelector(".b3-list-item__toggle")?.classList.add("fn__hidden");} else {diff --git a/app/src/mobile/menu/search.ts b/app/src/mobile/menu/search.tsindex 4838327af6..41fccc15dd 100644--- a/app/src/mobile/menu/search.ts+++ b/app/src/mobile/menu/search.ts@@ -8,7 +8,7 @@ import {openModel} from "./model";import {getDisplayName, getNotebookIcon, getNotebookName, movePathTo, pathPosix} from "../../util/pathName";import {getKeyByLiElement, initCriteriaMenu, moreMenu} from "../../search/menu";import {setStorageVal} from "../../protyle/util/compatibility";-import {escapeGreat, escapeHtml} from "../../util/escape";+import {escapeLessThans, escapeHtml} from "../../util/escape";import {unicode2Emoji} from "../../emoji";import {newFileByName} from "../../util/newFile";import {showMessage} from "../../dialog/message";@@ -172,7 +172,7 @@ const onRecentBlocks = (data: IBlock[], config: Config.IUILayoutTabSearchConfig,<svg class="b3-list-item__arrow b3-list-item__arrow--open"><use xlink:href="#iconRight"></use></svg></span>${unicode2Emoji(getNotebookIcon(item.box) || window.siyuan.storage[Constants.LOCAL_IMAGES].note, "b3-list-item__graphic", true)}-<span class="b3-list-item__text" style="color: var(--b3-theme-on-surface)">${escapeGreat(title)}</span>+<span class="b3-list-item__text" style="color: var(--b3-theme-on-surface)">${escapeLessThans(title)}</span></div><div>`;item.children.forEach((childItem) => {if (focusId) {@@ -208,7 +208,7 @@ ${childItem.tag ? `<span class="b3-list-item__meta b3-list-item__meta--ellipsis"</div><div class="fn__flex">${item.tag ? `<span class="b3-list-item__meta b3-list-item__meta--ellipsis">${item.tag.replace(/#/g, "")}</span><span class="fn__space"></span>` : ""}- <span class="b3-list-item__text b3-list-item__meta">${escapeGreat(title)}</span>+ <span class="b3-list-item__text b3-list-item__meta">${escapeLessThans(title)}</span></div></div>`;}@@ -901,7 +901,7 @@ const getUnRefListMobile = (element: Element, page = 1) => {${unicode2Emoji(item.ial.icon, "b3-list-item__graphic", true)}<span class="b3-list-item__text">${item.content}</span></div>-<span class="b3-list-item__text b3-list-item__meta">${escapeGreat(title)}</span>+<span class="b3-list-item__text b3-list-item__meta">${escapeLessThans(title)}</span></div>`;});element.querySelector("#searchUnRefResult").innerHTML = `<span class="fn__flex-center">${window.siyuan.languages.findInDoc.replace("${x}", response.data.matchedRootCount).replace("${y}", response.data.matchedBlockCount)}</span>diff --git a/app/src/protyle/render/av/relation.ts b/app/src/protyle/render/av/relation.tsindex 2f247e7161..1ae2f6dd93 100644--- a/app/src/protyle/render/av/relation.ts+++ b/app/src/protyle/render/av/relation.ts@@ -2,7 +2,7 @@ import {Menu} from "../../../plugin/Menu";import {hasClosestByClassName, hasTopClosestByClassName} from "../../util/hasClosest";import {UDLRHint, upDownHint} from "../../../util/upDownHint";import {fetchPost} from "../../../util/fetch";-import {escapeGreat, escapeHtml} from "../../../util/escape";+import {escapeLessThans, escapeHtml} from "../../../util/escape";import {transaction} from "../../wysiwyg/transaction";import {updateCellsValue} from "./cell";import {updateAttrViewCellAnimation} from "./action";@@ -43,7 +43,7 @@ const genSearchList = (element: Element, keyword: string, avId?: string, exclude<div class="b3-list-item__first"><span class="b3-list-item__text">${escapeHtml(item.avName || window.siyuan.languages._kernel[267])}</span></div>- <div class="b3-list-item__meta b3-list-item__showall">${escapeGreat(item.hPath)}</div>+ <div class="b3-list-item__meta b3-list-item__showall">${escapeLessThans(item.hPath)}</div></div><svg aria-label="${window.siyuan.languages.thisDatabase}" style="margin: 0 0 0 4px" class="b3-list-item__hinticon ariaLabel${item.avID === avId ? "" : " fn__none"}"><use xlink:href="#iconInfo"></use></svg></div>`;diff --git a/app/src/search/unRef.ts b/app/src/search/unRef.tsindex 261265a60a..8c43b2cff5 100644--- a/app/src/search/unRef.ts+++ b/app/src/search/unRef.ts@@ -2,7 +2,7 @@ import {Constants} from "../constants";import {fetchPost} from "../util/fetch";import {setStorageVal} from "../protyle/util/compatibility";import {getArticle, getAttr} from "./util";-import {escapeAriaLabel, escapeGreat} from "../util/escape";+import {escapeAriaLabel, escapeLessThans} from "../util/escape";import {getIconByType} from "../editor/getIcon";import {unicode2Emoji} from "../emoji";import {getDisplayName, getNotebookName} from "../util/pathName";@@ -110,7 +110,7 @@ export const getUnRefList = (element: Element, edit: Protyle, page = 1) => {${unicode2Emoji(item.ial.icon, "b3-list-item__graphic", true)}<span class="b3-list-item__text">${item.content}</span>${getAttr(item)}-<span class="b3-list-item__meta b3-list-item__meta--ellipsis ariaLabel" aria-label="${escapeAriaLabel(title)}">${escapeGreat(title)}</span>+<span class="b3-list-item__meta b3-list-item__meta--ellipsis ariaLabel" aria-label="${escapeAriaLabel(title)}">${escapeLessThans(title)}</span></div>`;});if (response.data.blocks.length > 0) {diff --git a/app/src/search/util.ts b/app/src/search/util.tsindex a953165e75..c75a9d73ff 100644--- a/app/src/search/util.ts+++ b/app/src/search/util.ts@@ -3,7 +3,7 @@ import {getAllModels} from "../layout/getAll";import * as path from "path";/// #endifimport {Constants} from "../constants";-import {escapeAriaLabel, escapeGreat, escapeHtml} from "../util/escape";+import {escapeAriaLabel, escapeLessThans, escapeHtml} from "../util/escape";import {fetchPost} from "../util/fetch";import {openFile, openFileById} from "../editor/util";import {showMessage} from "../dialog/message";@@ -485,7 +485,7 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele}config.hPath = hPathList.join(" ");config.page = 1;- searchPathInputElement.innerHTML = `${escapeGreat(config.hPath)}<svg class="search__rmpath"><use xlink:href="#iconCloseRound"></use></svg>`;+ searchPathInputElement.innerHTML = `${escapeLessThans(config.hPath)}<svg class="search__rmpath"><use xlink:href="#iconCloseRound"></use></svg>`;searchPathInputElement.setAttribute("aria-label", escapeHtml(config.hPath));const includeElement = element.querySelector("#searchInclude");includeElement.firstElementChild.classList.add("ft__primary");@@ -1018,7 +1018,7 @@ export const updateConfig = (element: Element, item: Config.IUILayoutTabSearchCo}const searchPathInputElement = element.querySelector("#searchPathInput");if (item.hPath) {- searchPathInputElement.innerHTML = `${escapeGreat(item.hPath)}<svg class="search__rmpath"><use xlink:href="#iconCloseRound"></use></svg>`;+ searchPathInputElement.innerHTML = `${escapeLessThans(item.hPath)}<svg class="search__rmpath"><use xlink:href="#iconCloseRound"></use></svg>`;searchPathInputElement.setAttribute("aria-label", escapeHtml(item.hPath));} else {searchPathInputElement.innerHTML = "";@@ -1403,7 +1403,7 @@ const onSearch = (data: IBlock[], edit: Protyle, element: Element, config: Confi<svg class="b3-list-item__arrow b3-list-item__arrow--open"><use xlink:href="#iconRight"></use></svg></span>${unicode2Emoji(getNotebookIcon(item.box) || window.siyuan.storage[Constants.LOCAL_IMAGES].note, "b3-list-item__graphic", true)}-<span class="b3-list-item__text ariaLabel" style="color: var(--b3-theme-on-surface)" aria-label="${escapeAriaLabel(title)}">${escapeGreat(title)}</span>+<span class="b3-list-item__text ariaLabel" style="color: var(--b3-theme-on-surface)" aria-label="${escapeAriaLabel(title)}">${escapeLessThans(title)}</span></div><div>`;item.children.forEach((childItem) => {if (focusId) {@@ -1445,7 +1445,7 @@ ${unicode2Emoji(item.ial.icon, "b3-list-item__graphic", true)}<span class="b3-list-item__text">${item.content}</span>${getAttr(item)}${item.tag ? `<span class="b3-list-item__meta b3-list-item__meta--ellipsis">${item.tag.replace(/#/g, "")}</span>` : ""}-<span class="b3-list-item__meta b3-list-item__meta--ellipsis ariaLabel" aria-label="${escapeAriaLabel(title)}">${escapeGreat(title)}</span>+<span class="b3-list-item__meta b3-list-item__meta--ellipsis ariaLabel" aria-label="${escapeAriaLabel(title)}">${escapeLessThans(title)}</span>${countHTML}</div>`;}diff --git a/app/src/util/escape.ts b/app/src/util/escape.tsindex 6ce933fc66..ed168f03aa 100644--- a/app/src/util/escape.ts+++ b/app/src/util/escape.ts@@ -5,7 +5,7 @@ export const escapeHtml = (html: string) => {return html.replace(/&/g, "&").replace(/</g, "<");};-export const escapeGreat = (html: string) => {+export const escapeLessThans = (html: string) => {return html.replace(/</g, "<");};