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