diff --git a/webroot/js/components/chat/chat-message-view.js b/webroot/js/components/chat/chat-message-view.js index 8b11261f2..be0fbcc3f 100644 --- a/webroot/js/components/chat/chat-message-view.js +++ b/webroot/js/components/chat/chat-message-view.js @@ -22,7 +22,7 @@ export default class ChatMessageView extends Component { const { formattedMessage } = this.state; const { formattedMessage: nextFormattedMessage } = nextState; - return (formattedMessage !== nextFormattedMessage); + return formattedMessage !== nextFormattedMessage; } async componentDidMount() { @@ -36,7 +36,6 @@ export default class ChatMessageView extends Component { } } - render() { const { message } = this.props; const { author, timestamp, visible } = message; @@ -66,10 +65,7 @@ export default class ChatMessageView extends Component { title=${formattedTimestamp} >
-
+
${author}
{ + return new Promise((res) => { new Mark(node).mark(username, { element: 'span', className: 'highlighted px-1 rounded font-bold bg-orange-500', separateWordSearch: false, accuracy: { value: 'exactly', - limiters: [",", ".", "'", '?', '@'], + limiters: [',', '.', "'", '?', '@'], }, done() { res(node.innerHTML); - } + }, }); }); } @@ -131,8 +127,6 @@ function getMessageWithEmbeds(message) { embedText += getYoutubeEmbedFromID(youtubeID); } else if (url.indexOf('instagram.com/p/') > -1) { embedText += getInstagramEmbedFromURL(url); - } else if (isImage(url)) { - embedText += getImageForURL(url); } } @@ -174,15 +168,6 @@ function getInstagramEmbedFromURL(url) { return ``; } -function isImage(url) { - const re = /\.(jpe?g|png|gif)$/i; - return re.test(url); -} - -function getImageForURL(url) { - return ``; -} - function isMessageJustAnchor(message, anchor) { return stripTags(message) === stripTags(anchor.innerHTML); } @@ -217,5 +202,3 @@ function convertToMarkup(str = '') { function stripTags(str) { return str.replace(/<\/?[^>]+(>|$)/g, ''); } - -