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 <cursoragent@cursor.com>
This commit is contained in:
1 parent
3f60901b71
commit
430108823c
2 files changed
+56
-40
No files matched your search
@@ -899,7 +899,6 @@ function EntryMark({ element, context, assignable = false, dropId = "", hot = fa
|
|||||||
<TypeGlyph name={symbol} tone="dark" />
|
<TypeGlyph name={symbol} tone="dark" />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{dropId ? <span className="assign-hit" data-assign-drop={dropId}>Ablegen</span> : null}
|
|
||||||
{url ? (
|
{url ? (
|
||||||
<span className="entry-mark__badge">
|
<span className="entry-mark__badge">
|
||||||
<TypeGlyph name="image" tone="light" size={14} />
|
<TypeGlyph name="image" tone="light" size={14} />
|
||||||
@@ -1092,7 +1091,7 @@ export function ContentBoard({
|
|||||||
window.addEventListener("keydown", onKey);
|
window.addEventListener("keydown", onKey);
|
||||||
return () => {
|
return () => {
|
||||||
window.removeEventListener("keydown", onKey);
|
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) {
|
if (carried) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
|
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 mark = event.target?.closest?.("[data-assign-drop]");
|
||||||
const useId = mark?.getAttribute("data-assign-drop") || "";
|
const useId = mark?.getAttribute("data-assign-drop") || "";
|
||||||
const blocked = !useId || useId === carried.bindingId || useId === carried.hostBindingId || carried.sourceNode?.contains(mark);
|
const blocked = !useId || useId === carried.bindingId || useId === carried.hostBindingId || carried.sourceNode?.contains(mark);
|
||||||
@@ -1167,7 +1172,7 @@ export function ContentBoard({
|
|||||||
carryRef.current = null;
|
carryRef.current = null;
|
||||||
setIndicator(null);
|
setIndicator(null);
|
||||||
setCarrying(null);
|
setCarrying(null);
|
||||||
document.body.classList.remove("is-carrying");
|
document.body.classList.remove("is-carrying", "is-assigning");
|
||||||
if (assign) placeUseRef.current?.(useId, carried);
|
if (assign) placeUseRef.current?.(useId, carried);
|
||||||
else if ((carried.source === "attachment" || carried.source === "evidence") && (section || event.target?.closest?.("[data-release-drop]"))) {
|
else if ((carried.source === "attachment" || carried.source === "evidence") && (section || event.target?.closest?.("[data-release-drop]"))) {
|
||||||
releaseRef.current?.({
|
releaseRef.current?.({
|
||||||
@@ -1589,7 +1594,24 @@ export function ContentBoard({
|
|||||||
function blockBrowserGesture(native) {
|
function blockBrowserGesture(native) {
|
||||||
native.preventDefault();
|
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) {
|
function hitAt(x, y) {
|
||||||
|
const direct = assignIdAt(x, y);
|
||||||
|
if (direct) return { useId: direct };
|
||||||
const nodes = document.elementsFromPoint(x, y);
|
const nodes = document.elementsFromPoint(x, y);
|
||||||
for (const node of nodes) {
|
for (const node of nodes) {
|
||||||
if (carried.sourceNode?.contains(node)) continue;
|
if (carried.sourceNode?.contains(node)) continue;
|
||||||
@@ -1647,10 +1669,13 @@ export function ContentBoard({
|
|||||||
function cleanup() {
|
function cleanup() {
|
||||||
window.removeEventListener("pointermove", track, true);
|
window.removeEventListener("pointermove", track, true);
|
||||||
window.removeEventListener("pointerup", finish, true);
|
window.removeEventListener("pointerup", finish, true);
|
||||||
|
window.removeEventListener("mousedown", blockBrowserGesture, true);
|
||||||
window.removeEventListener("dragstart", blockBrowserGesture, true);
|
window.removeEventListener("dragstart", blockBrowserGesture, true);
|
||||||
|
window.removeEventListener("dragend", onDragEnd, true);
|
||||||
window.removeEventListener("selectstart", blockBrowserGesture, true);
|
window.removeEventListener("selectstart", blockBrowserGesture, true);
|
||||||
|
try { carried.captureNode?.releasePointerCapture?.(carried.pointerId); } catch { /* already released */ }
|
||||||
try { carried.sourceNode?.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;
|
if (carryRef.current === carried) carryRef.current = null;
|
||||||
setCarrying(null);
|
setCarrying(null);
|
||||||
setIndicator(null);
|
setIndicator(null);
|
||||||
@@ -1706,6 +1731,14 @@ export function ContentBoard({
|
|||||||
releaseRef.current?.({ ...carried, place: carried.place, chapterId: carried.chapterId });
|
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 = () => {
|
carried.cancel = () => {
|
||||||
if (carried.settled) return;
|
if (carried.settled) return;
|
||||||
carried.settled = true;
|
carried.settled = true;
|
||||||
@@ -1713,8 +1746,13 @@ export function ContentBoard({
|
|||||||
cleanup();
|
cleanup();
|
||||||
};
|
};
|
||||||
carryRef.current = carried;
|
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("dragstart", blockBrowserGesture, true);
|
||||||
|
window.addEventListener("dragend", onDragEnd, true);
|
||||||
window.addEventListener("selectstart", blockBrowserGesture, true);
|
window.addEventListener("selectstart", blockBrowserGesture, true);
|
||||||
window.addEventListener("pointermove", track, true);
|
window.addEventListener("pointermove", track, true);
|
||||||
window.addEventListener("pointerup", finish, true);
|
window.addEventListener("pointerup", finish, true);
|
||||||
@@ -1922,14 +1960,10 @@ export function ContentBoard({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={carrying ? "contents is-carrying" : "contents"} ref={rootRef}>
|
<div className={carrying ? "contents is-carrying" : "contents"} ref={rootRef}>
|
||||||
{carrying ? (
|
{carrying && (carrying.source === "attachment" || carrying.source === "evidence") ? (
|
||||||
carrying.source === "attachment" || carrying.source === "evidence" ? (
|
<div className={indicator?.kind === "release" && !indicator.place ? "release-lane is-hot" : "release-lane"} data-release-drop="1">
|
||||||
<div className={indicator?.kind === "release" && !indicator.place ? "release-lane is-hot" : "release-lane"} data-release-drop="1">
|
{indicator?.kind === "release" && indicator.place && indicator.title ? `In ${indicator.title} legen` : "In den Vorgang legen"}
|
||||||
{indicator?.kind === "release" && indicator.place && indicator.title ? `In ${indicator.title} legen` : "In den Vorgang legen"}
|
</div>
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="release-lane">Auf das Dokument-Symbol loslassen</div>
|
|
||||||
)
|
|
||||||
) : null}
|
) : null}
|
||||||
<div className="content-toolbar">
|
<div className="content-toolbar">
|
||||||
<h2>{viewMode === "chronology" ? "Chronologie" : (activePath || listTitle || "Inhalte")} <span className="count">{shownCount}</span></h2>
|
<h2>{viewMode === "chronology" ? "Chronologie" : (activePath || listTitle || "Inhalte")} <span className="count">{shownCount}</span></h2>
|
||||||
@@ -2188,10 +2222,12 @@ export function ContentBoard({
|
|||||||
: binding.origin && !section.title
|
: binding.origin && !section.title
|
||||||
? `${binding.origin}${binding.shared ? " · weitere Einbindung" : ""}`
|
? `${binding.origin}${binding.shared ? " · weitere Einbindung" : ""}`
|
||||||
: "";
|
: "";
|
||||||
|
const assignDropId = canEdit && (!carrying || (binding.id !== carrying.bindingId && binding.id !== carrying.hostBindingId)) ? binding.id : "";
|
||||||
const rowClass = [
|
const rowClass = [
|
||||||
"preview-row",
|
"preview-row",
|
||||||
draggingId === binding.id ? "is-dragging" : "",
|
draggingId === binding.id ? "is-dragging" : "",
|
||||||
carrying && (binding.id === carrying.bindingId || binding.id === carrying.hostBindingId) ? "is-carry-source" : "",
|
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" : "",
|
selectedId === binding.id ? "is-selected" : "",
|
||||||
picking && picked.has(binding.id) ? "is-picked" : "",
|
picking && picked.has(binding.id) ? "is-picked" : "",
|
||||||
picking ? "preview-row--picking" : "",
|
picking ? "preview-row--picking" : "",
|
||||||
@@ -2269,7 +2305,7 @@ export function ContentBoard({
|
|||||||
element={element}
|
element={element}
|
||||||
context={context}
|
context={context}
|
||||||
assignable={canEdit && !pending && !picking}
|
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}
|
hot={indicator?.kind === "use" && indicator.bindingId === binding.id}
|
||||||
onAssignStart={(event) => beginCarryPointer(event, {
|
onAssignStart={(event) => beginCarryPointer(event, {
|
||||||
source: "list",
|
source: "list",
|
||||||
@@ -2314,7 +2350,7 @@ export function ContentBoard({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{(switches, lists) => (
|
{(switches, lists) => (
|
||||||
<div className="preview-row__body">
|
<div className="preview-row__body" data-assign-drop={assignDropId || undefined}>
|
||||||
<div className="preview-row__headline">
|
<div className="preview-row__headline">
|
||||||
<Link
|
<Link
|
||||||
className="preview-row__title"
|
className="preview-row__title"
|
||||||
|
|||||||
+5
-25
@@ -1363,37 +1363,17 @@ button.unit-switch[aria-expanded="true"] { color: var(--brand); }
|
|||||||
.entry-mark, .entry-mark img, .type-glyph, .preview-row__title, .preview-row__text, .use-chip__title {
|
.entry-mark, .entry-mark img, .type-glyph, .preview-row__title, .preview-row__text, .use-chip__title {
|
||||||
-webkit-user-drag: none;
|
-webkit-user-drag: none;
|
||||||
}
|
}
|
||||||
|
body.is-assigning, body.is-assigning * { user-select: none !important; }
|
||||||
|
body.is-assigning .direction-column { pointer-events: none; }
|
||||||
body.is-carrying, body.is-carrying * { user-select: none !important; cursor: grabbing; }
|
body.is-carrying, body.is-carrying * { user-select: none !important; cursor: grabbing; }
|
||||||
body.is-carrying .direction-column { pointer-events: none; }
|
body.is-carrying .direction-column { pointer-events: none; }
|
||||||
body.is-carrying .entry-mark[data-assign-drop] {
|
body.is-carrying .entry-mark[data-assign-drop] {
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
outline: 3px solid var(--accent);
|
outline: 2px solid var(--accent);
|
||||||
outline-offset: 2px;
|
outline-offset: 2px;
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
.assign-hit {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
body.is-carrying .assign-hit {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
position: absolute;
|
|
||||||
left: -4px;
|
|
||||||
top: -8px;
|
|
||||||
bottom: -8px;
|
|
||||||
width: 148px;
|
|
||||||
z-index: 3;
|
|
||||||
border-radius: 8px;
|
|
||||||
color: var(--brand);
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 700;
|
|
||||||
line-height: 16px;
|
|
||||||
padding-left: 40px;
|
|
||||||
}
|
|
||||||
.entry-mark.is-assign-hot,
|
|
||||||
body.is-carrying .entry-mark.is-assign-hot .assign-hit {
|
|
||||||
background: var(--accent-light);
|
|
||||||
}
|
}
|
||||||
|
.preview-row.is-assign-target { background: var(--accent-light); }
|
||||||
|
.entry-mark.is-assign-hot { background: var(--accent-light); }
|
||||||
.content-section.is-release-target {
|
.content-section.is-release-target {
|
||||||
background: var(--accent-light);
|
background: var(--accent-light);
|
||||||
box-shadow: inset 0 0 0 2px var(--accent);
|
box-shadow: inset 0 0 0 2px var(--accent);
|
||||||
|
|||||||
Reference in new issue
Block a user