Convert IntegrationsManager to a class
This commit is contained in:
parent
fac6dc25f6
commit
7c80355ea7
2 changed files with 28 additions and 30 deletions
|
@ -47,7 +47,6 @@ src/components/views/rooms/UserTile.js
|
||||||
src/components/views/settings/ChangeAvatar.js
|
src/components/views/settings/ChangeAvatar.js
|
||||||
src/components/views/settings/ChangePassword.js
|
src/components/views/settings/ChangePassword.js
|
||||||
src/components/views/settings/DevicesPanel.js
|
src/components/views/settings/DevicesPanel.js
|
||||||
src/components/views/settings/IntegrationsManager.js
|
|
||||||
src/components/views/settings/Notifications.js
|
src/components/views/settings/Notifications.js
|
||||||
src/GroupAddressPicker.js
|
src/GroupAddressPicker.js
|
||||||
src/HtmlUtils.js
|
src/HtmlUtils.js
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2015, 2016 OpenMarket Ltd
|
Copyright 2015, 2016 OpenMarket Ltd
|
||||||
|
Copyright 2019 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -14,50 +15,48 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import sdk from '../../../index';
|
||||||
|
import MatrixClientPeg from '../../../MatrixClientPeg';
|
||||||
|
import { _t } from '../../../languageHandler';
|
||||||
|
import Modal from '../../../Modal';
|
||||||
|
import dis from '../../../dispatcher';
|
||||||
|
|
||||||
const React = require('react');
|
export default class IntegrationsManager extends React.Component {
|
||||||
const sdk = require('../../../index');
|
static propTypes = {
|
||||||
const MatrixClientPeg = require('../../../MatrixClientPeg');
|
// the source of the integration manager being embedded
|
||||||
const dis = require('../../../dispatcher');
|
src: PropTypes.string.isRequired,
|
||||||
|
|
||||||
module.exports = React.createClass({
|
// callback when the manager is dismissed
|
||||||
displayName: 'IntegrationsManager',
|
onFinished: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
propTypes: {
|
componentDidMount() {
|
||||||
src: React.PropTypes.string.isRequired, // the source of the integration manager being embedded
|
|
||||||
onFinished: React.PropTypes.func.isRequired, // callback when the lightbox is dismissed
|
|
||||||
},
|
|
||||||
|
|
||||||
// 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);
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
document.addEventListener("keydown", this.onKeyDown);
|
document.addEventListener("keydown", this.onKeyDown);
|
||||||
},
|
}
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount() {
|
||||||
dis.unregister(this.dispatcherRef);
|
dis.unregister(this.dispatcherRef);
|
||||||
document.removeEventListener("keydown", this.onKeyDown);
|
document.removeEventListener("keydown", this.onKeyDown);
|
||||||
},
|
}
|
||||||
|
|
||||||
onKeyDown: function(ev) {
|
onKeyDown = (ev) => {
|
||||||
if (ev.keyCode == 27) { // escape
|
if (ev.keyCode === 27) { // escape
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
this.props.onFinished();
|
this.props.onFinished();
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
|
|
||||||
onAction: function(payload) {
|
onAction = (payload) => {
|
||||||
if (payload.action === 'close_scalar') {
|
if (payload.action === 'close_scalar') {
|
||||||
this.props.onFinished();
|
this.props.onFinished();
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
|
|
||||||
render: function() {
|
render() {
|
||||||
return (
|
return <iframe src={ this.props.src }></iframe>;
|
||||||
<iframe src={ this.props.src }></iframe>
|
}
|
||||||
);
|
}
|
||||||
},
|
|
||||||
});
|
|
Loading…
Reference in a new issue