1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-24 19:13:31 +03:00

fixed autofocus in input fields (fixes #374)

This commit is contained in:
Eugene Pankov 2018-09-10 17:23:36 +02:00
parent 38e450f70a
commit d6fb71dca2
4 changed files with 22 additions and 0 deletions

View File

@ -81,5 +81,6 @@ $tabs-height: 36px;
top: 0;
height: 5px;
z-index: -1;
transition: 0.25s width;
}
}

View File

@ -0,0 +1,15 @@
import { Directive, AfterViewInit, ElementRef } from '@angular/core'
@Directive({
selector: '[autofocus]'
})
export class AutofocusDirective implements AfterViewInit {
constructor (private el: ElementRef) { }
ngAfterViewInit () {
this.el.nativeElement.blur()
setTimeout(() => {
this.el.nativeElement.focus()
})
}
}

View File

@ -30,6 +30,8 @@ import { ToggleComponent } from './components/toggle.component'
import { WindowControlsComponent } from './components/windowControls.component'
import { RenameTabModalComponent } from './components/renameTabModal.component'
import { AutofocusDirective } from './directives/autofocus.directive'
import { HotkeyProvider } from './api/hotkeyProvider'
import { ConfigProvider } from './api/configProvider'
import { Theme } from './api/theme'
@ -80,6 +82,7 @@ const PROVIDERS = [
WindowControlsComponent,
RenameTabModalComponent,
SafeModeModalComponent,
AutofocusDirective,
],
entryComponents: [
RenameTabModalComponent,
@ -88,6 +91,7 @@ const PROVIDERS = [
exports: [
CheckboxComponent,
ToggleComponent,
AutofocusDirective,
]
})
export default class AppModule {

View File

@ -4,6 +4,7 @@ import { FormsModule } from '@angular/forms'
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
import { ToastrModule } from 'ngx-toastr'
import { ToolbarButtonProvider, ConfigProvider } from 'terminus-core'
import TerminusCoreModule from 'terminus-core'
import { SettingsTabProvider } from 'terminus-settings'
import { EditConnectionModalComponent } from './components/editConnectionModal.component'
@ -23,6 +24,7 @@ import { SSHSettingsTabProvider } from './settings'
CommonModule,
FormsModule,
ToastrModule,
TerminusCoreModule,
],
providers: [
PasswordStorageService,