mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Inline plaintext document previews for complete styling
This commit is contained in:
		@@ -2706,43 +2706,54 @@
 | 
			
		||||
          <context context-type="linenumber">195</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="2218903673684131427" datatype="html">
 | 
			
		||||
        <source>An error occurred loading content: <x id="PH" equiv-text="err.message ?? err.toString()"/></source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">228</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="5758784066858623886" datatype="html">
 | 
			
		||||
        <source>Error retrieving metadata</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">341</context>
 | 
			
		||||
          <context context-type="linenumber">354</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="2374084708811774419" datatype="html">
 | 
			
		||||
        <source>Error retrieving suggestions</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">361</context>
 | 
			
		||||
          <context context-type="linenumber">374</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="8348337312757497317" datatype="html">
 | 
			
		||||
        <source>Document saved successfully.</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">478</context>
 | 
			
		||||
          <context context-type="linenumber">484</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">492</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="448882439049417053" datatype="html">
 | 
			
		||||
        <source>Error saving document</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">483</context>
 | 
			
		||||
          <context context-type="linenumber">497</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">528</context>
 | 
			
		||||
          <context context-type="linenumber">542</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="9021887951960049161" datatype="html">
 | 
			
		||||
        <source>Confirm delete</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">557</context>
 | 
			
		||||
          <context context-type="linenumber">571</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/manage/management-list/management-list.component.ts</context>
 | 
			
		||||
@@ -2753,35 +2764,35 @@
 | 
			
		||||
        <source>Do you really want to delete document "<x id="PH" equiv-text="this.document.title"/>"?</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">558</context>
 | 
			
		||||
          <context context-type="linenumber">572</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="6691075929777935948" datatype="html">
 | 
			
		||||
        <source>The files for this document will be deleted permanently. This operation cannot be undone.</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">559</context>
 | 
			
		||||
          <context context-type="linenumber">573</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="719892092227206532" datatype="html">
 | 
			
		||||
        <source>Delete document</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">561</context>
 | 
			
		||||
          <context context-type="linenumber">575</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="1844801255494293730" datatype="html">
 | 
			
		||||
        <source>Error deleting document: <x id="PH" equiv-text="JSON.stringify(error)"/></source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">577</context>
 | 
			
		||||
          <context context-type="linenumber">591</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="7362691899087997122" datatype="html">
 | 
			
		||||
        <source>Redo OCR confirm</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">597</context>
 | 
			
		||||
          <context context-type="linenumber">611</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>
 | 
			
		||||
@@ -2792,14 +2803,14 @@
 | 
			
		||||
        <source>This operation will permanently redo OCR for this document.</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">598</context>
 | 
			
		||||
          <context context-type="linenumber">612</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="5641451190833696892" datatype="html">
 | 
			
		||||
        <source>This operation cannot be undone.</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">599</context>
 | 
			
		||||
          <context context-type="linenumber">613</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>
 | 
			
		||||
@@ -2830,7 +2841,7 @@
 | 
			
		||||
        <source>Proceed</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">601</context>
 | 
			
		||||
          <context context-type="linenumber">615</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-list/bulk-editor/bulk-editor.component.ts</context>
 | 
			
		||||
@@ -2857,7 +2868,7 @@
 | 
			
		||||
        <source>Redo OCR operation will begin in the background. Close and re-open or reload this document after the operation has completed to see new content.</source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">609</context>
 | 
			
		||||
          <context context-type="linenumber">623</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="8008978164775353960" datatype="html">
 | 
			
		||||
@@ -2866,7 +2877,7 @@
 | 
			
		||||
              )"/></source>
 | 
			
		||||
        <context-group purpose="location">
 | 
			
		||||
          <context context-type="sourcefile">src/app/components/document-detail/document-detail.component.ts</context>
 | 
			
		||||
          <context context-type="linenumber">620,622</context>
 | 
			
		||||
          <context context-type="linenumber">634,636</context>
 | 
			
		||||
        </context-group>
 | 
			
		||||
      </trans-unit>
 | 
			
		||||
      <trans-unit id="6857598786757174736" datatype="html">
 | 
			
		||||
 
 | 
			
		||||
@@ -208,7 +208,7 @@
 | 
			
		||||
            </ng-template>
 | 
			
		||||
        </ng-container>
 | 
			
		||||
        <ng-container *ngIf="getContentType() === 'text/plain'">
 | 
			
		||||
            <object [data]="previewUrl | safeUrl" type="text/plain" class="preview-sticky bg-white" width="100%"></object>
 | 
			
		||||
            <div [innerHTML]="previewHtml | safeHtml" class="preview-sticky bg-light p-3" width="100%"></div>
 | 
			
		||||
        </ng-container>
 | 
			
		||||
        <div *ngIf="requiresPassword" class="password-prompt">
 | 
			
		||||
            <form>
 | 
			
		||||
 
 | 
			
		||||
@@ -43,6 +43,7 @@ import {
 | 
			
		||||
import { PaperlessUser } from 'src/app/data/paperless-user'
 | 
			
		||||
import { UserService } from 'src/app/services/rest/user.service'
 | 
			
		||||
import { PaperlessDocumentNote } from 'src/app/data/paperless-document-note'
 | 
			
		||||
import { HttpClient } from '@angular/common/http'
 | 
			
		||||
 | 
			
		||||
enum DocumentDetailNavIDs {
 | 
			
		||||
  Details = 1,
 | 
			
		||||
@@ -80,6 +81,7 @@ export class DocumentDetailComponent
 | 
			
		||||
  title: string
 | 
			
		||||
  titleSubject: Subject<string> = new Subject()
 | 
			
		||||
  previewUrl: string
 | 
			
		||||
  _previewHtml: string
 | 
			
		||||
  downloadUrl: string
 | 
			
		||||
  downloadOriginalUrl: string
 | 
			
		||||
 | 
			
		||||
@@ -144,7 +146,8 @@ export class DocumentDetailComponent
 | 
			
		||||
    private settings: SettingsService,
 | 
			
		||||
    private storagePathService: StoragePathService,
 | 
			
		||||
    private permissionsService: PermissionsService,
 | 
			
		||||
    private userService: UserService
 | 
			
		||||
    private userService: UserService,
 | 
			
		||||
    private http: HttpClient
 | 
			
		||||
  ) {}
 | 
			
		||||
 | 
			
		||||
  titleKeyUp(event) {
 | 
			
		||||
@@ -215,6 +218,16 @@ export class DocumentDetailComponent
 | 
			
		||||
        switchMap((doc) => {
 | 
			
		||||
          this.documentId = doc.id
 | 
			
		||||
          this.previewUrl = this.documentsService.getPreviewUrl(this.documentId)
 | 
			
		||||
          this.http.get(this.previewUrl, { responseType: 'text' }).subscribe({
 | 
			
		||||
            next: (res) => {
 | 
			
		||||
              this._previewHtml = res.toString()
 | 
			
		||||
            },
 | 
			
		||||
            error: (err) => {
 | 
			
		||||
              this._previewHtml = $localize`An error occurred loading content: ${
 | 
			
		||||
                err.message ?? err.toString()
 | 
			
		||||
              }`
 | 
			
		||||
            },
 | 
			
		||||
          })
 | 
			
		||||
          this.downloadUrl = this.documentsService.getDownloadUrl(
 | 
			
		||||
            this.documentId
 | 
			
		||||
          )
 | 
			
		||||
@@ -706,4 +719,8 @@ export class DocumentDetailComponent
 | 
			
		||||
      )
 | 
			
		||||
    )
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  get previewHtml(): string {
 | 
			
		||||
    return this._previewHtml
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -246,10 +246,6 @@ $form-check-radio-checked-bg-image-dark: url("data:image/svg+xml,<svg xmlns='htt
 | 
			
		||||
      background-color: rgb(var(--bs-dark-rgb)) !important;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .preview-sticky.bg-white {
 | 
			
		||||
    background-color: var(--pngx-bg-darker) !important;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
body.color-scheme-dark {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user