#68 add esc keypress listner

This commit is contained in:
Eugenio Romano
2016-06-02 17:56:32 +01:00
parent a368dd42c3
commit ff01dc5ece
3 changed files with 32 additions and 3 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, Input, Output } from 'angular2/core';
import { Component, Input, Output, HostListener } from 'angular2/core';
import { EventEmitter } from 'angular2/src/facade/async';
declare let PDFJS: any;
@@ -146,6 +146,14 @@ export class ViewerComponent {
}
}
@HostListener('document:keydown', ['$event'])
handleKeyboardEvent(event: KeyboardEvent) {
let key = event.keyCode;
if (key === 27) {//esc
this.close();
}
}
/**
* Add Ticket to the file request
* @returns {string}