mirror of
https://github.com/Eugeny/tabby
synced 2024-11-15 01:17:14 +00:00
tab renaming (fixes #19)
This commit is contained in:
parent
e64126af37
commit
60ce10d1e3
4 changed files with 32 additions and 1 deletions
|
@ -0,0 +1,6 @@
|
|||
.modal-body
|
||||
input.form-control(type='text', [(ngModel)]='value', (keyup.enter)='save()', autofocus)
|
||||
|
||||
.modal-footer
|
||||
button.btn.btn-outline-primary((click)='save()') Save
|
||||
button.btn.btn-outline-secondary((click)='close()') Cancel
|
22
terminus-core/src/components/renameTabModal.component.ts
Normal file
22
terminus-core/src/components/renameTabModal.component.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import { Component, Input } from '@angular/core'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
|
||||
@Component({
|
||||
selector: 'rename-tab-modal',
|
||||
template: require('./renameTabModal.component.pug'),
|
||||
})
|
||||
export class RenameTabModalComponent {
|
||||
@Input() value: string
|
||||
|
||||
constructor (
|
||||
private modalInstance: NgbActiveModal
|
||||
) { }
|
||||
|
||||
save () {
|
||||
this.modalInstance.close(this.value)
|
||||
}
|
||||
|
||||
close () {
|
||||
this.modalInstance.dismiss()
|
||||
}
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
.index {{index + 1}}
|
||||
.name {{tab.title || tab.customTitle}}
|
||||
.name {{tab.customTitle || tab.title}}
|
||||
button((click)='closeClicked.emit()') ×
|
||||
|
|
|
@ -22,6 +22,9 @@ export class TabHeaderComponent {
|
|||
@HostListener('dblclick') onDoubleClick (): void {
|
||||
let modal = this.ngbModal.open(RenameTabModalComponent)
|
||||
modal.componentInstance.value = this.tab.customTitle || this.tab.title
|
||||
modal.result.then(result => {
|
||||
this.tab.customTitle = result
|
||||
}).catch(() => null)
|
||||
}
|
||||
|
||||
@HostListener('auxclick', ['$event']) onAuxClick ($event: MouseEvent): void {
|
||||
|
|
Loading…
Reference in a new issue