mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-05 11:39:29 -05:00

update ngx-file-drop Update ng-bootstrap, ng-select, cookie-service and ui-tour Update setup-jest.ts bump typescript to 5.1.6 bump ngx-color and tslib
20 lines
470 B
TypeScript
20 lines
470 B
TypeScript
import { Injectable } from '@angular/core'
|
|
import { Observable } from 'rxjs'
|
|
|
|
export interface ComponentCanDeactivate {
|
|
canDeactivate: () => boolean | Observable<boolean>
|
|
}
|
|
|
|
@Injectable()
|
|
export class DirtyDocGuard {
|
|
canDeactivate(
|
|
component: ComponentCanDeactivate
|
|
): boolean | Observable<boolean> {
|
|
return component.canDeactivate()
|
|
? true
|
|
: confirm(
|
|
$localize`Warning: You have unsaved changes to your document(s).`
|
|
)
|
|
}
|
|
}
|