Revert "PLT-3220 Made Create Channel modal save upon enter" (#3356)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3f333678d8
Коммит
54b4deb7df
@@ -57,7 +57,6 @@ class NewChannelFlow extends React.Component {
|
|||||||
this.urlChangeSubmitted = this.urlChangeSubmitted.bind(this);
|
this.urlChangeSubmitted = this.urlChangeSubmitted.bind(this);
|
||||||
this.urlChangeDismissed = this.urlChangeDismissed.bind(this);
|
this.urlChangeDismissed = this.urlChangeDismissed.bind(this);
|
||||||
this.channelDataChanged = this.channelDataChanged.bind(this);
|
this.channelDataChanged = this.channelDataChanged.bind(this);
|
||||||
this.enterKeyDown = this.enterKeyDown.bind(this);
|
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
serverError: '',
|
serverError: '',
|
||||||
@@ -69,15 +68,6 @@ class NewChannelFlow extends React.Component {
|
|||||||
nameModified: false
|
nameModified: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
document.addEventListener('keydown', this.enterKeyDown);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
document.removeEventListener('keydown', this.enterKeyDown);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
// If we are being shown, grab channel type from props and clear
|
// If we are being shown, grab channel type from props and clear
|
||||||
if (nextProps.show === true && this.props.show === false) {
|
if (nextProps.show === true && this.props.show === false) {
|
||||||
@@ -92,7 +82,6 @@ class NewChannelFlow extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doSubmit() {
|
doSubmit() {
|
||||||
if (!this.state.channelDisplayName) {
|
if (!this.state.channelDisplayName) {
|
||||||
this.setState({serverError: Utils.localizeMessage('channel_flow.invalidName', 'Invalid Channel Name')});
|
this.setState({serverError: Utils.localizeMessage('channel_flow.invalidName', 'Invalid Channel Name')});
|
||||||
@@ -141,14 +130,6 @@ class NewChannelFlow extends React.Component {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
enterKeyDown(e) {
|
|
||||||
if (e.keyCode === Constants.KeyCodes.ENTER) {
|
|
||||||
e.preventDefault();
|
|
||||||
this.doSubmit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typeSwitched() {
|
typeSwitched() {
|
||||||
if (this.state.channelType === 'P') {
|
if (this.state.channelType === 'P') {
|
||||||
this.setState({channelType: 'O'});
|
this.setState({channelType: 'O'});
|
||||||
@@ -156,11 +137,9 @@ class NewChannelFlow extends React.Component {
|
|||||||
this.setState({channelType: 'P'});
|
this.setState({channelType: 'P'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
urlChangeRequested() {
|
urlChangeRequested() {
|
||||||
this.setState({flowState: SHOW_EDIT_URL});
|
this.setState({flowState: SHOW_EDIT_URL});
|
||||||
}
|
}
|
||||||
|
|
||||||
urlChangeSubmitted(newURL) {
|
urlChangeSubmitted(newURL) {
|
||||||
if (this.state.flowState === SHOW_EDIT_URL_THEN_COMPLETE) {
|
if (this.state.flowState === SHOW_EDIT_URL_THEN_COMPLETE) {
|
||||||
this.setState({channelName: newURL, nameModified: true}, this.doSubmit);
|
this.setState({channelName: newURL, nameModified: true}, this.doSubmit);
|
||||||
@@ -168,11 +147,9 @@ class NewChannelFlow extends React.Component {
|
|||||||
this.setState({flowState: SHOW_NEW_CHANNEL, serverError: '', channelName: newURL, nameModified: true});
|
this.setState({flowState: SHOW_NEW_CHANNEL, serverError: '', channelName: newURL, nameModified: true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
urlChangeDismissed() {
|
urlChangeDismissed() {
|
||||||
this.setState({flowState: SHOW_NEW_CHANNEL});
|
this.setState({flowState: SHOW_NEW_CHANNEL});
|
||||||
}
|
}
|
||||||
|
|
||||||
channelDataChanged(data) {
|
channelDataChanged(data) {
|
||||||
this.setState({
|
this.setState({
|
||||||
channelDisplayName: data.displayName,
|
channelDisplayName: data.displayName,
|
||||||
@@ -182,7 +159,6 @@ class NewChannelFlow extends React.Component {
|
|||||||
this.setState({channelName: Utils.cleanUpUrlable(data.displayName.trim())});
|
this.setState({channelName: Utils.cleanUpUrlable(data.displayName.trim())});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const channelData = {
|
const channelData = {
|
||||||
name: this.state.channelName,
|
name: this.state.channelName,
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user