mirror of
https://github.com/Eugeny/tabby.git
synced 2025-09-24 00:56:06 +00:00
force autofocus in rename-tab modal (fixes #484)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
.modal-body
|
||||
input.form-control(type='text', [(ngModel)]='value', (keyup.enter)='save()', autofocus)
|
||||
input.form-control(type='text', #input, [(ngModel)]='value', (keyup.enter)='save()', autofocus)
|
||||
|
||||
.modal-footer
|
||||
button.btn.btn-outline-primary((click)='save()') Save
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Component, Input } from '@angular/core'
|
||||
import { Component, Input, ElementRef } from '@angular/core'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
|
||||
@Component({
|
||||
@@ -7,11 +7,18 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
})
|
||||
export class RenameTabModalComponent {
|
||||
@Input() value: string
|
||||
@ViewChild('input') input: ElementRef
|
||||
|
||||
constructor (
|
||||
private modalInstance: NgbActiveModal
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
setTimeout(() => {
|
||||
this.input.nativeElement.focus()
|
||||
})
|
||||
}
|
||||
|
||||
save () {
|
||||
this.modalInstance.close(this.value)
|
||||
}
|
||||
|
Reference in New Issue
Block a user