Skip to content

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

:bug: Balance kanban group drop target detection https://github.com/siyuan-note/siyuan/issues/16325

Daniel45b959a84933
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index 43c4f705a6..0735222236 100644
--- a/app/src/protyle/util/editorCommonEvent.ts
+++ b/app/src/protyle/util/editorCommonEvent.ts
@@ -2226,7 +2226,6 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
clearKanbanGroupDragover();
return;
}
- let position: "left" | "right" = "left";
if (!targetGroupElement) {
const sourceRect = sourceElement.getBoundingClientRect();
if (event.clientX >= sourceRect.left && event.clientX <= sourceRect.right) {
@@ -2237,16 +2236,15 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
.filter(item => item !== sourceElement) as HTMLElement[];
targetGroupElement = groupElements.find(item => {
const rect = item.getBoundingClientRect();
- return event.clientX <= rect.right;
+ return event.clientX < rect.left + rect.width / 2;
}) || groupElements[groupElements.length - 1];
- if (targetGroupElement && event.clientX > targetGroupElement.getBoundingClientRect().right) {
- position = "right";
- }
}
if (!targetGroupElement) {
clearKanbanGroupDragover();
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 || "" :