Ziehe die ganze Zeile auf Pfeil, Punkt oder Kasten und erkenne Paperless-Anlagen im Export, damit der Drop ankommt und der Originalabruf nicht mehr fehlt.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
7e8a3e865e
commit
20fa183c1c
3 files changed
+74
-47
No files matched your search
@@ -1153,7 +1153,7 @@ def _element_public(conn, element, page: Ctx) -> dict:
|
|||||||
if element is None:
|
if element is None:
|
||||||
return {"title": "", "kind": "", "dates": {}}
|
return {"title": "", "kind": "", "dates": {}}
|
||||||
dates = _dates(conn, element["id"])
|
dates = _dates(conn, element["id"])
|
||||||
return {
|
body = {
|
||||||
"id": str(element["id"]),
|
"id": str(element["id"]),
|
||||||
"title": element["title"],
|
"title": element["title"],
|
||||||
"kind": element["kind"],
|
"kind": element["kind"],
|
||||||
@@ -1163,6 +1163,10 @@ def _element_public(conn, element, page: Ctx) -> dict:
|
|||||||
"received_on": dump_date(dates["received_on"]),
|
"received_on": dump_date(dates["received_on"]),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
source = _evidence_source(conn, element["id"])
|
||||||
|
if source:
|
||||||
|
body["external"] = {"source": source}
|
||||||
|
return body
|
||||||
|
|
||||||
|
|
||||||
def _readable_uses(conn, actor, scope: Ctx, host_id: UUID, page: Ctx) -> list[dict]:
|
def _readable_uses(conn, actor, scope: Ctx, host_id: UUID, page: Ctx) -> list[dict]:
|
||||||
|
|||||||
@@ -1531,7 +1531,7 @@ export function ContentBoard({
|
|||||||
|
|
||||||
function beginCarryPointer(event, payload) {
|
function beginCarryPointer(event, payload) {
|
||||||
if (pending || (event.button != null && event.button !== 0)) return;
|
if (pending || (event.button != null && event.button !== 0)) return;
|
||||||
if (event.target.closest("button, a, input, textarea, select")) return;
|
if (event.target.closest("button, input, textarea, select, label")) return;
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
const carried = {
|
const carried = {
|
||||||
...payload,
|
...payload,
|
||||||
@@ -1541,32 +1541,20 @@ export function ContentBoard({
|
|||||||
lastX: event.clientX,
|
lastX: event.clientX,
|
||||||
lastY: event.clientY,
|
lastY: event.clientY,
|
||||||
moved: false,
|
moved: false,
|
||||||
|
settled: false,
|
||||||
useBindingId: "",
|
useBindingId: "",
|
||||||
release: false,
|
release: false,
|
||||||
sourceNode: event.target.closest?.("[data-carry], .entry-mark") || event.target,
|
sourceNode: event.target.closest?.(".preview-row, .use-chip") || event.target,
|
||||||
};
|
};
|
||||||
function pointOf(x, y) {
|
function blockNativeDrag(native) {
|
||||||
const stack = document.elementsFromPoint(x, y);
|
native.preventDefault();
|
||||||
return stack.find((node) => node !== carried.sourceNode && !carried.sourceNode?.contains(node)) || null;
|
native.stopPropagation();
|
||||||
}
|
}
|
||||||
function track(pointer) {
|
function pointOf(x, y) {
|
||||||
if (carryRef.current !== carried || pointer.pointerId !== carried.pointerId) return;
|
return document.elementsFromPoint(x, y).find((node) => !carried.sourceNode?.contains(node)) || null;
|
||||||
if (pointer.clientX || pointer.clientY) {
|
}
|
||||||
carried.lastX = pointer.clientX;
|
function remember(x, y, sticky) {
|
||||||
carried.lastY = pointer.clientY;
|
const hit = pointOf(x, y);
|
||||||
}
|
|
||||||
if (!carried.moved && Math.hypot(pointer.clientX - carried.anchorX, pointer.clientY - carried.anchorY) > 8) {
|
|
||||||
carried.moved = true;
|
|
||||||
if (carried.sourceNode) carried.sourceNode.dataset.dragged = "1";
|
|
||||||
try {
|
|
||||||
carried.sourceNode?.setPointerCapture?.(pointer.pointerId);
|
|
||||||
} catch {
|
|
||||||
// The window listeners still follow the pointer.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!carried.moved) return;
|
|
||||||
pointer.preventDefault();
|
|
||||||
const hit = pointOf(carried.lastX, carried.lastY);
|
|
||||||
const useId = useDropId(hit);
|
const useId = useDropId(hit);
|
||||||
const ownChip = hit?.closest?.(`[data-carry="${carried.source}:${carried.elementId}"]`);
|
const ownChip = hit?.closest?.(`[data-carry="${carried.source}:${carried.elementId}"]`);
|
||||||
if (useId && useId !== carried.bindingId) {
|
if (useId && useId !== carried.bindingId) {
|
||||||
@@ -1575,44 +1563,59 @@ export function ContentBoard({
|
|||||||
setIndicator({ kind: "use", bindingId: useId });
|
setIndicator({ kind: "use", bindingId: useId });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (sticky && (carried.useBindingId || carried.release)) return;
|
||||||
carried.useBindingId = "";
|
carried.useBindingId = "";
|
||||||
const inside = Boolean(hit && rootRef.current?.contains(hit));
|
const inside = Boolean(hit && rootRef.current?.contains(hit));
|
||||||
if (inside && !ownChip && (carried.source === "attachment" || carried.source === "evidence")) {
|
carried.release = Boolean(inside && !ownChip && (carried.source === "attachment" || carried.source === "evidence"));
|
||||||
carried.release = true;
|
setIndicator(carried.release ? { kind: "release" } : null);
|
||||||
setIndicator({ kind: "release" });
|
}
|
||||||
return;
|
function track(pointer) {
|
||||||
|
if (carryRef.current !== carried || (pointer.pointerId !== carried.pointerId && pointer.pointerId !== 0)) return;
|
||||||
|
if (pointer.clientX || pointer.clientY) {
|
||||||
|
carried.lastX = pointer.clientX;
|
||||||
|
carried.lastY = pointer.clientY;
|
||||||
}
|
}
|
||||||
carried.release = false;
|
if (!carried.moved && Math.hypot(carried.lastX - carried.anchorX, carried.lastY - carried.anchorY) > 6) {
|
||||||
setIndicator(null);
|
carried.moved = true;
|
||||||
|
if (carried.sourceNode) carried.sourceNode.dataset.dragged = "1";
|
||||||
|
}
|
||||||
|
if (!carried.moved) return;
|
||||||
|
pointer.preventDefault();
|
||||||
|
remember(carried.lastX, carried.lastY, false);
|
||||||
}
|
}
|
||||||
function finish(pointer) {
|
function finish(pointer) {
|
||||||
if (pointer && pointer.pointerId !== carried.pointerId && pointer.pointerId !== 0) return;
|
if (carried.settled) return;
|
||||||
|
if (pointer && pointer.type !== "dragend" && pointer.pointerId !== carried.pointerId && pointer.pointerId !== 0) return;
|
||||||
|
carried.settled = true;
|
||||||
window.removeEventListener("pointermove", track, true);
|
window.removeEventListener("pointermove", track, true);
|
||||||
window.removeEventListener("pointerup", finish, true);
|
window.removeEventListener("pointerup", finish, true);
|
||||||
window.removeEventListener("pointercancel", finish, true);
|
window.removeEventListener("pointercancel", finish, true);
|
||||||
|
window.removeEventListener("dragend", finish, true);
|
||||||
|
window.removeEventListener("dragstart", blockNativeDrag, true);
|
||||||
if (carryRef.current !== carried) return;
|
if (carryRef.current !== carried) return;
|
||||||
carryRef.current = null;
|
carryRef.current = null;
|
||||||
setIndicator(null);
|
setIndicator(null);
|
||||||
if (!carried.moved) return;
|
if (!carried.moved) return;
|
||||||
const x = pointer && (pointer.clientX || pointer.clientY) ? pointer.clientX : carried.lastX;
|
const x = pointer && pointer.type !== "dragend" && (pointer.clientX || pointer.clientY) ? pointer.clientX : carried.lastX;
|
||||||
const y = pointer && (pointer.clientX || pointer.clientY) ? pointer.clientY : carried.lastY;
|
const y = pointer && pointer.type !== "dragend" && (pointer.clientX || pointer.clientY) ? pointer.clientY : carried.lastY;
|
||||||
const hit = pointOf(x, y);
|
remember(x, y, true);
|
||||||
const useId = (useDropId(hit) && useDropId(hit) !== carried.bindingId ? useDropId(hit) : "") || carried.useBindingId;
|
if (carried.useBindingId && carried.useBindingId !== carried.bindingId) {
|
||||||
if (useId && useId !== carried.bindingId) {
|
|
||||||
window.addEventListener("click", (click) => {
|
window.addEventListener("click", (click) => {
|
||||||
click.preventDefault();
|
click.preventDefault();
|
||||||
click.stopPropagation();
|
click.stopPropagation();
|
||||||
}, { capture: true, once: true });
|
}, { capture: true, once: true });
|
||||||
placeUseRef.current?.(useId, carried);
|
placeUseRef.current?.(carried.useBindingId, carried);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!carried.release) return;
|
if (carried.release && (carried.source === "attachment" || carried.source === "evidence")) releaseRef.current?.(carried);
|
||||||
if (carried.source === "attachment" || carried.source === "evidence") releaseRef.current?.(carried);
|
|
||||||
}
|
}
|
||||||
|
if (event.target.closest(".entry-mark")) event.preventDefault();
|
||||||
carryRef.current = carried;
|
carryRef.current = carried;
|
||||||
|
window.addEventListener("dragstart", blockNativeDrag, true);
|
||||||
window.addEventListener("pointermove", track, true);
|
window.addEventListener("pointermove", track, true);
|
||||||
window.addEventListener("pointerup", finish, true);
|
window.addEventListener("pointerup", finish, true);
|
||||||
window.addEventListener("pointercancel", finish, true);
|
window.addEventListener("pointercancel", finish, true);
|
||||||
|
window.addEventListener("dragend", finish, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindingByElement(elementId) {
|
function bindingByElement(elementId) {
|
||||||
@@ -2077,12 +2080,32 @@ export function ContentBoard({
|
|||||||
canSort && custom ? "preview-row--ordered" : "",
|
canSort && custom ? "preview-row--ordered" : "",
|
||||||
].filter(Boolean).join(" ");
|
].filter(Boolean).join(" ");
|
||||||
function openFromList(event) {
|
function openFromList(event) {
|
||||||
|
const row = event.currentTarget.closest(".preview-row");
|
||||||
|
if (row?.dataset.dragged === "1") {
|
||||||
|
delete row.dataset.dragged;
|
||||||
|
event.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!onOpen || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0) return;
|
if (!onOpen || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0) return;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
onOpen(binding);
|
onOpen(binding);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<li key={binding.id} data-binding={binding.id} className={rowClass}>
|
<li
|
||||||
|
key={binding.id}
|
||||||
|
data-binding={binding.id}
|
||||||
|
className={rowClass}
|
||||||
|
onPointerDown={(event) => {
|
||||||
|
if (!canEdit || pending || picking || event.button !== 0) return;
|
||||||
|
if (event.target.closest("button, input, textarea, select, label, .use-chip, .unit-detail")) return;
|
||||||
|
beginCarryPointer(event, {
|
||||||
|
source: "list",
|
||||||
|
elementId: element.id,
|
||||||
|
bindingId: binding.id,
|
||||||
|
title: element.title,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
{indicator?.kind === "order" && indicator?.sectionId === section.id && indicator.index === index ? <div className="insert-line" /> : null}
|
{indicator?.kind === "order" && indicator?.sectionId === section.id && indicator.index === index ? <div className="insert-line" /> : null}
|
||||||
{picking ? (
|
{picking ? (
|
||||||
<label className="pick-box">
|
<label className="pick-box">
|
||||||
@@ -2117,7 +2140,10 @@ export function ContentBoard({
|
|||||||
aria-label={`${element.title} ziehen`}
|
aria-label={`${element.title} ziehen`}
|
||||||
draggable={false}
|
draggable={false}
|
||||||
disabled={pending}
|
disabled={pending}
|
||||||
onPointerDown={(event) => beginDrag(event, { bindingId: binding.id, sectionId: section.id })}
|
onPointerDown={(event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
beginDrag(event, { bindingId: binding.id, sectionId: section.id });
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<span className="handle__grip" aria-hidden="true" />
|
<span className="handle__grip" aria-hidden="true" />
|
||||||
</button>
|
</button>
|
||||||
@@ -2127,12 +2153,6 @@ export function ContentBoard({
|
|||||||
context={context}
|
context={context}
|
||||||
dropId={canEdit ? binding.id : ""}
|
dropId={canEdit ? binding.id : ""}
|
||||||
assignable={canEdit && !pending && !picking}
|
assignable={canEdit && !pending && !picking}
|
||||||
onAssignStart={(event) => beginCarryPointer(event, {
|
|
||||||
source: "list",
|
|
||||||
elementId: element.id,
|
|
||||||
bindingId: binding.id,
|
|
||||||
title: element.title,
|
|
||||||
})}
|
|
||||||
/>
|
/>
|
||||||
<UnitDetail
|
<UnitDetail
|
||||||
binding={binding}
|
binding={binding}
|
||||||
|
|||||||
@@ -1360,6 +1360,9 @@ button.unit-switch[aria-expanded="true"] { color: var(--brand); }
|
|||||||
.use-chip__grip { width: 10px; height: 14px; border: 0; padding: 0; border-left: 2px dotted var(--text3); border-right: 2px dotted var(--text3); background: transparent; flex: none; }
|
.use-chip__grip { width: 10px; height: 14px; border: 0; padding: 0; border-left: 2px dotted var(--text3); border-right: 2px dotted var(--text3); background: transparent; flex: none; }
|
||||||
.use-chip__title { cursor: pointer; font-weight: 600; text-align: left; }
|
.use-chip__title { cursor: pointer; font-weight: 600; text-align: left; }
|
||||||
.entry-mark[role="button"] { cursor: grab; touch-action: none; }
|
.entry-mark[role="button"] { cursor: grab; touch-action: none; }
|
||||||
|
.entry-mark, .entry-mark img, .type-glyph, .preview-row__title, .preview-row__text, .use-chip__title {
|
||||||
|
-webkit-user-drag: none;
|
||||||
|
}
|
||||||
.contents.is-release-target { box-shadow: inset 0 0 0 2px var(--accent); }
|
.contents.is-release-target { box-shadow: inset 0 0 0 2px var(--accent); }
|
||||||
.release-mark {
|
.release-mark {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
|
|||||||
Reference in new issue
Block a user