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/8766

Vanessab709c8458508
diff --git a/app/src/protyle/render/av/blockAttr.ts b/app/src/protyle/render/av/blockAttr.ts
index 833fea2b4d..021655e23e 100644
--- a/app/src/protyle/render/av/blockAttr.ts
+++ b/app/src/protyle/render/av/blockAttr.ts
@@ -48,7 +48,7 @@ export const genAVValueHTML = (value: IAVCellValue) => {
<a href="tel:${value.phone.content}" target="_blank" aria-label="${window.siyuan.languages.openBy}" class="block__icon block__icon--show fn__flex-center b3-tooltips__w b3-tooltips"><svg><use xlink:href="#iconPhone"></use></svg></a>`;
break;
case "template":
- html = `<input value="${value.template.content}" class="b3-text-field b3-text-field--text fn__flex-1">`;
+ html = `<div class="fn__flex-1">${value.template.content}</div>`;
break;
case "email":
html = `<input value="${value.email.content}" class="b3-text-field b3-text-field--text fn__flex-1">
@@ -120,7 +120,7 @@ class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone", "templat
element.querySelectorAll(".b3-text-field--text").forEach((item: HTMLInputElement) => {
item.addEventListener("change", () => {
let value;
- if (["url", "text", "email", "phone", "template"].includes(item.parentElement.dataset.type)) {
+ if (["url", "text", "email", "phone"].includes(item.parentElement.dataset.type)) {
value = {
[item.parentElement.dataset.type]: {
content: item.value
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index 10b6ccddf1..7e8c4cb9b9 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -85,7 +85,7 @@ export const genCellValue = (colType: TAVCol, value: string | any) => {
}
};
}
- } else if (["text", "block", "url", "phone", "email", "template"].includes(colType)) {
+ } else if (["text", "block", "url", "phone", "email"].includes(colType)) {
cellValue = {
type: colType,
[colType]: {
@@ -344,6 +344,9 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
if (!type) {
type = cellElements[0].parentElement.parentElement.firstElementChild.querySelector(`[data-col-id="${cellElements[0].getAttribute("data-col-id")}"]`).getAttribute("data-dtype") as TAVCol;
}
+ if (type === "template") {
+ return;
+ }
if (type === "block" && (cellElements.length > 1 || !cellElements[0].getAttribute("data-detached"))) {
return;
}
@@ -353,9 +356,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
const blockElement = hasClosestBlock(cellElements[0]);
if (["text", "url", "email", "phone", "block"].includes(type)) {
html = `<textarea ${style} class="b3-text-field">${cellElements[0].firstElementChild.textContent}</textarea>`;
- } else if (type === "template") {
- html = `<textarea ${style} class="b3-text-field">${cellElements[0].firstElementChild.getAttribute("data-content")}</textarea>`;
- }else if (type === "number") {
+ } else if (type === "number") {
html = `<input type="number" value="${cellElements[0].firstElementChild.getAttribute("data-content")}" ${style} class="b3-text-field">`;
} else if (["select", "mSelect"].includes(type) && blockElement) {
openMenuPanel({protyle, blockElement, type: "select", cellElements});
diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts
index 4e4725e12c..8dd42d65d7 100644
--- a/app/src/protyle/render/av/render.ts
+++ b/app/src/protyle/render/av/render.ts
@@ -62,10 +62,8 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use x
return;
}
let text = "";
- if (cell.valueType === "text") {
- text = `<span class="av__celltext">${cell.value?.text.content || ""}</span>`;
- } else if (cell.valueType === "template") {
- text = `<span class="av__celltext" data-content="${cell.value?.template.content || ""}">${cell.value?.template.renderedContent || ""}</span>`;
+ if (["text", "template"].includes(cell.valueType)) {
+ text = `<span class="av__celltext">${cell.value ? cell.value[cell.valueType as "text"].content : ""}</span>`;
} else if (["url", "email", "phone"].includes(cell.valueType)) {
const urlContent = cell.value ? cell.value[cell.valueType as "url"].content : "";
// https://github.com/siyuan-note/siyuan/issues/9291
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 1d5b5098b3..8abc910f5f 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -1075,7 +1075,6 @@ interface IAVCellValue {
}
template?: {
content: string
- renderedContent?:string
}
date?: IAVCellDateValue
}