From 8a70277adde5503f393f4d5f8c8b447888fe3bf8 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 27 Oct 2025 18:14:18 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/16196 --- app/src/protyle/wysiwyg/commonHotkey.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/protyle/wysiwyg/commonHotkey.ts b/app/src/protyle/wysiwyg/commonHotkey.ts index e9ca987b3..5bbe92227 100644 --- a/app/src/protyle/wysiwyg/commonHotkey.ts +++ b/app/src/protyle/wysiwyg/commonHotkey.ts @@ -260,13 +260,15 @@ export const duplicateBlock = async (nodeElements: Element[], protyle: IProtyle) const undoOperations: IOperation[] = []; let starIndex: number; let lastElement = nodeElements[nodeElements.length - 1]; + let isSameLi = true; if (lastElement.classList.contains("li")) { if (lastElement.getAttribute("data-subtype") === "o") { starIndex = parseInt(lastElement.getAttribute("data-marker"), 10); } - const isSameLi = nodeElements.find(item => { - if (item.classList.contains("li") && + nodeElements.find(item => { + if (!item.classList.contains("li") || lastElement.getAttribute("data-subtype") !== item.getAttribute("data-subtype")) { + isSameLi = false; return true; } }); @@ -290,7 +292,7 @@ export const duplicateBlock = async (nodeElements: Element[], protyle: IProtyle) foldTempElement.innerHTML = response.data.dom; tempElement = foldTempElement.content.firstElementChild as HTMLElement; } - if (item.getAttribute("data-type") === "NodeListItem") { + if (item.getAttribute("data-type") === "NodeListItem" && !isSameLi) { if (!listHTML) { listHTML = `
${Constants.ZWSP}
`; }