From 68c82eaebea10a8c65f1ea7b1b88d6c1c97a3ee2 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 30 Dec 2024 22:08:41 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/13666 --- app/src/protyle/wysiwyg/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index c97f93efd..776a2225e 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -1514,7 +1514,8 @@ export class WYSIWYG { updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, oldHTML); } else { const id = nodeElement.getAttribute("data-node-id"); - const oldHTML = nodeElement.outerHTML; + setInsertWbrHTML(nodeElement, range, protyle); + const oldHTML = protyle.wysiwyg.lastHTMLs[id] || nodeElement.outerHTML; const tempElement = document.createElement("div"); // 首次选中标题时,range.startContainer 会为空 let startContainer = range.startContainer; @@ -1658,7 +1659,8 @@ export class WYSIWYG { } if (nodeElement.parentElement.parentElement && !isFoldHeading && !nodeElement.classList.contains("av")) { // 选中 heading 时,使用删除的 transaction - updateTransaction(protyle, id, nodeElement.outerHTML, oldHTML); + setInsertWbrHTML(nodeElement, range, protyle); + updateTransaction(protyle, id, protyle.wysiwyg.lastHTMLs[id] || nodeElement.outerHTML, oldHTML); } } protyle.hint.render(protyle);