Revert "PLT-3220 Fixed create channel modal not saving upon enter" (#3378)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0485c5f64e
Коммит
86d3c32a24
@@ -4,8 +4,6 @@
|
|||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
import Constants from 'utils/constants.jsx';
|
|
||||||
import PreferenceStore from 'stores/preference_store.jsx';
|
|
||||||
|
|
||||||
import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'react-intl';
|
import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'react-intl';
|
||||||
|
|
||||||
@@ -26,16 +24,11 @@ class NewChannelModal extends React.Component {
|
|||||||
|
|
||||||
this.handleSubmit = this.handleSubmit.bind(this);
|
this.handleSubmit = this.handleSubmit.bind(this);
|
||||||
this.handleChange = this.handleChange.bind(this);
|
this.handleChange = this.handleChange.bind(this);
|
||||||
this.onEnterKeyDown = this.onEnterKeyDown.bind(this);
|
|
||||||
this.onPreferenceChange = this.onPreferenceChange.bind(this);
|
|
||||||
|
|
||||||
this.ctrlSend = PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'send_on_ctrl_enter');
|
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
displayNameError: ''
|
displayNameError: ''
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if (nextProps.show === true && this.props.show === false) {
|
if (nextProps.show === true && this.props.show === false) {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -43,32 +36,11 @@ class NewChannelModal extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (Utils.isBrowserIE()) {
|
if (Utils.isBrowserIE()) {
|
||||||
$('body').addClass('browser--ie');
|
$('body').addClass('browser--ie');
|
||||||
}
|
}
|
||||||
document.addEventListener('keydown', this.onEnterKeyDown);
|
|
||||||
PreferenceStore.addChangeListener(this.onPreferenceChange);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
document.removeEventListener('keydown', this.onEnterKeyDown);
|
|
||||||
PreferenceStore.removeChangeListener(this.onPreferenceChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
onPreferenceChange() {
|
|
||||||
this.ctrlSend = PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'send_on_ctrl_enter');
|
|
||||||
}
|
|
||||||
|
|
||||||
onEnterKeyDown(e) {
|
|
||||||
if (this.ctrlSend && e.keyCode === Constants.KeyCodes.ENTER && e.ctrlKey) {
|
|
||||||
this.handleSubmit(e);
|
|
||||||
} else if (!this.ctrlSend && e.keyCode === Constants.KeyCodes.ENTER && !e.shiftKey && !e.altKey) {
|
|
||||||
this.handleSubmit(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSubmit(e) {
|
handleSubmit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
@@ -80,7 +52,6 @@ class NewChannelModal extends React.Component {
|
|||||||
|
|
||||||
this.props.onSubmitChannel();
|
this.props.onSubmitChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChange() {
|
handleChange() {
|
||||||
const newData = {
|
const newData = {
|
||||||
displayName: ReactDOM.findDOMNode(this.refs.display_name).value,
|
displayName: ReactDOM.findDOMNode(this.refs.display_name).value,
|
||||||
@@ -88,7 +59,6 @@ class NewChannelModal extends React.Component {
|
|||||||
};
|
};
|
||||||
this.props.onDataChanged(newData);
|
this.props.onDataChanged(newData);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
var displayNameError = null;
|
var displayNameError = null;
|
||||||
var serverError = null;
|
var serverError = null;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user