Browse Source

:art: https://github.com/siyuan-note/siyuan/issues/11391

Vanessa 1 year ago
parent
commit
0ad0d416c4
1 changed files with 9 additions and 1 deletions
  1. 9 1
      app/src/protyle/wysiwyg/commonHotkey.ts

+ 9 - 1
app/src/protyle/wysiwyg/commonHotkey.ts

@@ -200,7 +200,15 @@ export const duplicateBlock = (nodeElements: Element[], protyle: IProtyle) => {
             childItem.setAttribute("data-node-id", Lute.NewNodeID());
             childItem.setAttribute("data-node-id", Lute.NewNodeID());
         });
         });
         item.classList.remove("protyle-wysiwyg--select");
         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({
         doOperations.push({
             action: "insert",
             action: "insert",
             data: tempElement.outerHTML,
             data: tempElement.outerHTML,