diff --git a/app/src/layout/Tab.ts b/app/src/layout/Tab.ts index ba37a5675..f5792816b 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.ts index e74265d47..dc390ac81 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.ts index 4838327af..41fccc15d 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, ${unicode2Emoji(getNotebookIcon(item.box) || window.siyuan.storage[Constants.LOCAL_IMAGES].note, "b3-list-item__graphic", true)} -${escapeGreat(title)} +${escapeLessThans(title)}
`; item.children.forEach((childItem) => { if (focusId) { @@ -208,7 +208,7 @@ ${childItem.tag ? `
${item.tag ? `${item.tag.replace(/#/g, "")}` : ""} - ${escapeGreat(title)} + ${escapeLessThans(title)}
`; } @@ -901,7 +901,7 @@ const getUnRefListMobile = (element: Element, page = 1) => { ${unicode2Emoji(item.ial.icon, "b3-list-item__graphic", true)} ${item.content} -${escapeGreat(title)} +${escapeLessThans(title)} `; }); element.querySelector("#searchUnRefResult").innerHTML = `${window.siyuan.languages.findInDoc.replace("${x}", response.data.matchedRootCount).replace("${y}", response.data.matchedBlockCount)} diff --git a/app/src/protyle/render/av/relation.ts b/app/src/protyle/render/av/relation.ts index 2f247e716..1ae2f6dd9 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
${escapeHtml(item.avName || window.siyuan.languages._kernel[267])}
-
${escapeGreat(item.hPath)}
+
${escapeLessThans(item.hPath)}
`; diff --git a/app/src/search/unRef.ts b/app/src/search/unRef.ts index 261265a60..8c43b2cff 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)} ${item.content} ${getAttr(item)} -${escapeGreat(title)} +${escapeLessThans(title)} `; }); if (response.data.blocks.length > 0) { diff --git a/app/src/search/util.ts b/app/src/search/util.ts index a953165e7..c75a9d73f 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"; /// #endif import {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)}`; + searchPathInputElement.innerHTML = `${escapeLessThans(config.hPath)}`; 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)}`; + searchPathInputElement.innerHTML = `${escapeLessThans(item.hPath)}`; searchPathInputElement.setAttribute("aria-label", escapeHtml(item.hPath)); } else { searchPathInputElement.innerHTML = ""; @@ -1403,7 +1403,7 @@ const onSearch = (data: IBlock[], edit: Protyle, element: Element, config: Confi ${unicode2Emoji(getNotebookIcon(item.box) || window.siyuan.storage[Constants.LOCAL_IMAGES].note, "b3-list-item__graphic", true)} -${escapeGreat(title)} +${escapeLessThans(title)}
`; item.children.forEach((childItem) => { if (focusId) { @@ -1445,7 +1445,7 @@ ${unicode2Emoji(item.ial.icon, "b3-list-item__graphic", true)} ${item.content} ${getAttr(item)} ${item.tag ? `${item.tag.replace(/#/g, "")}` : ""} -${escapeGreat(title)} +${escapeLessThans(title)} ${countHTML}
`; } diff --git a/app/src/util/escape.ts b/app/src/util/escape.ts index 6ce933fc6..ed168f03a 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(/ { +export const escapeLessThans = (html: string) => { return html.replace(/