From 6df3371c6c562fa006bb2cddbd6b3cdb4cb8e8cc Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Tue, 22 May 2018 19:14:54 +0100 Subject: [PATCH] Add a "reload widget" button. --- res/img/button-refresh.svg | 12 ++++++++++++ src/components/views/elements/AppTile.js | 23 +++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 res/img/button-refresh.svg diff --git a/res/img/button-refresh.svg b/res/img/button-refresh.svg new file mode 100644 index 0000000000..b4990a2147 --- /dev/null +++ b/res/img/button-refresh.svg @@ -0,0 +1,12 @@ + + + + + + diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 0895ede636..4f7a3e298d 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -55,6 +55,7 @@ export default class AppTile extends React.Component { this._grantWidgetPermission = this._grantWidgetPermission.bind(this); this._revokeWidgetPermission = this._revokeWidgetPermission.bind(this); this._onPopoutWidgetClick = this._onPopoutWidgetClick.bind(this); + this._onReloadWidgetClick = this._onReloadWidgetClick.bind(this); } /** @@ -519,6 +520,11 @@ export default class AppTile extends React.Component { { target: '_blank', href: this._getSafeUrl(), rel: 'noopener noreferrer'}).click(); } + _onReloadWidgetClick(e) { + // Reload iframe in this way to avoid cross-origin restrictions + this.refs.appFrame.src = this.refs.appFrame.src; + } + render() { let appTileBody; @@ -606,6 +612,7 @@ export default class AppTile extends React.Component { const showPictureSnapshotButton = this._hasCapability('m.capability.screenshot') && this.props.show; const showPictureSnapshotIcon = 'img/camera_green.svg'; const popoutWidgetIcon = 'img/button-new-window.svg'; + const reloadWidgetIcon = 'img/button-refresh.svg'; const windowStateIcon = (this.props.show ? 'img/minimize.svg' : 'img/maximize.svg'); return ( @@ -624,6 +631,16 @@ export default class AppTile extends React.Component { { this.props.showTitle && this._getTileTitle() } + { /* Reload widget */ } + { this.props.showReload && } + { /* Popout widget */ } { this.props.showPopout &&