From 84cf9d6536b0e7eb75cec22bc69a11937b7c47b1 Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 10 Mar 2022 13:58:38 -0500 Subject: added prop when thumbnail is shown for a document so componentView can choose not to render. fixed pdf views to not generate gray box when first transitioning from thumb to live view. --- src/.DS_Store | Bin 8196 -> 8196 bytes src/client/views/nodes/DocumentView.tsx | 16 +++++++++++++--- src/client/views/nodes/PDFBox.tsx | 12 ++++++++++-- src/client/views/nodes/WebBox.tsx | 2 +- src/server/server_Initialization.ts | 2 +- 5 files changed, 25 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/.DS_Store b/src/.DS_Store index 9ca6c8d2b..b0987293b 100644 Binary files a/src/.DS_Store and b/src/.DS_Store differ diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 274ccb807..7092b335c 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -109,6 +109,7 @@ export interface DocumentViewSharedProps { fitContentsToDoc?: () => boolean; // used by freeformview to fit its contents to its panel. corresponds to _fitToBox property on a Document ContainingCollectionView: Opt; ContainingCollectionDoc: Opt; + thumbShown?: () => boolean; setContentView?: (view: DocComponentView) => any; CollectionFreeFormDocumentView?: () => CollectionFreeFormDocumentView; PanelWidth: () => number; @@ -838,6 +839,9 @@ export class DocumentViewInternal extends DocComponent !this.props.isSelected() && LightboxView.LightboxDoc !== this.rootDoc && this.thumb && + !this._componentView?.isAnyChildContentActive?.() ? true : false; @computed get contents() { TraceMobx(); const audioView = !this.layoutDoc._showAudio ? (null) : @@ -851,11 +855,17 @@ export class DocumentViewInternal extends DocComponent - {!this.thumb ? (null) : + {!this._retryThumb || !this.thumbShown() ? (null) : () { @@ -38,6 +39,7 @@ export class PDFBox extends ViewBoxAnnotatableComponent 600) ? NumCast(this.Document._height) * this.props.PanelWidth() / NumCast(this.Document._width) : undefined }}> @@ -303,7 +306,12 @@ export class PDFBox extends ViewBoxAnnotatableComponent>(); render() { TraceMobx(); - if (this._pdf) return this.renderPdfView; + if (this._pdf) { + if (!this.props.thumbShown?.()) { + return this.renderPdfView; + } + return null; + } const href = this.pdfUrl?.url.href; if (href) { diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx index 563cc462a..91f7d97d7 100644 --- a/src/client/views/nodes/WebBox.tsx +++ b/src/client/views/nodes/WebBox.tsx @@ -705,7 +705,7 @@ export class WebBox extends ViewBoxAnnotatableComponent; return (
+ style={{ pointerEvents: this.pointerEvents(), display: this.props.thumbShown?.() ? "none" : undefined }} >
{ res.locals.user = req.user; - if ((req.originalUrl.endsWith(".png") /*|| req.originalUrl.endsWith(".js")*/) && req.method === 'GET') { + if ((req.originalUrl.endsWith(".png") /*|| req.originalUrl.endsWith(".js")*/) && req.method === 'GET' && (res as any)._contentLength) { const period = 30000; res.set('Cache-control', `public, max-age=${period}`); } else { -- cgit v1.2.3-70-g09d2