diff --git a/src/app/components/info-drawer/info-drawer.component.ts b/src/app/components/info-drawer/info-drawer.component.ts index 55c3b80d2..aa22749f2 100644 --- a/src/app/components/info-drawer/info-drawer.component.ts +++ b/src/app/components/info-drawer/info-drawer.component.ts @@ -23,7 +23,14 @@ * along with Alfresco. If not, see . */ -import { Component, Input, OnChanges, OnInit, OnDestroy } from '@angular/core'; +import { + Component, + HostListener, + Input, + OnChanges, + OnInit, + OnDestroy +} from '@angular/core'; import { MinimalNodeEntity, MinimalNodeEntryEntity, @@ -33,7 +40,10 @@ import { ContentApiService } from '@alfresco/aca-shared'; import { AppExtensionService } from '../../extensions/extension.service'; import { SidebarTabRef } from '@alfresco/adf-extensions'; import { Store } from '@ngrx/store'; -import { SetInfoDrawerStateAction } from '@alfresco/aca-shared/store'; +import { + SetInfoDrawerStateAction, + ToggleInfoDrawerAction +} from '@alfresco/aca-shared/store'; @Component({ selector: 'aca-info-drawer', @@ -49,6 +59,10 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy { displayNode: MinimalNodeEntryEntity | SiteEntry; tabs: Array = []; + @HostListener('keydown.escape') onEscapeKeyboardEvent() { + this.close(); + } + constructor( private store: Store, private contentApi: ContentApiService, @@ -80,6 +94,10 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy { } } + private close() { + this.store.dispatch(new ToggleInfoDrawerAction()); + } + private loadNodeInfo(nodeId: string) { if (nodeId) { this.isLoading = true;