From 0ad0d416c4ab8cc5f45a428e1d40a90166d5229b Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 17 May 2024 19:12:36 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/11391 --- app/src/protyle/wysiwyg/commonHotkey.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/wysiwyg/commonHotkey.ts b/app/src/protyle/wysiwyg/commonHotkey.ts index 639bd7954..8329ef64f 100644 --- a/app/src/protyle/wysiwyg/commonHotkey.ts +++ b/app/src/protyle/wysiwyg/commonHotkey.ts @@ -200,7 +200,15 @@ export const duplicateBlock = (nodeElements: Element[], protyle: IProtyle) => { childItem.setAttribute("data-node-id", Lute.NewNodeID()); }); item.classList.remove("protyle-wysiwyg--select"); - nodeElements[0].after(tempElement); + if (tempElement.dataset.type ==="NodeHTMLBlock") { + const phElement = tempElement.querySelector("protyle-html"); + const content = phElement.getAttribute("data-content"); + phElement.setAttribute("data-content", ""); + nodeElements[0].after(tempElement); + phElement.setAttribute("data-content", Lute.UnEscapeHTMLStr(content)); + } else { + nodeElements[0].after(tempElement); + } doOperations.push({ action: "insert", data: tempElement.outerHTML,