Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: fix https://github.com/siyuan-note/siyuan/issues/11079

Vanessa41f3e066adcd
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index 1e681e9287..fcb69cbaae 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -648,7 +648,10 @@ export const renderCellAttr = (cellElement: Element, value: IAVCellValue) => {
cellElement.classList.add("av__cell-uncheck");
}
} else if (value.type === "block") {
- cellElement.setAttribute("data-block-id", value.block.id || "");
+ if (value.block.id) {
+ // 不能设置为空,否则编辑后会临时无 id
+ cellElement.setAttribute("data-block-id", value.block.id);
+ }
if (value.isDetached) {
cellElement.setAttribute("data-detached", "true");
}
diff --git a/app/src/protyle/render/av/row.ts b/app/src/protyle/render/av/row.ts
index d4a437aa9a..639f8ca164 100644
--- a/app/src/protyle/render/av/row.ts
+++ b/app/src/protyle/render/av/row.ts
@@ -110,7 +110,7 @@ export const insertAttrViewBlockAnimation = (protyle: IProtyle, blockElement: El
previousElement.querySelectorAll(".av__cell").forEach((item: HTMLElement, index) => {
colHTML += `<div class="av__cell" data-col-id="${item.dataset.colId}"
style="width: ${item.style.width};${item.dataset.dtype === "number" ? "text-align: right;" : ""}"
-${(item.getAttribute("data-block-id") || item.dataset.dtype === "block") ? ' data-detached="true"' : ""}><span class="${avId ? "av__celltext" : "av__pulse"}"></span></div>`;
+${getTypeByCellElement(item) === "block" ? ' data-detached="true"' : ""}><span class="${avId ? "av__celltext" : "av__pulse"}"></span></div>`;
if (pinIndex === index) {
colHTML += "</div>";
}