fix colour & hyperlink for home page header

This commit is contained in:
Matthew Hodgson 2017-06-08 12:06:45 +01:00
parent 0cbd5de1d3
commit cabbd16dd3
2 changed files with 14 additions and 2 deletions

View file

@ -45,6 +45,13 @@ module.exports = React.createClass({
};
},
translate: function(s) {
s = sanitizeHtml(_t(s));
// ugly fix for https://github.com/vector-im/riot-web/issues/4243
s = s.replace(/Riot\.im/, '<a href="https://riot.im">Riot.im</a>');
return s;
},
componentWillMount: function() {
if (this.props.teamToken && this.props.teamServerUrl) {
this.setState({
@ -66,7 +73,7 @@ module.exports = React.createClass({
this.setState({ page: "Couldn't load home page" });
}
body = body.replace(/_t\(['"]([\s\S]*?)['"]\)/mg, (match, g1)=>{ return sanitizeHtml(_t(g1)) });
body = body.replace(/_t\(['"]([\s\S]*?)['"]\)/mg, (match, g1)=>this.translate(g1));
this.setState({ page: body });
}
);