Skip to content

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

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

Vanessa42ea99a5e9ca
diff --git a/app/src/protyle/wysiwyg/move.ts b/app/src/protyle/wysiwyg/move.ts
index dfe2b4da70..50ebc65933 100644
--- a/app/src/protyle/wysiwyg/move.ts
+++ b/app/src/protyle/wysiwyg/move.ts
@@ -46,9 +46,13 @@ export const moveToUp = (protyle: IProtyle, nodeElement: HTMLElement, range: Ran
range.insertNode(document.createElement("wbr"));
oldListHTML = sourceElements[0].parentElement.parentElement.outerHTML;
if (!previousElement) {
- const newId = Lute.NewNodeID();
- sourceElements[0].parentElement.previousElementSibling.lastElementChild.insertAdjacentHTML("beforebegin", `<div data-subtype="${sourceElements[0].getAttribute("data-subtype")}" data-node-id="${newId}" data-type="NodeList" class="list" updated="${newId.split("-")[0]}"><div id="moveTempLi"></div><div class="protyle-attr" contenteditable="false">&ZeroWidthSpace;</div></div>`);
- previousElement = sourceElements[0].parentElement.previousElementSibling.querySelector(".list");
+ // 目标 li 无子列表:直接整体移动源列表,与其他块移动保持一致
+ sourceElements[0].parentElement.previousElementSibling.lastElementChild.insertAdjacentElement("beforebegin", sourceElements[0]);
+ updateTransaction(protyle, sourceElements[0].parentElement.parentElement, oldListHTML);
+ preventScroll(protyle);
+ focusByWbr(sourceElements[0], range);
+ scrollCenter(protyle);
+ return;
}
} else {
return;
@@ -152,9 +156,13 @@ export const moveToDown = (protyle: IProtyle, nodeElement: HTMLElement, range: R
range.insertNode(document.createElement("wbr"));
oldListHTML = sourceElements[0].parentElement.parentElement.outerHTML;
if (!nextElement) {
- const newId = Lute.NewNodeID();
- sourceElements[0].parentElement.nextElementSibling.lastElementChild.insertAdjacentHTML("beforebegin", `<div data-subtype="${sourceElements[0].getAttribute("data-subtype")}" data-node-id="${newId}" data-type="NodeList" class="list" updated="${newId.split("-")[0]}"><div class="protyle-attr" contenteditable="false">&ZeroWidthSpace;</div></div>`);
- nextElement = sourceElements[0].parentElement.nextElementSibling.querySelector(".list > div");
+ // 目标 li 无子列表:直接整体移动源列表,与其他块移动保持一致
+ sourceElements[0].parentElement.nextElementSibling.lastElementChild.insertAdjacentElement("beforebegin", sourceElements[0]);
+ updateTransaction(protyle, sourceElements[0].parentElement.parentElement, oldListHTML);
+ preventScroll(protyle);
+ focusByWbr(sourceElements[0], range);
+ scrollCenter(protyle);
+ return;
}
} else {
return;