From 29e405aad6844063ec0ad47c7c986d6bc0e57717 Mon Sep 17 00:00:00 2001 From: nickago Date: Thu, 6 Aug 2015 15:50:37 -0700 Subject: Left and right arrows now scroll through files --- web/react/components/view_image.jsx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'web/react/components') diff --git a/web/react/components/view_image.jsx b/web/react/components/view_image.jsx index 4b2f8f650..dd3d98a8f 100644 --- a/web/react/components/view_image.jsx +++ b/web/react/components/view_image.jsx @@ -93,11 +93,22 @@ module.exports = React.createClass({ } ); + $(this.getDOMNode()).on('keyup', function(e) { + if(!e) { + return; + } else if (e.keyCode === 39) { + self.handleNext(); + } else if (e.keyCode === 37) { + self.handlePrev(); + } + }); + // keep track of whether or not this component is mounted so we can safely set the state asynchronously this.canSetState = true; }, componentWillUnmount: function() { this.canSetState = false; + $(this.getDOMNode()).off('keyup'); }, getPublicLink: function(e) { data = {}; -- cgit v1.2.3-1-g7c22