mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-26 03:36:08 -05:00 
			
		
		
		
	Check for live changes on document detail title
This commit is contained in:
		| @@ -56,7 +56,7 @@ | |||||||
|                     <a ngbNavLink i18n>Details</a> |                     <a ngbNavLink i18n>Details</a> | ||||||
|                     <ng-template ngbNavContent> |                     <ng-template ngbNavContent> | ||||||
|  |  | ||||||
|                         <app-input-text #inputTitle i18n-title title="Title" formControlName="title" [error]="error?.title"></app-input-text> |                         <app-input-text #inputTitle i18n-title title="Title" formControlName="title" (keyup)="titleKeyUp($event)" [error]="error?.title"></app-input-text> | ||||||
|                         <app-input-number i18n-title title="Archive serial number" [error]="error?.archive_serial_number" formControlName='archive_serial_number'></app-input-number> |                         <app-input-number i18n-title title="Archive serial number" [error]="error?.archive_serial_number" formControlName='archive_serial_number'></app-input-number> | ||||||
|                         <app-input-date i18n-title title="Date created" formControlName="created" [error]="error?.created"></app-input-date> |                         <app-input-date i18n-title title="Date created" formControlName="created" [error]="error?.created"></app-input-date> | ||||||
|                         <app-input-select [items]="correspondents" i18n-title title="Correspondent" formControlName="correspondent" [allowNull]="true" |                         <app-input-select [items]="correspondents" i18n-title title="Correspondent" formControlName="correspondent" [allowNull]="true" | ||||||
|   | |||||||
| @@ -21,7 +21,7 @@ import { TextComponent } from '../common/input/text/text.component'; | |||||||
| import { SettingsService, SETTINGS_KEYS } from 'src/app/services/settings.service'; | import { SettingsService, SETTINGS_KEYS } from 'src/app/services/settings.service'; | ||||||
| import { dirtyCheck, DirtyComponent } from '@ngneat/dirty-check-forms'; | import { dirtyCheck, DirtyComponent } from '@ngneat/dirty-check-forms'; | ||||||
| import { Observable, Subject, BehaviorSubject } from 'rxjs'; | import { Observable, Subject, BehaviorSubject } from 'rxjs'; | ||||||
| import { first, takeUntil, switchMap, map } from 'rxjs/operators'; | import { first, takeUntil, switchMap, map, debounceTime, distinctUntilChanged } from 'rxjs/operators'; | ||||||
| import { PaperlessDocumentSuggestions } from 'src/app/data/paperless-document-suggestions'; | import { PaperlessDocumentSuggestions } from 'src/app/data/paperless-document-suggestions'; | ||||||
| import { FILTER_FULLTEXT_MORELIKE } from 'src/app/data/filter-rule-type'; | import { FILTER_FULLTEXT_MORELIKE } from 'src/app/data/filter-rule-type'; | ||||||
|  |  | ||||||
| @@ -48,6 +48,7 @@ export class DocumentDetailComponent implements OnInit, OnDestroy, DirtyComponen | |||||||
|   suggestions: PaperlessDocumentSuggestions |   suggestions: PaperlessDocumentSuggestions | ||||||
|  |  | ||||||
|   title: string |   title: string | ||||||
|  |   titleSubject: Subject<string> = new Subject() | ||||||
|   previewUrl: string |   previewUrl: string | ||||||
|   downloadUrl: string |   downloadUrl: string | ||||||
|   downloadOriginalUrl: string |   downloadOriginalUrl: string | ||||||
| @@ -91,7 +92,19 @@ export class DocumentDetailComponent implements OnInit, OnDestroy, DirtyComponen | |||||||
|     private documentListViewService: DocumentListViewService, |     private documentListViewService: DocumentListViewService, | ||||||
|     private documentTitlePipe: DocumentTitlePipe, |     private documentTitlePipe: DocumentTitlePipe, | ||||||
|     private toastService: ToastService, |     private toastService: ToastService, | ||||||
|     private settings: SettingsService) { } |     private settings: SettingsService) { | ||||||
|  |       this.titleSubject.pipe( | ||||||
|  |         debounceTime(200), | ||||||
|  |         distinctUntilChanged(), | ||||||
|  |         takeUntil(this.unsubscribeNotifier) | ||||||
|  |       ).subscribe(titleValue => { | ||||||
|  |         this.documentForm.patchValue({'title': titleValue}) | ||||||
|  |       }) | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   titleKeyUp(event) { | ||||||
|  |     this.titleSubject.next(event.target?.value) | ||||||
|  |   } | ||||||
|  |  | ||||||
|   get useNativePdfViewer(): boolean { |   get useNativePdfViewer(): boolean { | ||||||
|     return this.settings.get(SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER) |     return this.settings.get(SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon