Skip to content

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

:bug: Make kanban group drop positions predictable https://github.com/siyuan-note/siyuan/issues/16325

Danield68665804438
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index 95fbbb06d7..7c0f008c1b 100644
--- a/app/src/protyle/util/editorCommonEvent.ts
+++ b/app/src/protyle/util/editorCommonEvent.ts
@@ -2004,19 +2004,25 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
if (targetGroupElement === sourceElement) {
return;
}
+ let position: "left" | "right" = "left";
if (!targetGroupElement) {
+ const sourceRect = sourceElement.getBoundingClientRect();
+ if (event.clientX >= sourceRect.left && event.clientX <= sourceRect.right) {
+ return;
+ }
const groupElements = Array.from(kanbanElement.querySelectorAll(":scope > .av__kanban-group"))
.filter(item => item !== sourceElement) as HTMLElement[];
targetGroupElement = groupElements.find(item => {
const rect = item.getBoundingClientRect();
- return event.clientX < rect.left + rect.width / 2;
+ return event.clientX <= rect.right;
}) || groupElements[groupElements.length - 1];
+ if (targetGroupElement && event.clientX > targetGroupElement.getBoundingClientRect().right) {
+ position = "right";
+ }
}
if (!targetGroupElement) {
return;
}
- const targetRect = targetGroupElement.getBoundingClientRect();
- const position = event.clientX < targetRect.left + targetRect.width / 2 ? "left" : "right";
const oldVisiblePreviousID = (sourceElement.previousElementSibling as HTMLElement)?.dataset.groupId || "";
let visiblePreviousID = position === "left" ?
(targetGroupElement.previousElementSibling as HTMLElement)?.dataset.groupId || "" :