content disposition

This commit is contained in:
2025-11-02 02:26:40 +01:00
parent b9c95437d2
commit b561f46d2c
6 changed files with 53 additions and 48 deletions
+1 -21
View File
@@ -6,7 +6,6 @@ import {
ChevronsRightIcon,
AnalyzeIcon,
WindowMaximizeIcon,
TextScanIcon,
} from '../ui/icons';
import PanelHeader from '../ui/PanelHeader';
import { formatFileSize } from '../utils/format';
@@ -169,7 +168,7 @@ const DetailPanel = ({
[selectedDocuments],
);
const { downloadHref: singleDownloadHref, hasOcr: singleHasOcr, openOcr } = useMemo(
const { downloadHref: singleDownloadHref } = useMemo(
() =>
createDocumentActionState({
document: singleDoc,
@@ -851,7 +850,6 @@ const DetailPanel = ({
};
const isBulkSelection = selectedCount > 1;
const showOcrAction = Boolean(singleDoc && singleHasOcr);
const headerLeading = [
(
@@ -924,24 +922,6 @@ const DetailPanel = ({
);
}
if (showOcrAction) {
headerActions.push(
<button
key="ocr"
type="button"
className="icon-button"
onClick={(event) => {
event.stopPropagation();
openOcr().catch(() => {});
}}
aria-label="View OCR text"
title="View OCR text"
>
<TextScanIcon />
</button>,
);
}
if (singleDoc) {
headerActions.push(
<button
+8 -1
View File
@@ -270,13 +270,20 @@ const DocumentsPanel = ({
}
if (entry.type === EntryType.folder) {
const hasModifier = Boolean(
event && (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey),
);
const isPrimaryClick = Boolean(event && event.type === 'click' && event.button === 0);
if (!hasModifier && isPrimaryClick && typeof onFolderSelect === 'function') {
onFolderSelect(entry.id);
}
if (scrollRef.current) {
scrollRef.current.focus({ preventScroll: true });
}
onFocusedRowChange?.(rowKey);
}
},
[onRowSelection, onOpenDetailPanel, onFocusedRowChange],
[onRowSelection, onOpenDetailPanel, onFocusedRowChange, onFolderSelect],
);
const handleDocumentClick = useCallback(
+4 -17
View File
@@ -1,5 +1,5 @@
import React, { useEffect, useMemo, useState } from 'react';
import { DownloadIcon, TextScanIcon, AnalyzeIcon, CloseIcon } from '../ui/icons';
import { DownloadIcon, AnalyzeIcon, CloseIcon } from '../ui/icons';
import DocumentSummarySection, {
buildCorrespondentOptions,
sortCorrespondents,
@@ -249,9 +249,9 @@ const DocumentViewerPanel = ({
{ocrError}
</div>
) : ocrUrl ? (
<embed
<iframe
src={ocrUrl}
type="text/plain"
title={`OCR content for ${document.title || document.original_name || 'document'}`}
className="document-viewer__object document-viewer__object--ocr"
/>
) : (
@@ -293,7 +293,7 @@ export const createDocumentViewerHeaderActions = ({
return null;
}
const { downloadHref, hasOcr, openOcr } = actionState;
const { downloadHref } = actionState;
return (
<>
@@ -309,19 +309,6 @@ export const createDocumentViewerHeaderActions = ({
<DownloadIcon />
</a>
) : null}
{hasOcr ? (
<button
type="button"
className="icon-button"
onClick={() => {
openOcr().catch(() => {});
}}
aria-label="View OCR text"
title="View OCR text"
>
<TextScanIcon />
</button>
) : null}
<button
type="button"
className="icon-button"