Skip to content

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

:bug: https://github.com/siyuan-note/siyuan/issues/14326

Vanessa7e41e00ca9e8
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index 19705ec0b7..28e53edee3 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) {