From 7e41e00ca9e88ed9c9138c5aa7627b2bf8688544 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 24 Mar 2025 09:18:55 +0800 Subject: [PATCH] :bug: https://github.com/siyuan-note/siyuan/issues/14326 --- app/src/protyle/wysiwyg/transaction.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts index 19705ec0b..28e53edee 100644 --- a/app/src/protyle/wysiwyg/transaction.ts +++ b/app/src/protyle/wysiwyg/transaction.ts @@ -482,11 +482,10 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo: operation.data = newTempElement.outerHTML; operation.id = newUpdateId; // https://github.com/siyuan-note/siyuan/issues/14326#issuecomment-2746140335 - protyle.wysiwyg.element.childNodes.forEach((item, index) => { - if (index !== 0) { - item.remove(); - } - }) + for (let i = 1; i < protyle.wysiwyg.element.childElementCount; i++) { + protyle.wysiwyg.element.childNodes[i].remove(); + i--; + } } } if (updateElements.length > 0) {