/
githubmirror
/
tabby
Обзор
Документация
Войти
/
githubmirror
/
tabby
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tabby-web/src/components/messageBoxModal.component.ts
34 строки
1 KB
Eugene Pankov
lint
10 апр 2023, 22:21
Не верифицирован
10 апр 2023, 22:21
3b8ca0d
Код
Авторство
О чём код?
import { Component, Input, ElementRef } from '@angular/core' import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { BaseComponent, HotkeysService, MessageBoxOptions } from 'tabby-core' /** @hidden */ @Component({ templateUrl: './messageBoxModal.component.pug', }) export class MessageBoxModalComponent extends BaseComponent { @Input() options: MessageBoxOptions constructor ( hotkeys: HotkeysService, private element: ElementRef, private modalInstance: NgbActiveModal, ) { super() this.subscribeUntilDestroyed(hotkeys.key, (event: KeyboardEvent) => { if (event.type === 'keydown') { if (event.key === 'Enter' && this.options.defaultId !== undefined) { this.modalInstance.close(this.options.defaultId) } } }) } ngAfterViewInit (): void { this.element.nativeElement.querySelector('button[autofocus]').focus() } onButton (index: number): void { this.modalInstance.close(index) } }