mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Merge branch 'dev' into feature-bulk-edit
This commit is contained in:
		| @@ -14,7 +14,6 @@ import { LogsComponent } from './components/manage/logs/logs.component'; | ||||
| import { SettingsComponent } from './components/manage/settings/settings.component'; | ||||
| import { FormsModule, ReactiveFormsModule } from '@angular/forms'; | ||||
| import { DatePipe } from '@angular/common'; | ||||
| import { SafePipe } from './pipes/safe.pipe'; | ||||
| import { NotFoundComponent } from './components/not-found/not-found.component'; | ||||
| import { CorrespondentListComponent } from './components/manage/correspondent-list/correspondent-list.component'; | ||||
| import { DeleteDialogComponent } from './components/common/delete-dialog/delete-dialog.component'; | ||||
| @@ -45,6 +44,7 @@ import { SavedViewWidgetComponent } from './components/dashboard/widgets/saved-v | ||||
| import { StatisticsWidgetComponent } from './components/dashboard/widgets/statistics-widget/statistics-widget.component'; | ||||
| import { UploadFileWidgetComponent } from './components/dashboard/widgets/upload-file-widget/upload-file-widget.component'; | ||||
| import { WidgetFrameComponent } from './components/dashboard/widgets/widget-frame/widget-frame.component'; | ||||
| import { PdfViewerModule } from 'ng2-pdf-viewer'; | ||||
| import { WelcomeWidgetComponent } from './components/dashboard/widgets/welcome-widget/welcome-widget.component'; | ||||
| import { YesNoPipe } from './pipes/yes-no.pipe'; | ||||
| import { FileSizePipe } from './pipes/file-size.pipe'; | ||||
| @@ -62,7 +62,6 @@ import { SelectDialogComponent } from './components/common/select-dialog/select- | ||||
|     DocumentTypeListComponent, | ||||
|     LogsComponent, | ||||
|     SettingsComponent, | ||||
|     SafePipe, | ||||
|     NotFoundComponent, | ||||
|     CorrespondentEditDialogComponent, | ||||
|     DeleteDialogComponent, | ||||
| @@ -102,7 +101,8 @@ import { SelectDialogComponent } from './components/common/select-dialog/select- | ||||
|     FormsModule, | ||||
|     ReactiveFormsModule, | ||||
|     NgxFileDropModule, | ||||
|     InfiniteScrollModule | ||||
|     InfiniteScrollModule, | ||||
|     PdfViewerModule | ||||
|   ], | ||||
|   providers: [ | ||||
|     DatePipe, | ||||
|   | ||||
| @@ -35,7 +35,7 @@ | ||||
|  | ||||
|  | ||||
| <div class="row"> | ||||
|     <div class="col-xl"> | ||||
|     <div class="col mb-4"> | ||||
|  | ||||
|         <form [formGroup]='documentForm' (ngSubmit)="save()"> | ||||
|  | ||||
| @@ -171,11 +171,9 @@ | ||||
|         </form> | ||||
|     </div> | ||||
|  | ||||
|     <div class="col-xl d-none d-xl-block document-preview"> | ||||
|         <object [data]="previewUrl | safe" type="application/pdf" width="100%" height="100%"> | ||||
|             <p>Your browser does not support PDFs. | ||||
|                 <a href="previewUrl">Download the PDF</a>.</p> | ||||
|         </object> | ||||
|  | ||||
|     <div class="col-md-6 col-xl-8 mb-3"> | ||||
|       <div class="pdf-viewer-container" *ngIf="getContentType() == 'application/pdf'"> | ||||
|         <pdf-viewer [src]="previewUrl" [original-size]="false" [show-borders]="true"></pdf-viewer> | ||||
|       </div> | ||||
|     </div> | ||||
| </div> | ||||
| </div> | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| .document-preview { | ||||
|   height: calc(100vh - 180px); | ||||
| .pdf-viewer-container { | ||||
|   height: calc(100vh - 160px); | ||||
|   top: 70px; | ||||
|   position: sticky; | ||||
| } | ||||
|   background-color: gray; | ||||
| } | ||||
|   | ||||
| @@ -59,6 +59,10 @@ export class DocumentDetailComponent implements OnInit { | ||||
|     private documentListViewService: DocumentListViewService, | ||||
|     private titleService: Title) { } | ||||
|  | ||||
|   getContentType() { | ||||
|     return this.metadata?.has_archive_version ? 'application/pdf' : this.metadata?.original_mime_type | ||||
|   } | ||||
|  | ||||
|   ngOnInit(): void { | ||||
|     this.documentForm.valueChanges.subscribe(wow => { | ||||
|       Object.assign(this.document, this.documentForm.value) | ||||
|   | ||||
| @@ -1,8 +0,0 @@ | ||||
| import { SafePipe } from './safe.pipe'; | ||||
|  | ||||
| describe('SafePipe', () => { | ||||
|   it('create an instance', () => { | ||||
|     const pipe = new SafePipe(); | ||||
|     expect(pipe).toBeTruthy(); | ||||
|   }); | ||||
| }); | ||||
| @@ -1,19 +0,0 @@ | ||||
| import { Pipe, PipeTransform } from '@angular/core'; | ||||
| import { DomSanitizer } from '@angular/platform-browser'; | ||||
|  | ||||
| @Pipe({ | ||||
|   name: 'safe' | ||||
| }) | ||||
| export class SafePipe implements PipeTransform { | ||||
|  | ||||
|   constructor(private sanitizer: DomSanitizer) { } | ||||
|  | ||||
|   transform(url) { | ||||
|     if (url == null) { | ||||
|       return this.sanitizer.bypassSecurityTrustResourceUrl("") | ||||
|     } else { | ||||
|       return this.sanitizer.bypassSecurityTrustResourceUrl(url); | ||||
|     } | ||||
|   } | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 jonaswinkler
					jonaswinkler