Modest image support fixes #47

This commit is contained in:
Chris Blanchard 2015-10-03 17:23:59 +01:00
parent ea3e20f9c0
commit 592e742299
2 changed files with 24 additions and 1 deletions

View file

@ -62,6 +62,8 @@ var Chatroom = React.createClass({
}
});
var imgurRegex = /^(https?:\/\/i\.imgur\.com\/\S*\.jpg)$/i;
var ChatMessage = React.createClass({
mixins: [
ReactAutolink,
@ -97,7 +99,18 @@ var ChatMessage = React.createClass({
messageContent: function () {
let self = this;
return self.autolink(self.props.message.content, {
let message = self.props.message.content
if (message.match(imgurRegex)) {
return (
<div className="imgur-container">
<a href={message} target="_blank">
<img className="imgur-chat" src={message} />
</a>
</div>
);
}
return self.autolink(message, {
target: "_blank",
rel: "nofollow"
}).map((elem) => {

View file

@ -37,6 +37,16 @@ html, body {
margin: 10px 10px;
}
.imgur-container {
text-align: center;
margin: 5px 0;
}
.imgur-chat {
max-height: 280px;
max-width: 80%;
}
/*Splash Page*/
.join-hero {