A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Fix: fix Enter selection in search autocomplete (#13361)
shamoona68c487d604d
diff --git a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.tsindex 7cc8f3638..1cf05b781 100644--- a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts+++ b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts@@ -2269,4 +2269,34 @@ describe('FilterEditorComponent', () => {component.itemSelected({ item: 'world', preventDefault: () => true })expect(component.textFilter).toEqual('hello world ')})++ it('should choose the active autocomplete item with Enter', () => {+ component.textFilterTarget = 'fulltext-query'+ jest+ .spyOn(searchService, 'autocomplete')+ .mockReturnValue(of(['hello', 'help']))++ const input = component.textFilterInput.nativeElement as HTMLInputElement+ input.value = 'he'+ input.dispatchEvent(new Event('input'))+ tick(250)++ input.dispatchEvent(+ new KeyboardEvent('keydown', {+ key: 'ArrowDown',+ bubbles: true,+ cancelable: true,+ })+ )+ input.dispatchEvent(+ new KeyboardEvent('keydown', {+ key: 'Enter',+ bubbles: true,+ cancelable: true,+ })+ )+ fixture.detectChanges()++ expect(component.textFilter).toEqual('help ')+ })})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.tsindex 5566f9ecd..d747002b2 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@@ -1314,6 +1314,10 @@ export class FilterEditorComponenttextFilterKeydown(event: KeyboardEvent) {if (event.key == 'Enter') {+ if (event.defaultPrevented) {+ // NgbTypeahead calls preventDefault, so use that to detect if the Enter key was for the dropdown+ return+ }const filterString = (this.textFilterInput.nativeElement as HTMLInputElement).value