diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 061908bfa32..61439fefd8e 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -13,10 +13,12 @@ import { ToasterModule } from 'angular2-toaster'; import { AddEditComponent } from './vault/add-edit.component'; import { AppComponent } from './app.component'; import { AttachmentsComponent } from './vault/attachments.component'; +import { AutofocusDirective } from './directives/autofocus.directive'; import { BlurClickDirective } from './directives/blur-click.directive'; import { BoxRowDirective } from './directives/box-row.directive'; import { CiphersComponent } from './vault/ciphers.component'; import { FallbackSrcDirective } from './directives/fallback-src.directive'; +import { FolderAddEditComponent } from './vault/folder-add-edit.component'; import { GroupingsComponent } from './vault/groupings.component'; import { I18nPipe } from './pipes/i18n.pipe'; import { IconComponent } from './vault/icon.component'; @@ -46,10 +48,12 @@ import { ViewComponent } from './vault/view.component'; AddEditComponent, AppComponent, AttachmentsComponent, + AutofocusDirective, BlurClickDirective, BoxRowDirective, CiphersComponent, FallbackSrcDirective, + FolderAddEditComponent, GroupingsComponent, I18nPipe, IconComponent, @@ -64,6 +68,7 @@ import { ViewComponent } from './vault/view.component'; ], entryComponents: [ AttachmentsComponent, + FolderAddEditComponent, ModalComponent, PasswordGeneratorComponent, ], diff --git a/src/app/directives/autofocus.directive.ts b/src/app/directives/autofocus.directive.ts new file mode 100644 index 00000000000..07442d10603 --- /dev/null +++ b/src/app/directives/autofocus.directive.ts @@ -0,0 +1,24 @@ +import { + Directive, + ElementRef, + Input, +} from '@angular/core'; + +@Directive({ + selector: '[appAutofocus]', +}) +export class AutofocusDirective { + @Input() set appAutofocus(condition: boolean | string) { + this._autofocus = condition === '' || condition === true; + } + + private _autofocus: boolean; + + constructor(private el: ElementRef) { } + + ngOnInit() { + if (this._autofocus) { + this.el.nativeElement.focus(); + } + } +} diff --git a/src/app/vault/folder-add-edit.component.html b/src/app/vault/folder-add-edit.component.html new file mode 100644 index 00000000000..7462039da62 --- /dev/null +++ b/src/app/vault/folder-add-edit.component.html @@ -0,0 +1,32 @@ +