Add select page shortcut key

This commit is contained in:
shamoon 2024-04-07 16:06:26 -07:00
parent f643938573
commit 57b129de41
2 changed files with 11 additions and 0 deletions

View File

@ -620,6 +620,10 @@ describe('DocumentListComponent', () => {
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'a' }))
expect(selectAllSpy).toHaveBeenCalled()
const selectPageSpy = jest.spyOn(documentListService, 'selectPage')
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'p' }))
expect(selectPageSpy).toHaveBeenCalled()
jest.spyOn(documentListService, 'documents', 'get').mockReturnValue(docs)
fixture.detectChanges()
const detailSpy = jest.spyOn(component, 'openDocumentDetail')

View File

@ -208,6 +208,13 @@ export class DocumentListComponent
this.list.selectAll()
})
this.hotKeyService
.addShortcut({ keys: 'p', description: $localize`Select page` })
.pipe(takeUntil(this.unsubscribeNotifier))
.subscribe(() => {
this.list.selectPage()
})
this.hotKeyService
.addShortcut({ keys: 'o', description: $localize`Open first document` })
.pipe(takeUntil(this.unsubscribeNotifier))