Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/17564

Vanessa187e5c5e512c
diff --git a/app/src/mobile/menu/search.ts b/app/src/mobile/menu/search.ts
index 41fccc15dd..644ed8df7e 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 {escapeLessThans, escapeHtml} from "../../util/escape";
+import {escapeLessThans, escapeHtml, escapeAttr} 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)">${escapeLessThans(title)}</span>
+<span class="b3-list-item__text" style="color: var(--b3-theme-on-surface)">${escapeHtml(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">${escapeLessThans(title)}</span>
+ <span class="b3-list-item__text b3-list-item__meta">${escapeHtml(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">${escapeLessThans(title)}</span>
+<span class="b3-list-item__text b3-list-item__meta">${escapeHtml(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/search/util.ts b/app/src/search/util.ts
index c75a9d73ff..fcb8c69e37 100644
--- a/app/src/search/util.ts
+++ b/app/src/search/util.ts
@@ -485,8 +485,8 @@ export const genSearch = (app: App, config: Config.IUILayoutTabSearchConfig, ele
}
config.hPath = hPathList.join(" ");
config.page = 1;
- searchPathInputElement.innerHTML = `${escapeLessThans(config.hPath)}<svg class="search__rmpath"><use xlink:href="#iconCloseRound"></use></svg>`;
- searchPathInputElement.setAttribute("aria-label", escapeHtml(config.hPath));
+ searchPathInputElement.innerHTML = `${escapeHtml(config.hPath)}<svg class="search__rmpath"><use xlink:href="#iconCloseRound"></use></svg>`;
+ searchPathInputElement.setAttribute("aria-label", escapeAriaLabel(config.hPath));
const includeElement = element.querySelector("#searchInclude");
includeElement.firstElementChild.classList.add("ft__primary");
if (enableIncludeChild) {
@@ -1018,8 +1018,8 @@ export const updateConfig = (element: Element, item: Config.IUILayoutTabSearchCo
}
const searchPathInputElement = element.querySelector("#searchPathInput");
if (item.hPath) {
- searchPathInputElement.innerHTML = `${escapeLessThans(item.hPath)}<svg class="search__rmpath"><use xlink:href="#iconCloseRound"></use></svg>`;
- searchPathInputElement.setAttribute("aria-label", escapeHtml(item.hPath));
+ searchPathInputElement.innerHTML = `${escapeHtml(item.hPath)}<svg class="search__rmpath"><use xlink:href="#iconCloseRound"></use></svg>`;
+ searchPathInputElement.setAttribute("aria-label", escapeAriaLabel(item.hPath));
} else {
searchPathInputElement.innerHTML = "";
searchPathInputElement.setAttribute("aria-label", "");
@@ -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)}">${escapeLessThans(title)}</span>
+<span class="b3-list-item__text ariaLabel" style="color: var(--b3-theme-on-surface)" aria-label="${escapeAriaLabel(title)}">${escapeHtml(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)}">${escapeLessThans(title)}</span>
+<span class="b3-list-item__meta b3-list-item__meta--ellipsis ariaLabel" aria-label="${escapeAriaLabel(title)}">${escapeHtml(title)}</span>
${countHTML}
</div>`;
}