mirror of
https://github.com/bitwarden/web
synced 2025-12-12 22:33:23 +00:00
send modal state messages
This commit is contained in:
2
jslib
2
jslib
Submodule jslib updated: 2ef1b7d65c...c63ff4485e
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user