From 17f81dc03e28f9f212e4053ec0755011fc83bd25 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 17 Nov 2024 17:54:26 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/13134 --- app/src/protyle/wysiwyg/transaction.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts index df6b0d23a..540ad68a1 100644 --- a/app/src/protyle/wysiwyg/transaction.ts +++ b/app/src/protyle/wysiwyg/transaction.ts @@ -392,9 +392,19 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo: } if (operation.retData) { operation.retData.forEach((item: string) => { - protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${item}"]`).forEach(item => { - item.remove(); + let embedElement: HTMLElement | false; + Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${item}"]`)).find(itemElement => { + embedElement = isInEmbedBlock(itemElement) + if (embedElement) { + return true; + } + itemElement.remove(); }); + // 折叠嵌入块的父级 + if (embedElement) { + embedElement.removeAttribute("data-render"); + blockRender(protyle, embedElement); + } }); if (protyle.wysiwyg.element.childElementCount === 0) { zoomOut({