Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/8394

Vanessadd0902654cd5
diff --git a/app/src/protyle/wysiwyg/commonHotkey.ts b/app/src/protyle/wysiwyg/commonHotkey.ts
index ca9f6f0d18..a436f3704c 100644
--- a/app/src/protyle/wysiwyg/commonHotkey.ts
+++ b/app/src/protyle/wysiwyg/commonHotkey.ts
@@ -200,9 +200,9 @@ export const duplicateBlock = (nodeElements: Element[], protyle: IProtyle) => {
let focusElement;
const doOperations: IOperation[] = [];
const undoOperations: IOperation[] = [];
- nodeElements.forEach((item, index) => {
+ nodeElements.reverse().forEach((item, index) => {
const tempElement = item.cloneNode(true) as HTMLElement;
- if (index === nodeElements.length - 1) {
+ if (index === 0) {
focusElement = tempElement;
}
const newId = Lute.NewNodeID();
@@ -211,12 +211,12 @@ export const duplicateBlock = (nodeElements: Element[], protyle: IProtyle) => {
childItem.setAttribute("data-node-id", Lute.NewNodeID());
});
item.classList.remove("protyle-wysiwyg--select");
- item.after(tempElement);
+ nodeElements[0].after(tempElement);
doOperations.push({
action: "insert",
data: tempElement.outerHTML,
id: newId,
- previousID: item.getAttribute("data-node-id"),
+ previousID: nodeElements[0].getAttribute("data-node-id"),
});
undoOperations.push({
action: "delete",