Merge pull request #2282 from vector-im/kegan/close-scalar

Listen for close_scalar and close the dialog box when received
This commit is contained in:
Kegsay 2016-09-19 10:47:36 +01:00 committed by GitHub
commit 60179aab52

View file

@ -19,6 +19,7 @@ limitations under the License.
var React = require('react'); var React = require('react');
var sdk = require('matrix-react-sdk'); var sdk = require('matrix-react-sdk');
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
var dis = require('matrix-react-sdk/lib/dispatcher');
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'IntegrationsManager', displayName: 'IntegrationsManager',
@ -31,10 +32,12 @@ module.exports = React.createClass({
// XXX: keyboard shortcuts for managing dialogs should be done by the modal // XXX: keyboard shortcuts for managing dialogs should be done by the modal
// dialog base class somehow, surely... // dialog base class somehow, surely...
componentDidMount: function() { componentDidMount: function() {
this.dispatcherRef = dis.register(this.onAction);
document.addEventListener("keydown", this.onKeyDown); document.addEventListener("keydown", this.onKeyDown);
}, },
componentWillUnmount: function() { componentWillUnmount: function() {
dis.unregister(this.dispatcherRef);
document.removeEventListener("keydown", this.onKeyDown); 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() { render: function() {
return ( return (
<div className="mx_IntegrationsManager"> <div className="mx_IntegrationsManager">