diff options
author | nickago <ngonella@calpoly.edu> | 2015-08-06 15:50:37 -0700 |
---|---|---|
committer | nickago <ngonella@calpoly.edu> | 2015-08-06 15:50:37 -0700 |
commit | 29e405aad6844063ec0ad47c7c986d6bc0e57717 (patch) | |
tree | 6557a4418e13b3a02b81b8e722e851f184a6773a /web | |
parent | 3f987db4a5a3aacbe40ad6105e55341355ff0943 (diff) | |
download | chat-29e405aad6844063ec0ad47c7c986d6bc0e57717.tar.gz chat-29e405aad6844063ec0ad47c7c986d6bc0e57717.tar.bz2 chat-29e405aad6844063ec0ad47c7c986d6bc0e57717.zip |
Left and right arrows now scroll through files
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/view_image.jsx | 11 |
1 files changed, 11 insertions, 0 deletions
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 = {}; |