Continuation

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-09-28 10:50:31 +01:00
parent e3b0bf1915
commit 30d2e61a0d
3 changed files with 46 additions and 40 deletions

View file

@ -83,9 +83,11 @@ export default class ModalWidgetDialog extends React.PureComponent<IProps, IStat
public render() {
// TODO: Don't violate every single security principle
const widgetId = encodeURIComponent(this.getWidgetId());
const parentUrl = encodeURIComponent(window.location.href);
const widgetUrl = `${this.props.widgetDefinition.url}?widgetId=${widgetId}&parentUrl=${parentUrl}`;
const widgetUrl = new URL(this.props.widgetDefinition.url);
// TODO: Replace these with proper widget params
// See https://github.com/matrix-org/matrix-doc/pull/1958/files#r405714833
widgetUrl.searchParams.set("widgetId", this.getWidgetId());
widgetUrl.searchParams.set("parentUrl", window.location.href);
let buttons;
if (this.props.widgetDefinition.buttons) {
@ -124,10 +126,10 @@ export default class ModalWidgetDialog extends React.PureComponent<IProps, IStat
<div>
<iframe
ref={this.appFrame}
sandbox="allow-forms allow-scripts"
// sandbox="allow-forms allow-scripts"
width={700} // TODO
height={450} // TODO
src={widgetUrl}
src={widgetUrl.toString()}
onLoad={this.onLoad}
/>
</div>