1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-24 12:06:15 +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 { ModalComponent as BaseModalComponent } from 'jslib/angular/components/modal.component';
import { Utils } from 'jslib/misc/utils'; import { Utils } from 'jslib/misc/utils';
import { MessagingService } from 'jslib/abstractions/messaging.service';
@Component({ @Component({
selector: 'app-modal', selector: 'app-modal',
template: `<ng-template #container></ng-template>`, template: `<ng-template #container></ng-template>`,
@ -17,8 +19,8 @@ import { Utils } from 'jslib/misc/utils';
export class ModalComponent extends BaseModalComponent { export class ModalComponent extends BaseModalComponent {
el: any = null; el: any = null;
constructor(componentFactoryResolver: ComponentFactoryResolver) { constructor(componentFactoryResolver: ComponentFactoryResolver, messagingService: MessagingService) {
super(componentFactoryResolver); super(componentFactoryResolver, messagingService);
} }
ngOnDestroy() { /* Nothing */ } ngOnDestroy() { /* Nothing */ }
@ -37,18 +39,22 @@ export class ModalComponent extends BaseModalComponent {
this.el.on('show.bs.modal', () => { this.el.on('show.bs.modal', () => {
this.onShow.emit(); this.onShow.emit();
this.messagingService.send('modalShow');
}); });
this.el.on('shown.bs.modal', () => { this.el.on('shown.bs.modal', () => {
this.onShown.emit(); this.onShown.emit();
this.messagingService.send('modalShown');
if (!Utils.isMobileBrowser) { if (!Utils.isMobileBrowser) {
this.el.find('*[appAutoFocus]').focus(); this.el.find('*[appAutoFocus]').focus();
} }
}); });
this.el.on('hide.bs.modal', () => { this.el.on('hide.bs.modal', () => {
this.onClose.emit(); this.onClose.emit();
this.messagingService.send('modalClose');
}); });
this.el.on('hidden.bs.modal', () => { this.el.on('hidden.bs.modal', () => {
this.onClosed.emit(); this.onClosed.emit();
this.messagingService.send('modalClosed');
if (this.parentContainer != null) { if (this.parentContainer != null) {
this.parentContainer.clear(); this.parentContainer.clear();
} }