Only reset on escape if filtered
This commit is contained in:
parent
e9b440428b
commit
f643938573
@ -604,6 +604,7 @@ describe('DocumentListComponent', () => {
|
|||||||
it('should support hotkeys', () => {
|
it('should support hotkeys', () => {
|
||||||
fixture.detectChanges()
|
fixture.detectChanges()
|
||||||
const resetSpy = jest.spyOn(component['filterEditor'], 'resetSelected')
|
const resetSpy = jest.spyOn(component['filterEditor'], 'resetSelected')
|
||||||
|
jest.spyOn(component, 'isFiltered', 'get').mockReturnValue(true)
|
||||||
component.clickTag(1)
|
component.clickTag(1)
|
||||||
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'escape' }))
|
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'escape' }))
|
||||||
expect(resetSpy).toHaveBeenCalled()
|
expect(resetSpy).toHaveBeenCalled()
|
||||||
|
@ -188,12 +188,15 @@ export class DocumentListComponent
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.hotKeyService
|
this.hotKeyService
|
||||||
.addShortcut({ keys: 'escape', description: $localize`Clear selection` })
|
.addShortcut({
|
||||||
|
keys: 'escape',
|
||||||
|
description: $localize`Reset filters / selection`,
|
||||||
|
})
|
||||||
.pipe(takeUntil(this.unsubscribeNotifier))
|
.pipe(takeUntil(this.unsubscribeNotifier))
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
if (this.list.selected.size > 0) {
|
if (this.list.selected.size > 0) {
|
||||||
this.list.selectNone()
|
this.list.selectNone()
|
||||||
} else {
|
} else if (this.isFiltered) {
|
||||||
this.filterEditor.resetSelected()
|
this.filterEditor.resetSelected()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user