mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-11 10:00:48 -05:00
Merge pull request #442 from paperless-ngx/fix-allow-shorter-search
Allow shorter search strings with Enter key
This commit is contained in:
commit
81cfd13b4a
@ -8,7 +8,7 @@
|
|||||||
<button *ngFor="let t of textFilterTargets" ngbDropdownItem [class.active]="textFilterTarget == t.id" (click)="changeTextFilterTarget(t.id)">{{t.name}}</button>
|
<button *ngFor="let t of textFilterTargets" ngbDropdownItem [class.active]="textFilterTarget == t.id" (click)="changeTextFilterTarget(t.id)">{{t.name}}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input #textFilterInput class="form-control form-control-sm" type="text" [(ngModel)]="textFilter" [readonly]="textFilterTarget == 'fulltext-morelike'">
|
<input #textFilterInput class="form-control form-control-sm" type="text" [(ngModel)]="textFilter" (keyup.enter)="textFilterEnter()" [readonly]="textFilterTarget == 'fulltext-morelike'">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -427,11 +427,7 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
|
|||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
filter((query) => !query.length || query.length > 2)
|
filter((query) => !query.length || query.length > 2)
|
||||||
)
|
)
|
||||||
.subscribe((text) => {
|
.subscribe((text) => this.updateTextFilter(text))
|
||||||
this._textFilter = text
|
|
||||||
this.documentService.searchQuery = text
|
|
||||||
this.updateRules()
|
|
||||||
})
|
|
||||||
|
|
||||||
if (this._textFilter) this.documentService.searchQuery = this._textFilter
|
if (this._textFilter) this.documentService.searchQuery = this._textFilter
|
||||||
}
|
}
|
||||||
@ -476,6 +472,21 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
|
|||||||
this.documentTypeSelectionModel.apply()
|
this.documentTypeSelectionModel.apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateTextFilter(text) {
|
||||||
|
this._textFilter = text
|
||||||
|
this.documentService.searchQuery = text
|
||||||
|
this.updateRules()
|
||||||
|
}
|
||||||
|
|
||||||
|
textFilterEnter() {
|
||||||
|
const filterString = (
|
||||||
|
this.textFilterInput.nativeElement as HTMLInputElement
|
||||||
|
).value
|
||||||
|
if (filterString.length) {
|
||||||
|
this.updateTextFilter(filterString)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
changeTextFilterTarget(target) {
|
changeTextFilterTarget(target) {
|
||||||
if (
|
if (
|
||||||
this.textFilterTarget == TEXT_FILTER_TARGET_FULLTEXT_MORELIKE &&
|
this.textFilterTarget == TEXT_FILTER_TARGET_FULLTEXT_MORELIKE &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user