Skip to content

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

:bug: Restore empty paragraph on conversion undo https://github.com/siyuan-note/siyuan/issues/14744

Daniel651184d3d64e
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index ba1d415e5a..d1bae15ae1 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -2089,6 +2089,7 @@ export const turnEmptyParagraphsIntoTransaction = (options: {
oldElement.classList.remove("protyle-wysiwyg--select");
oldElement.removeAttribute("select-start");
oldElement.removeAttribute("select-end");
+ const oldHTML = oldElement.outerHTML;
const editableElement = getContenteditableElement(oldElement);
editableElement.textContent = getEmptyParagraphTargetMarkdown(options.type);
@@ -2109,7 +2110,7 @@ export const turnEmptyParagraphsIntoTransaction = (options: {
}
return {
nodeElement,
- oldHTML: oldElement.outerHTML,
+ oldHTML,
newElement,
};
});