Skip to content

Commit

Permalink
hackily special case highlight-chat-reference
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenhao committed Aug 23, 2018
1 parent 7dc56a8 commit f01ee23
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/components/ChatV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,23 @@ export default class Chat extends Component {
renderMessageText(text) {
text = emoji.emojify(text);

// TODO rewrite this logic using regex, probably
// this messes up emojis which have length > 1, since it splits them up into multiple spans
let stuff = []
let z = 0
while(z < text.length) {
if (text[z] != '@') {
stuff.push(text[z])
z += 1
} else {
stuff.push(text.substr(z, z+4))
z += 4

// HACK: for now, only chunk into characters when there's at least one @ symbol
if (text.indexOf('@') === -1) {
stuff.push(text);
} else {
while(z < text.length) {
if (text[z] != '@') {
stuff.push(text[z])
z += 1
} else {
stuff.push(text.substr(z, z+4))
z += 4
}
}
}

Expand Down

0 comments on commit f01ee23

Please sign in to comment.