diff options
author | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-06-22 17:39:55 -0700 |
---|---|---|
committer | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-07-16 08:10:18 -0700 |
commit | 924fd8609bb0b512cd60c1f345ec22dcb6bf0612 (patch) | |
tree | 3ee5c22dcd15e84cef11b47a30e9ec379981d640 /web/react | |
parent | f635376aa45e2fbaa30698949a0c991ea06aa320 (diff) | |
download | chat-924fd8609bb0b512cd60c1f345ec22dcb6bf0612.tar.gz chat-924fd8609bb0b512cd60c1f345ec22dcb6bf0612.tar.bz2 chat-924fd8609bb0b512cd60c1f345ec22dcb6bf0612.zip |
Changed parts of framework
Diffstat (limited to 'web/react')
-rw-r--r-- | web/react/components/mention_list.jsx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/web/react/components/mention_list.jsx b/web/react/components/mention_list.jsx index a2c6f0ff7..115ab1b2a 100644 --- a/web/react/components/mention_list.jsx +++ b/web/react/components/mention_list.jsx @@ -56,8 +56,8 @@ module.exports = React.createClass({ this.setState({ mentionText: '-1' }); }, - handleKeyDown: function(e) { - var selectedMention = this.state.selectedMention ? this.state.selectedMention : 1; + handleKeyDown: function(e, numMentions) { + var selectedMention = this.state.selectedMention <= nunMentions ? this.state.selectedMention : 1; // Need to be able to know number of mentions, use in conditionals & still // need to figure out how to highlight the mention I want every time. @@ -65,10 +65,10 @@ module.exports = React.createClass({ // Maybe have the call there instead? Ehhh maybe not but need that to be able // to "select" it maybe... if (e.key === "ArrowUp") { - selectedMention = selectedMention === ? 1 : selectedMention++; + selectedMention = selectedMention === numMentions ? 1 : selectedMention++; } else if (e.key === "ArrowDown") { - selectedMention = selectedMention === 1 ? : selectedMention--; + selectedMention = selectedMention === 1 ? numMentions : selectedMention--; } this.setState({selectedMention: selectedMention}); }, @@ -89,7 +89,7 @@ module.exports = React.createClass({ return false; }, getInitialState: function() { - return { excludeUsers: [], mentionText: "-1" }; + return { excludeUsers: [], mentionText: "-1", selectedMention: 1 }; }, render: function() { var mentionText = this.state.mentionText; @@ -158,9 +158,11 @@ module.exports = React.createClass({ left: $mention_tab.offset().left }; + //mentions[this.state.selectedMention].focus(); + return ( <div className="mentions--top" style={style}> - <div ref="mentionlist" className="mentions-box" onKeyDown={this.handleKeyDown}> + <div ref="mentionlist" className="mentions-box" onKeyDown={this.handleKeyDown.bind(this, numMentions)}> { mentions } </div> </div> |