Schalte die übrigen Dokumente als Droppunkt ein, sobald ein Dokument im Vorgang gezogen wird.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
430108823c
commit
0c611763c3
2 files changed
+47
-6
No files matched your search
@@ -957,6 +957,7 @@ export function ContentBoard({
|
|||||||
const [pickTarget, setPickTarget] = useState("");
|
const [pickTarget, setPickTarget] = useState("");
|
||||||
const dragRef = useRef(null);
|
const dragRef = useRef(null);
|
||||||
const carryRef = useRef(null);
|
const carryRef = useRef(null);
|
||||||
|
const armListCarryRef = useRef(null);
|
||||||
const releaseRef = useRef(null);
|
const releaseRef = useRef(null);
|
||||||
const placeUseRef = useRef(null);
|
const placeUseRef = useRef(null);
|
||||||
const rootRef = useRef(null);
|
const rootRef = useRef(null);
|
||||||
@@ -1188,9 +1189,27 @@ export function ContentBoard({
|
|||||||
place(event);
|
place(event);
|
||||||
finishDragRef.current(drag);
|
finishDragRef.current(drag);
|
||||||
}
|
}
|
||||||
|
function rowTarget(event) {
|
||||||
|
const target = event.target?.nodeType === 1 ? event.target : event.target?.parentElement;
|
||||||
|
if (!target?.closest?.("li.preview-row")) return null;
|
||||||
|
if (target.closest("button, input, textarea, select, label, .direction-column, .preview-row__actions, .handle, .row-menu")) return null;
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
function onPointerDownCapture(event) {
|
||||||
|
if (!rowTarget(event)) return;
|
||||||
|
armListCarryRef.current?.(event);
|
||||||
|
}
|
||||||
|
function blockRowMouseDown(event) {
|
||||||
|
if (event.button !== 0 || !rowTarget(event)) return;
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
node.addEventListener("pointerdown", onPointerDownCapture, true);
|
||||||
|
node.addEventListener("mousedown", blockRowMouseDown, true);
|
||||||
node.addEventListener("dragover", place);
|
node.addEventListener("dragover", place);
|
||||||
node.addEventListener("drop", drop);
|
node.addEventListener("drop", drop);
|
||||||
return () => {
|
return () => {
|
||||||
|
node.removeEventListener("pointerdown", onPointerDownCapture, true);
|
||||||
|
node.removeEventListener("mousedown", blockRowMouseDown, true);
|
||||||
node.removeEventListener("dragover", place);
|
node.removeEventListener("dragover", place);
|
||||||
node.removeEventListener("drop", drop);
|
node.removeEventListener("drop", drop);
|
||||||
};
|
};
|
||||||
@@ -1573,11 +1592,12 @@ export function ContentBoard({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function beginCarryPointer(event, payload) {
|
function beginCarryPointer(event, payload) {
|
||||||
if (pending || (event.button != null && event.button !== 0)) return;
|
if (carryRef.current || pending || (event.button != null && event.button !== 0)) return;
|
||||||
if (event.target.closest("button, input, textarea, select, label")) return;
|
const target = event.target?.nodeType === 1 ? event.target : event.target?.parentElement;
|
||||||
|
if (!target?.closest || target.closest("button, input, textarea, select, label")) return;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
const opener = event.target.closest?.("a.preview-row__title, a.preview-row__text, .use-chip__title");
|
const opener = target.closest("a.preview-row__title, a.preview-row__text, .use-chip__title");
|
||||||
const carried = {
|
const carried = {
|
||||||
...payload,
|
...payload,
|
||||||
pointerId: event.pointerId,
|
pointerId: event.pointerId,
|
||||||
@@ -1589,7 +1609,7 @@ export function ContentBoard({
|
|||||||
settled: false,
|
settled: false,
|
||||||
useBindingId: "",
|
useBindingId: "",
|
||||||
release: false,
|
release: false,
|
||||||
sourceNode: event.target.closest?.(".preview-row, .use-chip") || event.target,
|
sourceNode: target.closest(".preview-row, .use-chip") || target,
|
||||||
};
|
};
|
||||||
function blockBrowserGesture(native) {
|
function blockBrowserGesture(native) {
|
||||||
native.preventDefault();
|
native.preventDefault();
|
||||||
@@ -1746,7 +1766,7 @@ export function ContentBoard({
|
|||||||
cleanup();
|
cleanup();
|
||||||
};
|
};
|
||||||
carryRef.current = carried;
|
carryRef.current = carried;
|
||||||
const captureNode = event.target?.nodeType === 1 ? event.target : event.target?.parentElement;
|
const captureNode = target;
|
||||||
carried.captureNode = captureNode || null;
|
carried.captureNode = captureNode || null;
|
||||||
try { captureNode?.setPointerCapture?.(event.pointerId); } catch { /* the window listeners still follow the pointer */ }
|
try { captureNode?.setPointerCapture?.(event.pointerId); } catch { /* the window listeners still follow the pointer */ }
|
||||||
document.body.classList.add("is-assigning");
|
document.body.classList.add("is-assigning");
|
||||||
@@ -1758,6 +1778,22 @@ export function ContentBoard({
|
|||||||
window.addEventListener("pointerup", finish, true);
|
window.addEventListener("pointerup", finish, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
armListCarryRef.current = (event) => {
|
||||||
|
if (carryRef.current || !canEdit || pending || picking) return;
|
||||||
|
const target = event.target?.nodeType === 1 ? event.target : event.target?.parentElement;
|
||||||
|
const row = target?.closest?.("li.preview-row");
|
||||||
|
if (!row) return;
|
||||||
|
if (target.closest(".use-chip, .unit-detail")) return;
|
||||||
|
const binding = source.find((item) => item.id === row.getAttribute("data-binding"));
|
||||||
|
if (!binding?.element) return;
|
||||||
|
beginCarryPointer(event, {
|
||||||
|
source: "list",
|
||||||
|
elementId: binding.element.id,
|
||||||
|
bindingId: binding.id,
|
||||||
|
title: binding.element.title,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function bindingByElement(elementId) {
|
function bindingByElement(elementId) {
|
||||||
return source.find((item) => item.element?.id === elementId) || null;
|
return source.find((item) => item.element?.id === elementId) || null;
|
||||||
}
|
}
|
||||||
@@ -1959,7 +1995,7 @@ export function ContentBoard({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={carrying ? "contents is-carrying" : "contents"} ref={rootRef}>
|
<div className={carrying ? `contents is-carrying${carrying.source === "list" ? " is-list-carry" : ""}` : "contents"} ref={rootRef}>
|
||||||
{carrying && (carrying.source === "attachment" || carrying.source === "evidence") ? (
|
{carrying && (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"}
|
||||||
|
|||||||
@@ -1372,8 +1372,13 @@ body.is-carrying .entry-mark[data-assign-drop] {
|
|||||||
outline: 2px solid var(--accent);
|
outline: 2px solid var(--accent);
|
||||||
outline-offset: 2px;
|
outline-offset: 2px;
|
||||||
}
|
}
|
||||||
|
.contents.is-list-carry .preview-row:not(.is-carry-source) .entry-mark[data-assign-drop],
|
||||||
|
.contents.is-list-carry .preview-row:not(.is-carry-source) .preview-row__body[data-assign-drop] {
|
||||||
|
box-shadow: inset 0 0 0 2px var(--accent);
|
||||||
|
}
|
||||||
.preview-row.is-assign-target { background: var(--accent-light); }
|
.preview-row.is-assign-target { background: var(--accent-light); }
|
||||||
.entry-mark.is-assign-hot { background: var(--accent-light); }
|
.entry-mark.is-assign-hot { background: var(--accent-light); }
|
||||||
|
.preview-row__title, .preview-row__text { touch-action: none; }
|
||||||
.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