From 04fc8cfa9790adfd45734b6ed5c50cd8a6c319a7 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 23 Aug 2025 22:09:21 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/15668 --- app/src/protyle/render/av/render.ts | 3 ++- app/src/protyle/wysiwyg/transaction.ts | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts index c83d73b26..1e9e3678e 100644 --- a/app/src/protyle/render/av/render.ts +++ b/app/src/protyle/render/av/render.ts @@ -782,7 +782,8 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => { popCellElement = popCellElements[0] as HTMLElement; } } - if (popCellElement && popCellElement.getAttribute("data-detached") === "true") { + if (popCellElement && popCellElement.getAttribute("data-detached") === "true" && + popCellElement.querySelector(".av__celltext").textContent === "") { popTextCell(protyle, [popCellElement], "block"); } } diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts index 5b780cbba..94f2014c1 100644 --- a/app/src/protyle/wysiwyg/transaction.ts +++ b/app/src/protyle/wysiwyg/transaction.ts @@ -864,9 +864,10 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo: "duplicateAttrViewKey", "setAttrViewViewDesc", "setAttrViewCoverFrom", "setAttrViewCoverFromAssetKeyID", "setAttrViewBlockView", "setAttrViewCardSize", "setAttrViewCardAspectRatio", "hideAttrViewName", "setAttrViewShowIcon", "setAttrViewWrapField", "setAttrViewGroup", "removeAttrViewGroup", "hideAttrViewGroup", "sortAttrViewGroup", - "foldAttrViewGroup", "hideAttrViewAllGroups", "setAttrViewFitImage", "setAttrViewDisplayFieldName"].includes(operation.action)) { + "foldAttrViewGroup", "hideAttrViewAllGroups", "setAttrViewFitImage", "setAttrViewDisplayFieldName", + "insertAttrViewBlock"].includes(operation.action)) { + // 撤销 transaction 会进行推送,需使用推送来进行刷新最新数据 https://github.com/siyuan-note/siyuan/issues/13607 if (!isUndo) { - // 撤销 transaction 会进行推送,需使用推送来进行刷新最新数据 https://github.com/siyuan-note/siyuan/issues/13607 refreshAV(protyle, operation); } else if (operation.action === "setAttrViewName") { // setAttrViewName 同文档不会推送,需手动刷新 @@ -1327,8 +1328,6 @@ export const transaction = (protyle: IProtyle, doOperations: IOperation[], undoO blockRender(protyle, item); } }); - } else if (operation.action === "insertAttrViewBlock") { - refreshAV(protyle, operation); } }); });