From de38a32969a6c5da34666ed6c8e27c7747a9fd83 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Mon, 19 Sep 2016 10:37:19 +0100 Subject: [PATCH] Listen for close_scalar and close the dialog box when received --- src/components/views/settings/IntegrationsManager.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/views/settings/IntegrationsManager.js b/src/components/views/settings/IntegrationsManager.js index 8db010a2b0..a248d2f651 100644 --- a/src/components/views/settings/IntegrationsManager.js +++ b/src/components/views/settings/IntegrationsManager.js @@ -19,6 +19,7 @@ limitations under the License. var React = require('react'); var sdk = require('matrix-react-sdk'); var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); +var dis = require('matrix-react-sdk/lib/dispatcher'); module.exports = React.createClass({ displayName: 'IntegrationsManager', @@ -31,10 +32,12 @@ module.exports = React.createClass({ // XXX: keyboard shortcuts for managing dialogs should be done by the modal // dialog base class somehow, surely... componentDidMount: function() { + this.dispatcherRef = dis.register(this.onAction); document.addEventListener("keydown", this.onKeyDown); }, componentWillUnmount: function() { + dis.unregister(this.dispatcherRef); document.removeEventListener("keydown", this.onKeyDown); }, @@ -46,6 +49,12 @@ module.exports = React.createClass({ } }, + onAction: function(payload) { + if (payload.action === 'close_scalar') { + this.props.onFinished(); + } + }, + render: function() { return (