mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Select first tab when switching out of mobile display
This commit is contained in:
		| @@ -1,8 +1,8 @@ | |||||||
| import { Component, OnInit } from '@angular/core'; | import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; | ||||||
| import { FormControl, FormGroup } from '@angular/forms'; | import { FormControl, FormGroup } from '@angular/forms'; | ||||||
| import { Title } from '@angular/platform-browser'; | import { Title } from '@angular/platform-browser'; | ||||||
| import { ActivatedRoute, Router } from '@angular/router'; | import { ActivatedRoute, Router } from '@angular/router'; | ||||||
| import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; | import { NgbModal, NgbNav } from '@ng-bootstrap/ng-bootstrap'; | ||||||
| import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'; | import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent'; | ||||||
| import { PaperlessDocument } from 'src/app/data/paperless-document'; | import { PaperlessDocument } from 'src/app/data/paperless-document'; | ||||||
| import { PaperlessDocumentMetadata } from 'src/app/data/paperless-document-metadata'; | import { PaperlessDocumentMetadata } from 'src/app/data/paperless-document-metadata'; | ||||||
| @@ -48,8 +48,17 @@ export class DocumentDetailComponent implements OnInit { | |||||||
|     tags: new FormControl([]) |     tags: new FormControl([]) | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|  |   @ViewChild('nav') nav: NgbNav | ||||||
|  |   @ViewChild('pdfPreview') set pdfPreview(element): void { | ||||||
|  |     // this gets called when compontent added or removed from DOM | ||||||
|  |     if (element && element.nativeElement.offsetParent !== null) { // its visible | ||||||
|  |  | ||||||
|  |       setTimeout(()=> this.nav?.select(1)); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|   constructor( |   constructor( | ||||||
|     private documentsService: DocumentService,  |     private documentsService: DocumentService, | ||||||
|     private route: ActivatedRoute, |     private route: ActivatedRoute, | ||||||
|     private correspondentService: CorrespondentService, |     private correspondentService: CorrespondentService, | ||||||
|     private documentTypeService: DocumentTypeService, |     private documentTypeService: DocumentTypeService, | ||||||
| @@ -128,7 +137,7 @@ export class DocumentDetailComponent implements OnInit { | |||||||
|     }, error => {this.router.navigate(['404'])}) |     }, error => {this.router.navigate(['404'])}) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   save() {     |   save() { | ||||||
|     this.documentsService.update(this.document).subscribe(result => { |     this.documentsService.update(this.document).subscribe(result => { | ||||||
|       this.close() |       this.close() | ||||||
|     }) |     }) | ||||||
| @@ -160,7 +169,7 @@ export class DocumentDetailComponent implements OnInit { | |||||||
|     modal.componentInstance.message2 = `The files for this document will be deleted permanently. This operation cannot be undone.` |     modal.componentInstance.message2 = `The files for this document will be deleted permanently. This operation cannot be undone.` | ||||||
|     modal.componentInstance.deleteClicked.subscribe(() => { |     modal.componentInstance.deleteClicked.subscribe(() => { | ||||||
|       this.documentsService.delete(this.document).subscribe(() => { |       this.documentsService.delete(this.document).subscribe(() => { | ||||||
|         modal.close()   |         modal.close() | ||||||
|         this.close() |         this.close() | ||||||
|       }) |       }) | ||||||
|     }) |     }) | ||||||
| @@ -170,4 +179,14 @@ export class DocumentDetailComponent implements OnInit { | |||||||
|   hasNext() { |   hasNext() { | ||||||
|     return this.documentListViewService.hasNext(this.documentId) |     return this.documentListViewService.hasNext(this.documentId) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   previewCreated() { | ||||||
|  |     console.log('Preview Created'); | ||||||
|  |  | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   mobilePreviewCreated() { | ||||||
|  |     console.log('Mobile Preview Created'); | ||||||
|  |  | ||||||
|  |   } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon