From 430108823c33f1295970f709388c133822c0ea84 Mon Sep 17 00:00:00 2001 From: Lars Date: Sun, 18 Oct 2026 13:59:02 +0200 Subject: [PATCH] Nimm dem Browser den Zug am Dokumenttitel weg, damit ein Dokument im Vorgang auf ein anderes als Anlage oder Beleg ankommt. Co-authored-by: Cursor --- frontend/src/pages/content.jsx | 66 ++++++++++++++++++++++++++-------- frontend/src/styles.css | 30 +++------------- 2 files changed, 56 insertions(+), 40 deletions(-) diff --git a/frontend/src/pages/content.jsx b/frontend/src/pages/content.jsx index 33a43bd..9e3eac2 100644 --- a/frontend/src/pages/content.jsx +++ b/frontend/src/pages/content.jsx @@ -899,7 +899,6 @@ function EntryMark({ element, context, assignable = false, dropId = "", hot = fa )} - {dropId ? Ablegen : null} {url ? ( @@ -1092,7 +1091,7 @@ export function ContentBoard({ window.addEventListener("keydown", onKey); return () => { window.removeEventListener("keydown", onKey); - document.body.classList.remove("is-carrying"); + document.body.classList.remove("is-carrying", "is-assigning"); }; }, []); @@ -1104,6 +1103,12 @@ export function ContentBoard({ if (carried) { event.preventDefault(); if (event.dataTransfer) event.dataTransfer.dropEffect = "move"; + if (event.clientX || event.clientY) { + carried.lastX = event.clientX; + carried.lastY = event.clientY; + carried.moved = true; + document.body.classList.add("is-carrying"); + } const mark = event.target?.closest?.("[data-assign-drop]"); const useId = mark?.getAttribute("data-assign-drop") || ""; const blocked = !useId || useId === carried.bindingId || useId === carried.hostBindingId || carried.sourceNode?.contains(mark); @@ -1167,7 +1172,7 @@ export function ContentBoard({ carryRef.current = null; setIndicator(null); setCarrying(null); - document.body.classList.remove("is-carrying"); + document.body.classList.remove("is-carrying", "is-assigning"); if (assign) placeUseRef.current?.(useId, carried); else if ((carried.source === "attachment" || carried.source === "evidence") && (section || event.target?.closest?.("[data-release-drop]"))) { releaseRef.current?.({ @@ -1589,7 +1594,24 @@ export function ContentBoard({ function blockBrowserGesture(native) { native.preventDefault(); } + function assignIdAt(x, y) { + const root = rootRef.current; + if (!root) return ""; + const marks = root.querySelectorAll("[data-assign-drop]"); + for (const mark of marks) { + if (carried.sourceNode?.contains(mark)) continue; + const rect = mark.getBoundingClientRect(); + if (rect.width < 1 || rect.height < 1) continue; + if (x < rect.left || x > rect.right || y < rect.top || y > rect.bottom) continue; + const useId = mark.getAttribute("data-assign-drop") || ""; + if (!useId || useId === carried.bindingId || useId === carried.hostBindingId) continue; + return useId; + } + return ""; + } function hitAt(x, y) { + const direct = assignIdAt(x, y); + if (direct) return { useId: direct }; const nodes = document.elementsFromPoint(x, y); for (const node of nodes) { if (carried.sourceNode?.contains(node)) continue; @@ -1647,10 +1669,13 @@ export function ContentBoard({ function cleanup() { window.removeEventListener("pointermove", track, true); window.removeEventListener("pointerup", finish, true); + window.removeEventListener("mousedown", blockBrowserGesture, true); window.removeEventListener("dragstart", blockBrowserGesture, true); + window.removeEventListener("dragend", onDragEnd, true); window.removeEventListener("selectstart", blockBrowserGesture, true); + try { carried.captureNode?.releasePointerCapture?.(carried.pointerId); } catch { /* already released */ } try { carried.sourceNode?.releasePointerCapture?.(carried.pointerId); } catch { /* already released */ } - document.body.classList.remove("is-carrying"); + document.body.classList.remove("is-carrying", "is-assigning"); if (carryRef.current === carried) carryRef.current = null; setCarrying(null); setIndicator(null); @@ -1706,6 +1731,14 @@ export function ContentBoard({ releaseRef.current?.({ ...carried, place: carried.place, chapterId: carried.chapterId }); } } + function onDragEnd() { + if (carried.settled) { + cleanup(); + return; + } + if (!carried.moved) return; + finish({ pointerId: carried.pointerId, clientX: carried.lastX, clientY: carried.lastY }); + } carried.cancel = () => { if (carried.settled) return; carried.settled = true; @@ -1713,8 +1746,13 @@ export function ContentBoard({ cleanup(); }; carryRef.current = carried; - try { carried.sourceNode?.setPointerCapture?.(event.pointerId); } catch { /* the window listeners still follow the pointer */ } + const captureNode = event.target?.nodeType === 1 ? event.target : event.target?.parentElement; + carried.captureNode = captureNode || null; + try { captureNode?.setPointerCapture?.(event.pointerId); } catch { /* the window listeners still follow the pointer */ } + document.body.classList.add("is-assigning"); + window.addEventListener("mousedown", blockBrowserGesture, true); window.addEventListener("dragstart", blockBrowserGesture, true); + window.addEventListener("dragend", onDragEnd, true); window.addEventListener("selectstart", blockBrowserGesture, true); window.addEventListener("pointermove", track, true); window.addEventListener("pointerup", finish, true); @@ -1922,14 +1960,10 @@ export function ContentBoard({ return (
- {carrying ? ( - carrying.source === "attachment" || carrying.source === "evidence" ? ( -
- {indicator?.kind === "release" && indicator.place && indicator.title ? `In ${indicator.title} legen` : "In den Vorgang legen"} -
- ) : ( -
Auf das Dokument-Symbol loslassen
- ) + {carrying && (carrying.source === "attachment" || carrying.source === "evidence") ? ( +
+ {indicator?.kind === "release" && indicator.place && indicator.title ? `In ${indicator.title} legen` : "In den Vorgang legen"} +
) : null}

{viewMode === "chronology" ? "Chronologie" : (activePath || listTitle || "Inhalte")} {shownCount}

@@ -2188,10 +2222,12 @@ export function ContentBoard({ : binding.origin && !section.title ? `${binding.origin}${binding.shared ? " ยท weitere Einbindung" : ""}` : ""; + const assignDropId = canEdit && (!carrying || (binding.id !== carrying.bindingId && binding.id !== carrying.hostBindingId)) ? binding.id : ""; const rowClass = [ "preview-row", draggingId === binding.id ? "is-dragging" : "", carrying && (binding.id === carrying.bindingId || binding.id === carrying.hostBindingId) ? "is-carry-source" : "", + indicator?.kind === "use" && indicator.bindingId === binding.id ? "is-assign-target" : "", selectedId === binding.id ? "is-selected" : "", picking && picked.has(binding.id) ? "is-picked" : "", picking ? "preview-row--picking" : "", @@ -2269,7 +2305,7 @@ export function ContentBoard({ element={element} context={context} assignable={canEdit && !pending && !picking} - dropId={canEdit && (!carrying || (binding.id !== carrying.bindingId && binding.id !== carrying.hostBindingId)) ? binding.id : ""} + dropId={assignDropId} hot={indicator?.kind === "use" && indicator.bindingId === binding.id} onAssignStart={(event) => beginCarryPointer(event, { source: "list", @@ -2314,7 +2350,7 @@ export function ContentBoard({ }} > {(switches, lists) => ( -
+