mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-26 22:31:08 +00:00
Modest image support fixes #47
This commit is contained in:
parent
ea3e20f9c0
commit
592e742299
2 changed files with 24 additions and 1 deletions
|
@ -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) => {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue