Add handleKeyPress event

This commit is contained in:
Patrick Burtchaell 2015-07-19 10:21:29 -05:00
parent 64dcb3cc17
commit 4a2a59d676

View File

@ -2,6 +2,10 @@ import React, { PropTypes, findDOMNode } from 'react';
import LogMonitorEntry from './LogMonitorEntry';
export default class LogMonitor {
constructor() {
window.addEventListener('keypress', ::this.handleKeyPress);
}
static propTypes = {
computedStates: PropTypes.array.isRequired,
currentStateIndex: PropTypes.number.isRequired,
@ -66,6 +70,18 @@ export default class LogMonitor {
this.props.reset();
}
handleKeyPress(event) {
let { isVisible } = this.props.monitorState;
if (event.ctrlKey && event.keyCode === 8) {
if (isVisible) {
this.props.hide();
} else {
this.props.show();
}
}
}
render() {
const elements = [];
const { skippedActions, stagedActions, computedStates, select } = this.props;