cleanup
This commit is contained in:
@@ -39,6 +39,11 @@ interface DocumentLike {
|
||||
version_number?: number;
|
||||
version?: { content_type?: string | null } | null;
|
||||
} | null;
|
||||
previewEntry?: {
|
||||
url: string;
|
||||
alt?: string;
|
||||
contentType?: string | null;
|
||||
} | null;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
@@ -53,10 +58,8 @@ interface DocumentViewerPanelProps extends DocumentSummarySectionProps {
|
||||
document: DocumentLike | null;
|
||||
previewEntry?: {
|
||||
url?: string;
|
||||
canGoPrev?: boolean;
|
||||
canGoNext?: boolean;
|
||||
goPrev?: () => void;
|
||||
goNext?: () => void;
|
||||
contentType?: string | null;
|
||||
filename?: string | null;
|
||||
} | null;
|
||||
hydrateDocument?: (doc: DocumentLike | null) => DocumentLike | null;
|
||||
ensureAssetUrl?: (docId: string | number, asset: AssetLike, options?: { start?: number; limit?: number }) => Promise<unknown>;
|
||||
@@ -490,10 +493,16 @@ const DocumentViewerPanel: React.FC<DocumentViewerPanelProps> = ({
|
||||
document?.title || 'Document preview'
|
||||
);
|
||||
|
||||
const overlayDocument = useMemo(() => (
|
||||
document && zoomDisplay?.url
|
||||
? { ...document, previewEntry: zoomDisplay }
|
||||
: document
|
||||
), [document, zoomDisplay]);
|
||||
|
||||
const overlay = (
|
||||
<PreviewZoomOverlay
|
||||
open={Boolean(zoomOverlayOpen && zoomDisplay)}
|
||||
display={zoomDisplay}
|
||||
document={overlayDocument}
|
||||
onClose={handleZoomClose}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -90,7 +90,6 @@ const PdfViewer = ({ src, title, className, viewportRef }: PdfViewerProps): JSX.
|
||||
pointerOffsetX: number;
|
||||
pointerOffsetY: number;
|
||||
} | null>(null);
|
||||
const focusRatioRef = useRef<{ x: number; y: number } | null>(null);
|
||||
const ensureWasmUrl = useCallback(() => {
|
||||
if (!wasmUrlRef.current) {
|
||||
wasmUrlRef.current = resolvePdfWasmBaseUrl();
|
||||
@@ -221,7 +220,6 @@ const PdfViewer = ({ src, title, className, viewportRef }: PdfViewerProps): JSX.
|
||||
try {
|
||||
loadingTask = getDocument({
|
||||
url: src,
|
||||
withCredentials: true,
|
||||
wasmUrl,
|
||||
});
|
||||
const pdf = await loadingTask.promise;
|
||||
|
||||
Reference in New Issue
Block a user