Skip to content

Commit

Permalink
support iframes for RTS urls
Browse files Browse the repository at this point in the history
  • Loading branch information
ara4n committed May 30, 2017
1 parent 64a6758 commit 1e1a43c
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions src/components/structures/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ module.exports = React.createClass({
},

componentWillMount: function() {
if (this.props.teamToken && this.props.teamServerUrl) {
return;
}

// we use request() to inline the homepage into the react component
// so that it can inherit CSS and theming easily rather than mess around
// with iframes and trying to synchronise document.stylesheets.

let src = this.props.homePageUrl || '/home.html';

if (this.props.teamToken && this.props.teamServerUrl) {
src = `${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html`;
}

request(
{ method: "GET", url: src },
(err, response, body) => {
Expand All @@ -71,11 +71,21 @@ module.exports = React.createClass({
},

render: function() {
return (
<GeminiScrollbar autoshow={true} className="mx_HomePage">
<div className="mx_HomePage_body" dangerouslySetInnerHTML={{ __html: this.state.page }}>
if (this.props.teamToken && this.props.teamServerUrl) {
src = `${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html`;

This comment has been minimized.

Copy link
@lukebarnard1

lukebarnard1 Jun 1, 2017

Contributor

src is undeclared

This comment has been minimized.

Copy link
@lukebarnard1

lukebarnard1 Jun 1, 2017

Contributor

I think src should be kept in state as something like iframeSrc and it should be set in componentWillMount. By default iframeSrc would be null.

return (
<div className="mx_HomePage">
<iframe src={ src } />
</div>
</GeminiScrollbar>
);
);
}
else {
return (
<GeminiScrollbar autoshow={true} className="mx_HomePage">
<div className="mx_HomePage_body" dangerouslySetInnerHTML={{ __html: this.state.page }}>
</div>
</GeminiScrollbar>
);
}
}
});

0 comments on commit 1e1a43c

Please sign in to comment.