Skip to content

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

:art: Improve the drag-and-drop experience in the list and super block https://github.com/siyuan-note/siyuan/issues/17893

Daniel849ab4aff31f
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index 5510a11961..d76cfa989e 100644
--- a/app/src/protyle/util/editorCommonEvent.ts
+++ b/app/src/protyle/util/editorCommonEvent.ts
@@ -85,13 +85,19 @@ const moveTo = async (protyle: IProtyle, sourceElements: Element[], targetElemen
let srcParentID = parentBlock?.getAttribute("data-node-id");
if (!srcParentID) {
// 顶层块:父是 .protyle-wysiwyg 容器(无 data-node-id)。
+ let srcRootID = "";
+ /// #if !MOBILE
// 通过 getAllEditor 反查 item 所属的源 protyle,取其 block.rootID。
const sourceEditor = getAllEditor().find(editor =>
editor.protyle.wysiwyg.element === parentBlock);
if (sourceEditor?.protyle?.block?.rootID) {
- srcParentID = sourceEditor.protyle.block.rootID;
+ srcRootID = sourceEditor.protyle.block.rootID;
+ }
+ /// #endif
+ if (srcRootID) {
+ srcParentID = srcRootID;
} else {
- // 跨窗口拖拽时 getAllEditor 找不到源编辑器,用 kernel API 反查块的真实 rootID。
+ // 跨窗口/移动端 getAllEditor 找不到源编辑器,用 kernel API 反查块的真实 rootID。
// 不能 fallback 到目标 protyle 的 rootID(会导致撤销把块移到错误文档)。
const response = await fetchSyncPost("/api/block/getBlockInfo", {id});
srcParentID = response?.data?.rootID || "";