diff --git a/terminus-core/src/components/tabHeader.component.scss b/terminus-core/src/components/tabHeader.component.scss index 963a9112..4e88a995 100644 --- a/terminus-core/src/components/tabHeader.component.scss +++ b/terminus-core/src/components/tabHeader.component.scss @@ -81,5 +81,6 @@ $tabs-height: 36px; top: 0; height: 5px; z-index: -1; + transition: 0.25s width; } } diff --git a/terminus-core/src/directives/autofocus.directive.ts b/terminus-core/src/directives/autofocus.directive.ts new file mode 100644 index 00000000..34b3625e --- /dev/null +++ b/terminus-core/src/directives/autofocus.directive.ts @@ -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() + }) + } +} diff --git a/terminus-core/src/index.ts b/terminus-core/src/index.ts index a3a5c7cb..2fee96c2 100644 --- a/terminus-core/src/index.ts +++ b/terminus-core/src/index.ts @@ -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 { diff --git a/terminus-ssh/src/index.ts b/terminus-ssh/src/index.ts index 097000f0..d0ef1e36 100644 --- a/terminus-ssh/src/index.ts +++ b/terminus-ssh/src/index.ts @@ -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,