summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-06-17 09:23:19 -0400
committerJoramWilander <jwawilander@gmail.com>2015-06-17 09:23:19 -0400
commitf1a2e4835477c81863625c4460fd363876de0f07 (patch)
tree3d3bb2dd93c117e95daf8207744de38d5fb0bca0
parent5a8f8397167cec8cba29b70bb7dbdda9ba0265f7 (diff)
downloadchat-f1a2e4835477c81863625c4460fd363876de0f07.tar.gz
chat-f1a2e4835477c81863625c4460fd363876de0f07.tar.bz2
chat-f1a2e4835477c81863625c4460fd363876de0f07.zip
fixes mm-1250 mention highlights should now align in textbox
-rw-r--r--web/react/components/mention_list.jsx4
-rw-r--r--web/react/components/textbox.jsx4
2 files changed, 6 insertions, 2 deletions
diff --git a/web/react/components/mention_list.jsx b/web/react/components/mention_list.jsx
index 8b7e25b04..2731d2596 100644
--- a/web/react/components/mention_list.jsx
+++ b/web/react/components/mention_list.jsx
@@ -14,7 +14,7 @@ module.exports = React.createClass({
PostStore.addMentionDataChangeListener(this._onChange);
var self = this;
- $('#'+this.props.id).on('keypress.mentionlist',
+ $('body').on('keypress.mentionlist', '#'+this.props.id,
function(e) {
if (!self.isEmpty() && self.state.mentionText != '-1' && e.which === 13) {
e.stopPropagation();
@@ -26,7 +26,7 @@ module.exports = React.createClass({
},
componentWillUnmount: function() {
PostStore.removeMentionDataChangeListener(this._onChange);
- $('#'+this.props.id).off('keypress.mentionlist');
+ $('body').off('keypress.mentionlist', '#'+this.props.id);
},
_onChange: function(id, mentionText, excludeList) {
if (id !== this.props.id) return;
diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx
index 45798809f..05fbb57d1 100644
--- a/web/react/components/textbox.jsx
+++ b/web/react/components/textbox.jsx
@@ -78,6 +78,8 @@ module.exports = React.createClass({
var re = new RegExp('( |^)@' + m + '( |$|\n)', 'm');
html = html.replace(re, '$1<span class="mention">@'+m+'</span>$2');
}
+ var re2 = new RegExp('(^$)(?![.\n])', 'gm');
+ html = html.replace(re2, '<br/><br/>');
$(this.refs.textdiv.getDOMNode()).html(html);
},
handleChange: function() {
@@ -262,6 +264,8 @@ module.exports = React.createClass({
$(d).css({'height':'auto','overflow-y':'scroll'}).height(167);
$(w).css({'height':'auto'}).height(167);
}
+
+ $(d).scrollTop($(e).scrollTop());
},
handleFocus: function() {
var elm = this.refs.message.getDOMNode();