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

Daniel56af148373e8
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index 2d516cd766..81053fef59 100644
--- a/app/src/protyle/util/editorCommonEvent.ts
+++ b/app/src/protyle/util/editorCommonEvent.ts
@@ -1390,6 +1390,14 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
position = "top";
}
const isChild = position === "bottom" && offsetX >= indent;
+ // 源列表项不能拖到自身或子孙中(含原位置),此时不高亮也不显示提示
+ const isSelfOrDescendant = Array.from(editorElement.querySelectorAll(".protyle-wysiwyg--select"))
+ .some((source: HTMLElement) => source === htmlTarget || source.contains(htmlTarget));
+ if (isSelfOrDescendant) {
+ cleanupDragIndicators(editorElement);
+ hideDragTip();
+ return;
+ }
const className = `dragover__${position}--${isChild ? "child" : "sibling"}`;
htmlTarget.classList.add(className);