diff --git a/app/src/block/popover.ts b/app/src/block/popover.ts
index 7249f2d81..1be063d91 100644
--- a/app/src/block/popover.ts
+++ b/app/src/block/popover.ts
@@ -32,13 +32,13 @@ export const initBlockPopover = (app: App) => {
} else {
if (aElement.firstElementChild?.getAttribute("data-type") === "url") {
if (aElement.firstElementChild.textContent.indexOf("...") > -1) {
- tip = aElement.firstElementChild.getAttribute("data-href");
+ tip = Lute.EscapeHTMLStr(aElement.firstElementChild.getAttribute("data-href"));
}
}
if (!tip && aElement.dataset.wrap !== "true" && event.target.dataset.type !== "block-more" && !hasClosestByClassName(event.target, "block__icon")) {
aElement.style.overflow = "auto";
if (aElement.scrollWidth > aElement.clientWidth + 2) {
- tip = getCellText(aElement);
+ tip = Lute.EscapeHTMLStr(getCellText(aElement));
}
aElement.style.overflow = "";
}
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index 75725d6a0..09646390c 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -30,9 +30,10 @@ const renderCellURL = (urlContent: string) => {
}
} catch (e) {
// 不是 url 地址
+ host = Lute.EscapeHTMLStr(urlContent);
}
// https://github.com/siyuan-note/siyuan/issues/9291
- return `${host}${suffix}`;
+ return `${host}${suffix}`;
};
export const getCellText = (cellElement: HTMLElement | false) => {
@@ -149,7 +150,7 @@ export const genCellValue = (colType: TAVCol, value: string | any) => {
cellValue = {
type: colType,
[colType]: {
- content: ["block", "text", "url", "phone", "email"].includes(colType) ? Lute.EscapeHTMLStr(value) : value
+ content: value
}
};
} else if (colType === "mSelect" || colType === "select") {
@@ -687,10 +688,12 @@ export const renderCellAttr = (cellElement: Element, value: IAVCellValue) => {
export const renderCell = (cellValue: IAVCellValue, rowIndex = 0) => {
let text = "";
- if (["text", "template"].includes(cellValue.type)) {
- text = `${cellValue ? (cellValue[cellValue.type as "text"].content || "") : ""}`;
+ if ("template" === cellValue.type) {
+ text = `${cellValue ? (cellValue.template.content || "") : ""}`;
+ } else if ("text" === cellValue.type) {
+ text = `${cellValue ? Lute.EscapeHTMLStr(cellValue.text.content || "") : ""}`;
} else if (["email", "phone"].includes(cellValue.type)) {
- text = `${cellValue ? cellValue[cellValue.type as "email"].content : ""}`;
+ text = `${cellValue ? Lute.EscapeHTMLStr(cellValue[cellValue.type as "email"].content || "") : ""}`;
} else if ("url" === cellValue.type) {
text = renderCellURL(cellValue?.url?.content || "");
} else if (cellValue.type === "block") {