From 1ac883a40816f471e959e49c8fd2f4e41f5ae9d2 Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Fri, 24 Jul 2015 15:35:56 -0700 Subject: Removes ability for the mention list to cycle from top to bottom and vice-versa --- web/react/components/mention_list.jsx | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'web/react') diff --git a/web/react/components/mention_list.jsx b/web/react/components/mention_list.jsx index 71a6083d2..8eae4d3b1 100644 --- a/web/react/components/mention_list.jsx +++ b/web/react/components/mention_list.jsx @@ -31,24 +31,16 @@ module.exports = React.createClass({ e.stopPropagation(); e.preventDefault(); - var tempSelectedMention = -1; if (e.which === 38) { if (self.getSelection(self.state.selectedMention - 1)) self.setState({ selectedMention: self.state.selectedMention - 1, selectedUsername: self.refs['mention' + (self.state.selectedMention - 1)].props.username }); - else { - while (self.getSelection(++tempSelectedMention)) - ; //Need to find the top of the list - self.setState({ selectedMention: tempSelectedMention - 1, selectedUsername: self.refs['mention' + (tempSelectedMention - 1)].props.username }); - } } else if (e.which === 40) { if (self.getSelection(self.state.selectedMention + 1)) self.setState({ selectedMention: self.state.selectedMention + 1, selectedUsername: self.refs['mention' + (self.state.selectedMention + 1)].props.username }); - else - self.setState({ selectedMention: 0, selectedUsername: self.refs.mention0.props.username }); } - self.scrollToMention(e.which, tempSelectedMention); + self.scrollToMention(e.which); } } ); @@ -124,15 +116,15 @@ module.exports = React.createClass({ isEmpty: function() { return (!this.refs.mention0); }, - scrollToMention: function(keyPressed, ifLoopUp) { + scrollToMention: function(keyPressed) { var direction = keyPressed === 38 ? "up" : "down"; var scrollAmount = 0; - if (direction === "up" && ifLoopUp !== -1) + /*if (direction === "up" && ifLoopUp !== -1) scrollAmount = $("#mentionsbox").height() * 100; //Makes sure that it scrolls all the way to the bottom else if (direction === "down" && this.state.selectedMention === 0) - scrollAmount = 0; - else if (direction === "up") + scrollAmount = 0;*/ + if (direction === "up") scrollAmount = "-=" + ($('#'+this.refs['mention' + this.state.selectedMention].props.id +"_mentions").innerHeight() - 5); else if (direction === "down") scrollAmount = "+=" + ($('#'+this.refs['mention' + this.state.selectedMention].props.id +"_mentions").innerHeight() - 5); -- cgit v1.2.3-1-g7c22