Vanessa
2026-04-21 21:49:22 +08:00
parent 96dfe0bea4
commit 71fa534124
7 changed files with 20 additions and 20 deletions
+4 -4
View File
@@ -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 }) => {
+2 -2
View File
@@ -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 {
+4 -4
View File
@@ -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>
+2 -2
View File
@@ -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>`;
+2 -2
View File
@@ -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) {
+5 -5
View File
@@ -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)}<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>`;
}
+1 -1
View File
@@ -5,7 +5,7 @@ export const escapeHtml = (html: string) => {
return html.replace(/&/g, "&amp;").replace(/</g, "&lt;");
};
export const escapeGreat = (html: string) => {
export const escapeLessThans = (html: string) => {
return html.replace(/</g, "&lt;");
};