fix
This commit is contained in:
@@ -5274,6 +5274,7 @@ const AppLayout = () => {
|
|||||||
previewActive,
|
previewActive,
|
||||||
previewWorkspaceDocument,
|
previewWorkspaceDocument,
|
||||||
previewWorkspaceEntry,
|
previewWorkspaceEntry,
|
||||||
|
previewDocumentId,
|
||||||
closeDocumentPreview,
|
closeDocumentPreview,
|
||||||
handleThumbnailRegeneration,
|
handleThumbnailRegeneration,
|
||||||
documentsTableProps,
|
documentsTableProps,
|
||||||
@@ -5334,6 +5335,7 @@ const AppLayout = () => {
|
|||||||
previewActive,
|
previewActive,
|
||||||
previewWorkspaceDocument,
|
previewWorkspaceDocument,
|
||||||
previewWorkspaceEntry,
|
previewWorkspaceEntry,
|
||||||
|
previewDocumentId,
|
||||||
closeDocumentPreview,
|
closeDocumentPreview,
|
||||||
handleThumbnailRegeneration,
|
handleThumbnailRegeneration,
|
||||||
documentsTableProps,
|
documentsTableProps,
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ const DocumentsRoute = () => {
|
|||||||
openCorrespondentsModal,
|
openCorrespondentsModal,
|
||||||
previewWorkspaceDocument,
|
previewWorkspaceDocument,
|
||||||
previewWorkspaceEntry,
|
previewWorkspaceEntry,
|
||||||
|
previewDocumentId,
|
||||||
closeDocumentPreview,
|
closeDocumentPreview,
|
||||||
handleThumbnailRegeneration,
|
handleThumbnailRegeneration,
|
||||||
ensurePreviewData,
|
ensurePreviewData,
|
||||||
@@ -78,6 +79,7 @@ const DocumentsRoute = () => {
|
|||||||
deskWorkspaceProps,
|
deskWorkspaceProps,
|
||||||
previewWorkspaceDocument,
|
previewWorkspaceDocument,
|
||||||
previewWorkspaceEntry,
|
previewWorkspaceEntry,
|
||||||
|
previewDocumentId,
|
||||||
ensureAssetUrl,
|
ensureAssetUrl,
|
||||||
ensurePreviewData,
|
ensurePreviewData,
|
||||||
getDocumentAsset,
|
getDocumentAsset,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ export const useWorkspaceSurface = ({
|
|||||||
deskWorkspaceProps,
|
deskWorkspaceProps,
|
||||||
previewWorkspaceDocument,
|
previewWorkspaceDocument,
|
||||||
previewWorkspaceEntry,
|
previewWorkspaceEntry,
|
||||||
|
previewDocumentId,
|
||||||
ensureAssetUrl,
|
ensureAssetUrl,
|
||||||
ensurePreviewData,
|
ensurePreviewData,
|
||||||
getDocumentAsset,
|
getDocumentAsset,
|
||||||
@@ -62,10 +63,10 @@ export const useWorkspaceSurface = ({
|
|||||||
detailPanelOpen,
|
detailPanelOpen,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const showPreviewWorkspace = viewMode !== 'desk' && Boolean(previewWorkspaceDocument);
|
const showPreviewWorkspace = Boolean(previewDocumentId);
|
||||||
|
|
||||||
const previewSurface = useMemo(() => {
|
const previewSurface = useMemo(() => {
|
||||||
if (!showPreviewWorkspace || !previewWorkspaceDocument) {
|
if (!showPreviewWorkspace) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const detailExtras = detailPanelProps || {};
|
const detailExtras = detailPanelProps || {};
|
||||||
@@ -83,6 +84,7 @@ export const useWorkspaceSurface = ({
|
|||||||
onFolderNavigate,
|
onFolderNavigate,
|
||||||
} = detailExtras;
|
} = detailExtras;
|
||||||
return createPreviewSurface({
|
return createPreviewSurface({
|
||||||
|
documentId: previewDocumentId,
|
||||||
document: previewWorkspaceDocument,
|
document: previewWorkspaceDocument,
|
||||||
previewEntry: previewWorkspaceEntry,
|
previewEntry: previewWorkspaceEntry,
|
||||||
ensureAssetUrl,
|
ensureAssetUrl,
|
||||||
@@ -108,6 +110,7 @@ export const useWorkspaceSurface = ({
|
|||||||
}, [
|
}, [
|
||||||
showPreviewWorkspace,
|
showPreviewWorkspace,
|
||||||
previewWorkspaceDocument,
|
previewWorkspaceDocument,
|
||||||
|
previewDocumentId,
|
||||||
previewWorkspaceEntry,
|
previewWorkspaceEntry,
|
||||||
ensureAssetUrl,
|
ensureAssetUrl,
|
||||||
ensurePreviewData,
|
ensurePreviewData,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ const formatDateTime = (value) => {
|
|||||||
|
|
||||||
const PreviewWorkspace = ({
|
const PreviewWorkspace = ({
|
||||||
document,
|
document,
|
||||||
|
documentId,
|
||||||
previewEntry,
|
previewEntry,
|
||||||
tagLookupById,
|
tagLookupById,
|
||||||
tagOptions,
|
tagOptions,
|
||||||
@@ -73,7 +74,18 @@ const PreviewWorkspace = ({
|
|||||||
}, [document]);
|
}, [document]);
|
||||||
|
|
||||||
if (!document) {
|
if (!document) {
|
||||||
return null;
|
return (
|
||||||
|
<section className="preview-workspace preview-workspace--loading">
|
||||||
|
<div className="preview-workspace__details">
|
||||||
|
<div className="preview-workspace__message">
|
||||||
|
Loading document{documentId ? ` ${documentId}` : ''}…
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="preview-workspace__viewer">
|
||||||
|
<div className="preview-workspace__message">Preparing preview…</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -193,6 +205,7 @@ export const createPreviewWorkspaceHeaderActions = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const createPreviewSurface = ({
|
export const createPreviewSurface = ({
|
||||||
|
documentId,
|
||||||
document,
|
document,
|
||||||
previewEntry,
|
previewEntry,
|
||||||
ensureAssetUrl,
|
ensureAssetUrl,
|
||||||
@@ -215,11 +228,11 @@ export const createPreviewSurface = ({
|
|||||||
resolveFolderPath,
|
resolveFolderPath,
|
||||||
onFolderNavigate,
|
onFolderNavigate,
|
||||||
}) => {
|
}) => {
|
||||||
if (!document) {
|
if (!documentId && !document) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const title = document.title;
|
const title = document?.title || 'Document preview';
|
||||||
const closeButton = onClose
|
const closeButton = onClose
|
||||||
? (
|
? (
|
||||||
<button
|
<button
|
||||||
@@ -264,6 +277,7 @@ export const createPreviewSurface = ({
|
|||||||
content: (
|
content: (
|
||||||
<PreviewWorkspace
|
<PreviewWorkspace
|
||||||
document={document}
|
document={document}
|
||||||
|
documentId={documentId}
|
||||||
previewEntry={previewEntry}
|
previewEntry={previewEntry}
|
||||||
tagLookupById={tagLookupById}
|
tagLookupById={tagLookupById}
|
||||||
tagOptions={tagOptions}
|
tagOptions={tagOptions}
|
||||||
|
|||||||
Reference in New Issue
Block a user