mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Merge pull request #860 from shamoon/feature/issue-858
Suppport search term PDF open parameter
This commit is contained in:
		@@ -290,8 +290,12 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
 | 
			
		||||
      distinctUntilChanged()
 | 
			
		||||
    ).subscribe(text => {
 | 
			
		||||
      this._textFilter = text
 | 
			
		||||
      this.documentService.searchQuery = text
 | 
			
		||||
      this.updateRules()
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    if (this._textFilter) this.documentService.searchQuery = this._textFilter
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnDestroy() {
 | 
			
		||||
 
 | 
			
		||||
@@ -39,6 +39,8 @@ export interface SelectionData {
 | 
			
		||||
})
 | 
			
		||||
export class DocumentService extends AbstractPaperlessService<PaperlessDocument> {
 | 
			
		||||
 | 
			
		||||
  private _searchQuery: string
 | 
			
		||||
 | 
			
		||||
  constructor(http: HttpClient, private correspondentService: CorrespondentService, private documentTypeService: DocumentTypeService, private tagService: TagService) {
 | 
			
		||||
    super(http, 'documents')
 | 
			
		||||
  }
 | 
			
		||||
@@ -92,6 +94,7 @@ export class DocumentService extends AbstractPaperlessService<PaperlessDocument>
 | 
			
		||||
 | 
			
		||||
  getPreviewUrl(id: number, original: boolean = false): string {
 | 
			
		||||
    let url = this.getResourceUrl(id, 'preview')
 | 
			
		||||
    if (this._searchQuery) url += `#search="${this._searchQuery}"`
 | 
			
		||||
    if (original) {
 | 
			
		||||
      url += "?original=true"
 | 
			
		||||
    }
 | 
			
		||||
@@ -138,4 +141,8 @@ export class DocumentService extends AbstractPaperlessService<PaperlessDocument>
 | 
			
		||||
    return this.http.post(this.getResourceUrl(null, 'bulk_download'), {"documents": ids, "content": content}, { responseType: 'blob' })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public set searchQuery(query: string) {
 | 
			
		||||
    this._searchQuery = query
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user