diff --git a/mediarepo-ui/src/app/components/core/core.component.ts b/mediarepo-ui/src/app/components/core/core.component.ts index 37f1409..c24484a 100644 --- a/mediarepo-ui/src/app/components/core/core.component.ts +++ b/mediarepo-ui/src/app/components/core/core.component.ts @@ -43,14 +43,12 @@ export class CoreComponent { this.stateService.state.subscribe(state => { this.appState = state; - console.log("new state", state); if (this.appState.tabs.value.length === 0) { this.addTab(); } state.tabs.subscribe(tabs => { - console.log("new tabs", tabs); this.tabs = tabs; - console.log(tabs); + if (this.tabs.length === 0) { this.addTab(); } @@ -101,7 +99,6 @@ export class CoreComponent { } public async onMouseClickTabLabel(tab: TabState, event: MouseEvent) { - console.log(event); if (event.button === 1) { // middle mouse button await this.closeTab(tab); } diff --git a/mediarepo-ui/src/app/components/shared/app-common/app-common.module.ts b/mediarepo-ui/src/app/components/shared/app-common/app-common.module.ts index 55c6460..6bc8863 100644 --- a/mediarepo-ui/src/app/components/shared/app-common/app-common.module.ts +++ b/mediarepo-ui/src/app/components/shared/app-common/app-common.module.ts @@ -15,6 +15,7 @@ import {MatMenuModule} from "@angular/material/menu"; import { ContentAwareImageComponent } from "./content-aware-image/content-aware-image.component"; +import { InputReceiverDirective } from "./input-receiver/input-receiver.directive"; @NgModule({ @@ -23,12 +24,14 @@ import { BusyIndicatorComponent, ContextMenuComponent, ContentAwareImageComponent, + InputReceiverDirective, ], exports: [ ConfirmDialogComponent, BusyIndicatorComponent, ContextMenuComponent, ContentAwareImageComponent, + InputReceiverDirective, ], imports: [ CommonModule, diff --git a/mediarepo-ui/src/app/components/shared/app-common/input-receiver/input-receiver.directive.spec.ts b/mediarepo-ui/src/app/components/shared/app-common/input-receiver/input-receiver.directive.spec.ts new file mode 100644 index 0000000..37946f5 --- /dev/null +++ b/mediarepo-ui/src/app/components/shared/app-common/input-receiver/input-receiver.directive.spec.ts @@ -0,0 +1,8 @@ +import { InputReceiverDirective } from './input-receiver.directive'; + +describe('InputReceiverDirective', () => { + it('should create an instance', () => { + const directive = new InputReceiverDirective(); + expect(directive).toBeTruthy(); + }); +}); diff --git a/mediarepo-ui/src/app/components/shared/app-common/input-receiver/input-receiver.directive.ts b/mediarepo-ui/src/app/components/shared/app-common/input-receiver/input-receiver.directive.ts new file mode 100644 index 0000000..718296a --- /dev/null +++ b/mediarepo-ui/src/app/components/shared/app-common/input-receiver/input-receiver.directive.ts @@ -0,0 +1,32 @@ +import { + Directive, + EventEmitter, + HostBinding, + HostListener, + Output +} from "@angular/core"; + +@Directive({ + selector: "[appInputReceiver]" +}) +export class InputReceiverDirective { + + constructor() { + } + + @Output() keyDownEvent = new EventEmitter(); + @Output() keyUpEvent = new EventEmitter(); + + @HostBinding("tabindex") tabIndex = 1; + + @HostListener("keydown", ["$event"]) + onKeyDown(event: KeyboardEvent) { + this.keyDownEvent.emit(event); + } + + @HostListener("keyup", ["$event"]) + onKeyUp(event: KeyboardEvent) { + this.keyUpEvent.emit(event); + } + +} diff --git a/mediarepo-ui/src/app/components/shared/file/file-multiview/file-gallery/file-gallery.component.html b/mediarepo-ui/src/app/components/shared/file/file-multiview/file-gallery/file-gallery.component.html index 9a67404..d12f2ee 100644 --- a/mediarepo-ui/src/app/components/shared/file/file-multiview/file-gallery/file-gallery.component.html +++ b/mediarepo-ui/src/app/components/shared/file/file-multiview/file-gallery/file-gallery.component.html @@ -1,4 +1,4 @@ -