From 414c2bed91f7fa9a936b2fba36e70558b5ffb997 Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Thu, 23 Jul 2015 14:04:33 -0700 Subject: Removes the blue tag highlighting from mentions that would appear after typing a mention --- web/react/components/textbox.jsx | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'web/react/components/textbox.jsx') diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx index ad50b7920..d586b3918 100644 --- a/web/react/components/textbox.jsx +++ b/web/react/components/textbox.jsx @@ -119,13 +119,8 @@ module.exports = React.createClass({ }, updateTextdiv: function() { var html = utils.insertHtmlEntities(this.refs.message.getDOMNode().value); - for (var k in this.mentions) { - var m = this.mentions[k]; - var re = new RegExp('( |^)@' + m + '( |$|\n)', 'm'); - html = html.replace(re, '$1@'+m+'$2'); - } - var re2 = new RegExp('(^$)(?![.\n])', 'gm'); - html = html.replace(re2, '

'); + var re = new RegExp('(^$)(?![.\n])', 'gm'); + html = html.replace(re, '

'); $(this.refs.textdiv.getDOMNode()).html(html); }, handleChange: function() { @@ -181,7 +176,7 @@ module.exports = React.createClass({ } }, processMentions: function() { - /* First, find all the possible mentions, highlight them in the HTML and add + /* First, find all the possible mentions and add them all to a list of mentions */ var text = utils.insertHtmlEntities(this.refs.message.getDOMNode().value); @@ -194,7 +189,6 @@ module.exports = React.createClass({ if (!matches) { $(this.refs.textdiv.getDOMNode()).text(text); this.updateMentionTab(null, []); - this.mentions = []; return; } @@ -207,7 +201,7 @@ module.exports = React.createClass({ } /* Figure out what the user is currently typing. If it's a mention then we don't - want to highlight it and add it to the mention list yet, so we remove it if + want to add it to the mention list yet, so we remove it if there is only one occurence of that mention so far. */ var caret = utils.getCaretPosition(this.refs.message.getDOMNode()); @@ -225,14 +219,13 @@ module.exports = React.createClass({ typingMention = text.substring(atIndex+1, caret); } - var re3 = new RegExp('@' + typingMention + '( |$|\n)', 'g'); + var re2 = new RegExp('@' + typingMention + '( |$|\n)', 'g'); - if ((text.match(re3) || []).length === 1 && mentions.indexOf(typingMention) !== -1) { + if ((text.match(re2) || []).length === 1 && mentions.indexOf(typingMention) !== -1) { mentions.splice(mentions.indexOf(typingMention), 1); } this.updateMentionTab(null, mentions); - this.mentions = mentions; }, checkForNewMention: function(text) { var caret = utils.getCaretPosition(this.refs.message.getDOMNode()); -- cgit v1.2.3-1-g7c22 From b27562cedc64090ea030eaea0f540739f47ba6c2 Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Fri, 24 Jul 2015 08:52:20 -0700 Subject: Removed vestige textdiv code that is also no longer necessary due to removing the mention tags --- web/react/components/textbox.jsx | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'web/react/components/textbox.jsx') diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx index d586b3918..bbd1f84b6 100644 --- a/web/react/components/textbox.jsx +++ b/web/react/components/textbox.jsx @@ -36,7 +36,6 @@ module.exports = React.createClass({ this.resize(); this.processMentions(); - this.updateTextdiv(); }, componentWillUnmount: function() { PostStore.removeAddMentionListener(this._onChange); @@ -87,7 +86,6 @@ module.exports = React.createClass({ this.processMentions(); this.doProcessMentions = false; } - this.updateTextdiv(); this.resize(); }, componentWillReceiveProps: function(nextProps) { @@ -117,12 +115,6 @@ module.exports = React.createClass({ }); }, 1); }, - updateTextdiv: function() { - var html = utils.insertHtmlEntities(this.refs.message.getDOMNode().value); - var re = new RegExp('(^$)(?![.\n])', 'gm'); - html = html.replace(re, '

'); - $(this.refs.textdiv.getDOMNode()).html(html); - }, handleChange: function() { this.props.onUserInput(this.refs.message.getDOMNode().value); this.resize(); @@ -187,7 +179,6 @@ module.exports = React.createClass({ var matches = text.match(re1); if (!matches) { - $(this.refs.textdiv.getDOMNode()).text(text); this.updateMentionTab(null, []); return; } @@ -280,15 +271,9 @@ module.exports = React.createClass({ elm.value = cmd; this.handleChange(); }, - scroll: function() { - var e = this.refs.message.getDOMNode(); - var d = this.refs.textdiv.getDOMNode(); - $(d).scrollTop($(e).scrollTop()); - }, resize: function() { var e = this.refs.message.getDOMNode(); var w = this.refs.wrapper.getDOMNode(); - var d = this.refs.textdiv.getDOMNode(); var lht = parseInt($(e).css('lineHeight'),10); var lines = e.scrollHeight / lht; @@ -296,15 +281,11 @@ module.exports = React.createClass({ if (e.scrollHeight - mod < 167) { $(e).css({'height':'auto','overflow-y':'hidden'}).height(e.scrollHeight - mod); - $(d).css({'height':'auto','overflow-y':'hidden'}).height(e.scrollHeight - mod); $(w).css({'height':'auto'}).height(e.scrollHeight+2); } else { $(e).css({'height':'auto','overflow-y':'scroll'}).height(167); - $(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(); @@ -325,8 +306,7 @@ module.exports = React.createClass({ return (
-
-