diff --git a/app/src/protyle/render/av/relation.ts b/app/src/protyle/render/av/relation.ts
index b748b47b8..79250e496 100644
--- a/app/src/protyle/render/av/relation.ts
+++ b/app/src/protyle/render/av/relation.ts
@@ -243,17 +243,17 @@ const filterItem = (menuElement: Element, cellElement: HTMLElement, keyword: str
cellElement.querySelectorAll(".av__cell--relation").forEach((relationItem: HTMLElement) => {
const item = relationItem.querySelector(".av__celltext") as HTMLElement;
hasIds.push(item.dataset.id);
- selectHTML += ``;
+ selectHTML += ``;
});
cells.forEach((item) => {
if (!hasIds.includes(item.block.id)) {
- html += genSelectItemHTML("unselect", item.block.id, item.isDetached, item.block.content || window.siyuan.languages.untitled);
+ html += genSelectItemHTML("unselect", item.block.id, item.isDetached, Lute.EscapeHTMLStr(item.block.content || window.siyuan.languages.untitled));
}
});
menuElement.querySelector(".b3-menu__items").innerHTML = `${selectHTML}
${html}
-${keyword ? genSelectItemHTML("empty", keyword, undefined, menuElement.querySelector(".popover__block").outerHTML) : (html ? "" : genSelectItemHTML("empty"))}`;
+${keyword ? genSelectItemHTML("empty", Lute.EscapeHTMLStr(keyword), undefined, menuElement.querySelector(".popover__block").outerHTML) : (html ? "" : genSelectItemHTML("empty"))}`;
menuElement.querySelector(".b3-menu__items .b3-menu__item:not(.fn__none)").classList.add("b3-menu__item--current");
});
};
@@ -275,11 +275,11 @@ export const bindRelationEvent = (options: {
options.cellElements[0].querySelectorAll(".av__cell--relation").forEach((relationItem: HTMLElement) => {
const item = relationItem.querySelector(".av__celltext") as HTMLElement;
hasIds.push(item.dataset.id);
- selectHTML += ``;
+ selectHTML += ``;
});
cells.forEach((item) => {
if (!hasIds.includes(item.block.id)) {
- html += genSelectItemHTML("unselect", item.block.id, item.isDetached, item.block.content || window.siyuan.languages.untitled);
+ html += genSelectItemHTML("unselect", item.block.id, item.isDetached, Lute.EscapeHTMLStr(item.block.content || window.siyuan.languages.untitled));
}
});
options.menuElement.querySelector(".b3-menu__items").innerHTML = `${selectHTML}
@@ -291,7 +291,7 @@ ${html || genSelectItemHTML("empty")}`;
const inputElement = options.menuElement.querySelector("input");
inputElement.focus();
const databaseName = inputElement.parentElement.querySelector(".popover__block");
- databaseName.innerHTML = response.data.name;
+ databaseName.innerHTML = Lute.EscapeHTMLStr(response.data.name);
databaseName.setAttribute("data-id", response.data.blockIDs[0]);
const listElement = options.menuElement.querySelector(".b3-menu__items");
inputElement.addEventListener("keydown", (event) => {
@@ -389,7 +389,7 @@ export const setRelationCell = (protyle: IProtyle, nodeElement: HTMLElement, tar
newValue.blockIDs.splice(removeIndex, 1);
newValue.contents.splice(removeIndex, 1);
separatorElement.after(target);
- target.outerHTML = genSelectItemHTML("unselect", targetId, !target.querySelector(".popover__block"), target.querySelector(".b3-menu__label").textContent);
+ target.outerHTML = genSelectItemHTML("unselect", targetId, !target.querySelector(".popover__block"), Lute.EscapeHTMLStr(target.querySelector(".b3-menu__label").textContent));
} else if (targetId) {
newValue.blockIDs.push(targetId);
newValue.contents.push({
@@ -401,7 +401,7 @@ export const setRelationCell = (protyle: IProtyle, nodeElement: HTMLElement, tar
isDetached: !target.firstElementChild.getAttribute("style")
});
separatorElement.before(target);
- target.outerHTML = ``;
+ target.outerHTML = ``;
if (!separatorElement.nextElementSibling) {
separatorElement.insertAdjacentHTML("afterend", genSelectItemHTML("empty"));
}
@@ -433,7 +433,7 @@ export const setRelationCell = (protyle: IProtyle, nodeElement: HTMLElement, tar
},
isDetached: true
});
- separatorElement.insertAdjacentHTML("beforebegin", ``);
+ separatorElement.insertAdjacentHTML("beforebegin", ``);
}
menuElement.querySelector(".b3-menu__item--current")?.classList.remove("b3-menu__item--current");
menuElement.querySelector(".b3-menu__items .b3-menu__item:not(.fn__none)").classList.add("b3-menu__item--current");