From a9abffaddcaf78bf79710148b19c0cd7bc3d6935 Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 29 Oct 2022 00:56:48 -0700 Subject: [PATCH] Support keyboard esc and X button for filter editor text field --- .../filter-editor.component.html | 7 ++++++- .../filter-editor.component.scss | 4 ++++ .../filter-editor/filter-editor.component.ts | 20 +++++++++++++------ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.html b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.html index a101d242a..99004854c 100644 --- a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.html +++ b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.html @@ -11,7 +11,12 @@ - + + diff --git a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.scss b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.scss index 0e8796b3d..82ad7e7a5 100644 --- a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.scss +++ b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.scss @@ -21,3 +21,7 @@ input[type="text"] { min-width: 120px; } + +.z-10 { + z-index: 10; +} diff --git a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts index 14643875f..44f524149 100644 --- a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts +++ b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts @@ -709,15 +709,23 @@ export class FilterEditorComponent implements OnInit, OnDestroy { this.updateRules() } - textFilterEnter() { - const filterString = ( - this.textFilterInput.nativeElement as HTMLInputElement - ).value - if (filterString.length) { - this.updateTextFilter(filterString) + 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) { if ( this.textFilterTarget == TEXT_FILTER_TARGET_FULLTEXT_MORELIKE &&