mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Support keyboard esc and X button for filter editor text field
This commit is contained in:
		| @@ -11,7 +11,12 @@ | ||||
|           <select *ngIf="textFilterTarget == 'asn'" class="form-select flex-grow-0 w-auto" [(ngModel)]="textFilterModifier" (change)="textFilterModifierChange()"> | ||||
|             <option *ngFor="let m of textFilterModifiers" ngbDropdownItem [value]="m.id">{{m.label}}</option> | ||||
|           </select> | ||||
|           <input #textFilterInput class="form-control form-control-sm" type="text" [disabled]="textFilterModifierIsNull" [(ngModel)]="textFilter" (keyup.enter)="textFilterEnter()" [readonly]="textFilterTarget == 'fulltext-morelike'"> | ||||
|           <button *ngIf="_textFilter" class="btn btn-link btn-sm px-0 position-absolute top-0 end-0 z-10" (click)="resetTextField()"> | ||||
|             <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-x me-1" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> | ||||
|               <path fill-rule="evenodd" d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/> | ||||
|             </svg> | ||||
|           </button> | ||||
|           <input #textFilterInput class="form-control form-control-sm" type="text" [disabled]="textFilterModifierIsNull" [(ngModel)]="textFilter" (keyup)="textFilterKeyup($event)" [readonly]="textFilterTarget == 'fulltext-morelike'"> | ||||
|          </div> | ||||
|      </div> | ||||
|   </div> | ||||
|   | ||||
| @@ -21,3 +21,7 @@ | ||||
| input[type="text"] { | ||||
|   min-width: 120px; | ||||
| } | ||||
|  | ||||
| .z-10 { | ||||
|   z-index: 10; | ||||
| } | ||||
|   | ||||
| @@ -709,13 +709,21 @@ export class FilterEditorComponent implements OnInit, OnDestroy { | ||||
|     this.updateRules() | ||||
|   } | ||||
|  | ||||
|   textFilterEnter() { | ||||
|   textFilterKeyup(event: KeyboardEvent) { | ||||
|     if (event.key == 'Enter') { | ||||
|       const filterString = ( | ||||
|         this.textFilterInput.nativeElement as HTMLInputElement | ||||
|       ).value | ||||
|       if (filterString.length) { | ||||
|         this.updateTextFilter(filterString) | ||||
|       } | ||||
|     } else if (event.key == 'Escape') { | ||||
|       this.resetTextField() | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   resetTextField() { | ||||
|     this.updateTextFilter('') | ||||
|   } | ||||
|  | ||||
|   changeTextFilterTarget(target) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon