1
0
mirror of https://github.com/bitwarden/browser synced 2024-12-25 17:32:46 +01:00

send modal state messages

This commit is contained in:
Kyle Spearrin 2019-04-02 09:29:20 -04:00
parent 52a5086f7e
commit b45c79d65b
2 changed files with 9 additions and 3 deletions

2
jslib

@ -1 +1 @@
Subproject commit 2ef1b7d65c02f7f204a0bb5a46c28aa093be274d
Subproject commit c63ff4485eb8a0ff5b4e5c8ef3c851f4ca056646

View File

@ -10,6 +10,8 @@ import {
import { ModalComponent as BaseModalComponent } from 'jslib/angular/components/modal.component';
import { Utils } from 'jslib/misc/utils';
import { MessagingService } from 'jslib/abstractions/messaging.service';
@Component({
selector: 'app-modal',
template: `<ng-template #container></ng-template>`,
@ -17,8 +19,8 @@ import { Utils } from 'jslib/misc/utils';
export class ModalComponent extends BaseModalComponent {
el: any = null;
constructor(componentFactoryResolver: ComponentFactoryResolver) {
super(componentFactoryResolver);
constructor(componentFactoryResolver: ComponentFactoryResolver, messagingService: MessagingService) {
super(componentFactoryResolver, messagingService);
}
ngOnDestroy() { /* Nothing */ }
@ -37,18 +39,22 @@ export class ModalComponent extends BaseModalComponent {
this.el.on('show.bs.modal', () => {
this.onShow.emit();
this.messagingService.send('modalShow');
});
this.el.on('shown.bs.modal', () => {
this.onShown.emit();
this.messagingService.send('modalShown');
if (!Utils.isMobileBrowser) {
this.el.find('*[appAutoFocus]').focus();
}
});
this.el.on('hide.bs.modal', () => {
this.onClose.emit();
this.messagingService.send('modalClose');
});
this.el.on('hidden.bs.modal', () => {
this.onClosed.emit();
this.messagingService.send('modalClosed');
if (this.parentContainer != null) {
this.parentContainer.clear();
}