mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Enhancement: save & next / close shortcut key (#8243)
This commit is contained in:
		@@ -1221,6 +1221,14 @@ describe('DocumentDetailComponent', () => {
 | 
			
		||||
    )
 | 
			
		||||
    expect(saveSpy).toHaveBeenCalled()
 | 
			
		||||
 | 
			
		||||
    jest.spyOn(openDocumentsService, 'isDirty').mockReturnValue(true)
 | 
			
		||||
    jest.spyOn(component, 'hasNext').mockReturnValue(true)
 | 
			
		||||
    const saveNextSpy = jest.spyOn(component, 'saveEditNext')
 | 
			
		||||
    document.dispatchEvent(
 | 
			
		||||
      new KeyboardEvent('keydown', { key: 's', ctrlKey: true, shiftKey: true })
 | 
			
		||||
    )
 | 
			
		||||
    expect(saveNextSpy).toHaveBeenCalled()
 | 
			
		||||
 | 
			
		||||
    const closeSpy = jest.spyOn(component, 'close')
 | 
			
		||||
    document.dispatchEvent(new KeyboardEvent('keydown', { key: 'escape' }))
 | 
			
		||||
    expect(closeSpy).toHaveBeenCalled()
 | 
			
		||||
 
 | 
			
		||||
@@ -509,6 +509,16 @@ export class DocumentDetailComponent
 | 
			
		||||
      .subscribe(() => {
 | 
			
		||||
        if (this.openDocumentService.isDirty(this.document)) this.save()
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
    this.hotKeyService
 | 
			
		||||
      .addShortcut({
 | 
			
		||||
        keys: 'control.shift.s',
 | 
			
		||||
        description: $localize`Save and close / next`,
 | 
			
		||||
      })
 | 
			
		||||
      .pipe(takeUntil(this.unsubscribeNotifier))
 | 
			
		||||
      .subscribe(() => {
 | 
			
		||||
        if (this.openDocumentService.isDirty(this.document)) this.saveEditNext()
 | 
			
		||||
      })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnDestroy(): void {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user