PLT-4025 "CTRL+ENTER" option isn't honoured on the edit dialog after a refresh (#3948)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
37068bfdc0
Коммит
6e0c3605fb
@@ -28,7 +28,6 @@ export default class EditPostModal extends React.Component {
|
|||||||
this.handleEdit = this.handleEdit.bind(this);
|
this.handleEdit = this.handleEdit.bind(this);
|
||||||
this.handleEditKeyPress = this.handleEditKeyPress.bind(this);
|
this.handleEditKeyPress = this.handleEditKeyPress.bind(this);
|
||||||
this.handleEditPostEvent = this.handleEditPostEvent.bind(this);
|
this.handleEditPostEvent = this.handleEditPostEvent.bind(this);
|
||||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
||||||
this.handleInput = this.handleInput.bind(this);
|
this.handleInput = this.handleInput.bind(this);
|
||||||
this.onPreferenceChange = this.onPreferenceChange.bind(this);
|
this.onPreferenceChange = this.onPreferenceChange.bind(this);
|
||||||
this.onModalHidden = this.onModalHidden.bind(this);
|
this.onModalHidden = this.onModalHidden.bind(this);
|
||||||
@@ -37,7 +36,16 @@ export default class EditPostModal extends React.Component {
|
|||||||
this.onModalHide = this.onModalHide.bind(this);
|
this.onModalHide = this.onModalHide.bind(this);
|
||||||
this.onModalKeyDown = this.onModalKeyDown.bind(this);
|
this.onModalKeyDown = this.onModalKeyDown.bind(this);
|
||||||
|
|
||||||
this.state = {editText: '', originalText: '', title: '', post_id: '', channel_id: '', comments: 0, refocusId: ''};
|
this.state = {
|
||||||
|
editText: '',
|
||||||
|
originalText: '',
|
||||||
|
title: '',
|
||||||
|
post_id: '',
|
||||||
|
channel_id: '',
|
||||||
|
comments: 0,
|
||||||
|
refocusId: '',
|
||||||
|
ctrlSend: PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'send_on_ctrl_enter')
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
handleEdit() {
|
handleEdit() {
|
||||||
@@ -88,11 +96,11 @@ export default class EditPostModal extends React.Component {
|
|||||||
if (!this.state.ctrlSend && e.which === KeyCodes.ENTER && !e.shiftKey && !e.altKey) {
|
if (!this.state.ctrlSend && e.which === KeyCodes.ENTER && !e.shiftKey && !e.altKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
ReactDOM.findDOMNode(this.refs.editbox).blur();
|
ReactDOM.findDOMNode(this.refs.editbox).blur();
|
||||||
this.handleEdit(e);
|
this.handleEdit();
|
||||||
} else if (this.state.ctrlSend && e.ctrlKey && e.which === KeyCodes.ENTER) {
|
} else if (this.state.ctrlSend && e.ctrlKey && e.which === KeyCodes.ENTER) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
ReactDOM.findDOMNode(this.refs.editbox).blur();
|
ReactDOM.findDOMNode(this.refs.editbox).blur();
|
||||||
this.handleSubmit(e);
|
this.handleEdit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,12 +118,6 @@ export default class EditPostModal extends React.Component {
|
|||||||
$(ReactDOM.findDOMNode(this.refs.modal)).modal('show');
|
$(ReactDOM.findDOMNode(this.refs.modal)).modal('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
handleKeyDown(e) {
|
|
||||||
if (this.state.ctrlSend && e.keyCode === KeyCodes.ENTER && e.ctrlKey === true) {
|
|
||||||
this.handleEdit(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onPreferenceChange() {
|
onPreferenceChange() {
|
||||||
this.setState({
|
this.setState({
|
||||||
ctrlSend: PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'send_on_ctrl_enter')
|
ctrlSend: PreferenceStore.getBool(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, 'send_on_ctrl_enter')
|
||||||
@@ -204,7 +206,6 @@ export default class EditPostModal extends React.Component {
|
|||||||
className='close'
|
className='close'
|
||||||
data-dismiss='modal'
|
data-dismiss='modal'
|
||||||
aria-label='Close'
|
aria-label='Close'
|
||||||
onClick={this.handleEditClose}
|
|
||||||
>
|
>
|
||||||
<span aria-hidden='true'>{'×'}</span>
|
<span aria-hidden='true'>{'×'}</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -222,7 +223,6 @@ export default class EditPostModal extends React.Component {
|
|||||||
<Textbox
|
<Textbox
|
||||||
onInput={this.handleInput}
|
onInput={this.handleInput}
|
||||||
onKeyPress={this.handleEditKeyPress}
|
onKeyPress={this.handleEditKeyPress}
|
||||||
onKeyDown={this.handleKeyDown}
|
|
||||||
messageText={this.state.editText}
|
messageText={this.state.editText}
|
||||||
createMessage={Utils.localizeMessage('edit_post.editPost', 'Edit the post...')}
|
createMessage={Utils.localizeMessage('edit_post.editPost', 'Edit the post...')}
|
||||||
supportsCommands={false}
|
supportsCommands={false}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user