diff --git a/src-ui/src/app/components/document-detail/document-detail.component.html b/src-ui/src/app/components/document-detail/document-detail.component.html index 7b21d4b50..0eff363f4 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.html +++ b/src-ui/src/app/components/document-detail/document-detail.component.html @@ -207,8 +207,8 @@ - - + + diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts index 599ae8523..c9e98f030 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.ts @@ -81,7 +81,7 @@ export class DocumentDetailComponent title: string titleSubject: Subject = new Subject() previewUrl: string - _previewHtml: string + previewText: string downloadUrl: string downloadOriginalUrl: string @@ -164,6 +164,12 @@ export class DocumentDetailComponent : this.metadata?.original_mime_type } + get renderAsPlainText(): boolean { + return ['text/plain', 'application/csv', 'text/csv'].includes( + this.getContentType() + ) + } + get isRTL() { if (!this.metadata || !this.metadata.lang) return false else { @@ -220,10 +226,10 @@ export class DocumentDetailComponent this.previewUrl = this.documentsService.getPreviewUrl(this.documentId) this.http.get(this.previewUrl, { responseType: 'text' }).subscribe({ next: (res) => { - this._previewHtml = res.toString() + this.previewText = res.toString() }, error: (err) => { - this._previewHtml = $localize`An error occurred loading content: ${ + this.previewText = $localize`An error occurred loading content: ${ err.message ?? err.toString() }` }, @@ -752,8 +758,4 @@ export class DocumentDetailComponent ) ) } - - get previewHtml(): string { - return this._previewHtml - } }