This commit is contained in:
2025-11-07 23:48:25 +01:00
parent 8dd6be2a5d
commit 4bc7357e41
7 changed files with 77 additions and 38 deletions
+20 -16
View File
@@ -204,6 +204,9 @@ const DocumentsPanel = ({
const handleDocumentActivate = useCallback(
(doc, event) => {
if (!doc) {
return;
}
if (event) {
if (typeof event.preventDefault === 'function') {
event.preventDefault();
@@ -212,9 +215,13 @@ const DocumentsPanel = ({
event.stopPropagation();
}
}
handleDocumentPreviewZoom(doc);
if (event?.altKey) {
handleDocumentPreviewZoom(doc);
return;
}
onInspectDocument?.(doc.id, event);
},
[handleDocumentPreviewZoom],
[handleDocumentPreviewZoom, onInspectDocument],
);
const selectedRowKeySet = useMemo(() => new Set(selectedEntries || []), [selectedEntries]);
@@ -318,8 +325,7 @@ const DocumentsPanel = ({
} else {
const entry = getEntryByKey(activeRow.key);
if (entry?.document) {
handleDocumentActivate(entry.document, event);
onInspectDocument?.(entry.document.id, event);
handleDocumentPreviewZoom(entry.document);
}
}
}
@@ -355,14 +361,13 @@ const DocumentsPanel = ({
[
focusedRowKey,
getEntryByKey,
handleDocumentActivate,
navigableRowKeys,
navigableRows,
onEntrySelection,
onFocusedRowChange,
onFolderSelect,
onInspectDocument,
selectedEntries,
handleDocumentPreviewZoom,
],
);
@@ -500,16 +505,8 @@ const DocumentsPanel = ({
event,
);
}
if (
typeof onInspectDocument === 'function'
&& !isPointerModifierEvent(event)
&& isPrimaryPointerEvent(event)
) {
onInspectDocument(doc.id, event);
}
},
[onEntryPointer, onInspectDocument],
[onEntryPointer],
);
const handleFolderClick = useCallback(
@@ -980,6 +977,7 @@ export const createDocumentsSurface = ({
onMoveDocumentsToFolder,
searchIncludeDescendants,
onToggleSearchIncludeDescendants,
onInspectDocument,
} = tableProps;
const title = Array.isArray(searchResults) ? 'Search results' : currentFolderName;
@@ -1044,7 +1042,13 @@ export const createDocumentsSurface = ({
breadcrumbs,
selectionLabel: null,
floatingActions,
content: <DocumentsPanel {...tableProps} showHeader={false} />,
content: (
<DocumentsPanel
{...tableProps}
showHeader={false}
onInspectDocument={onInspectDocument}
/>
),
detail,
});