From 77f52da25512dc6ab80635efaa6c22a2887cd5e2 Mon Sep 17 00:00:00 2001 From: Asaad Mahmood Date: Tue, 4 Aug 2015 19:12:20 +0500 Subject: UI Improvements --- web/react/components/mention_list.jsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'web/react/components/mention_list.jsx') diff --git a/web/react/components/mention_list.jsx b/web/react/components/mention_list.jsx index 71a6083d2..829462456 100644 --- a/web/react/components/mention_list.jsx +++ b/web/react/components/mention_list.jsx @@ -20,6 +20,10 @@ module.exports = React.createClass({ PostStore.addMentionDataChangeListener(this._onChange); var self = this; + $('.post-right__scroll').scroll(function(){ + self.forceUpdate(); + }); + $('body').on('keydown.mentionlist', '#'+this.props.id, function(e) { if (!self.isEmpty() && self.state.mentionText != '-1' && (e.which === 13 || e.which === 9)) { @@ -32,7 +36,7 @@ module.exports = React.createClass({ e.preventDefault(); var tempSelectedMention = -1; - if (e.which === 38) { + 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 { @@ -106,13 +110,13 @@ module.exports = React.createClass({ this.setState({ selectedMention: listId, selectedUsername: this.refs['mention' + listId].props.username }); }, getSelection: function(listId) { - if (!this.refs['mention' + listId]) + if (!this.refs['mention' + listId]) return false; else return true; }, addCurrentMention: function() { - if (!this.getSelection(this.state.selectedMention)) + if (!this.getSelection(this.state.selectedMention)) this.addFirstMention(); else this.refs['mention' + this.state.selectedMention].handleClick(); @@ -132,7 +136,7 @@ module.exports = React.createClass({ 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") + else 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 From ca7eb5d53c55b788e381983ca76aebdfc6c039ae Mon Sep 17 00:00:00 2001 From: Asaad Mahmood Date: Tue, 4 Aug 2015 22:11:11 +0500 Subject: Fixing scrolling of mention box in RHS --- web/react/components/mention_list.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'web/react/components/mention_list.jsx') diff --git a/web/react/components/mention_list.jsx b/web/react/components/mention_list.jsx index 829462456..09313bbbd 100644 --- a/web/react/components/mention_list.jsx +++ b/web/react/components/mention_list.jsx @@ -21,7 +21,9 @@ module.exports = React.createClass({ var self = this; $('.post-right__scroll').scroll(function(){ - self.forceUpdate(); + if($('.mentions--top').length){ + $('#reply_mention_tab .mentions--top').css({ bottom: $(window).height() - $('.post-right__scroll #reply_textbox').offset().top }); + } }); $('body').on('keydown.mentionlist', '#'+this.props.id, -- cgit v1.2.3-1-g7c22 From d151d430179a6ddf1cfec1261bc6b134dd3aab9e Mon Sep 17 00:00:00 2001 From: Asaad Mahmood Date: Wed, 5 Aug 2015 15:56:08 +0500 Subject: Fixing mentions scroll again due to merge conflict --- web/react/components/mention_list.jsx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'web/react/components/mention_list.jsx') diff --git a/web/react/components/mention_list.jsx b/web/react/components/mention_list.jsx index a0f68df98..16c1994e1 100644 --- a/web/react/components/mention_list.jsx +++ b/web/react/components/mention_list.jsx @@ -20,6 +20,13 @@ module.exports = React.createClass({ PostStore.addMentionDataChangeListener(this.onListenerChange); var self = this; + $('.post-right__scroll').scroll(function(){ + console.log('sad'); + if($('.mentions--top').length){ + $('#reply_mention_tab .mentions--top').css({ bottom: $(window).height() - $('.post-right__scroll #reply_textbox').offset().top }); + } + }); + $('body').on('keydown.mentionlist', '#' + this.props.id, function(e) { if (!self.isEmpty() && self.state.mentionText !== '-1' && (e.which === 13 || e.which === 9)) { -- cgit v1.2.3-1-g7c22 From 9699401d5b1856b3dfa380f468e808a41dbe8b3a Mon Sep 17 00:00:00 2001 From: Asaad Mahmood Date: Wed, 5 Aug 2015 16:02:53 +0500 Subject: Removing console.log --- web/react/components/mention_list.jsx | 1 - 1 file changed, 1 deletion(-) (limited to 'web/react/components/mention_list.jsx') diff --git a/web/react/components/mention_list.jsx b/web/react/components/mention_list.jsx index 16c1994e1..5f1bb6d0e 100644 --- a/web/react/components/mention_list.jsx +++ b/web/react/components/mention_list.jsx @@ -21,7 +21,6 @@ module.exports = React.createClass({ var self = this; $('.post-right__scroll').scroll(function(){ - console.log('sad'); if($('.mentions--top').length){ $('#reply_mention_tab .mentions--top').css({ bottom: $(window).height() - $('.post-right__scroll #reply_textbox').offset().top }); } -- cgit v1.2.3-1-g7c22