PLT-4084 Fix Unable to send messages in RC (#3983)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
dde7b50adf
Коммит
c99db74390
@@ -28,6 +28,7 @@ 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);
|
||||||
@@ -118,6 +119,12 @@ 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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')
|
||||||
@@ -222,7 +229,8 @@ export default class EditPostModal extends React.Component {
|
|||||||
<div className='edit-modal-body modal-body'>
|
<div className='edit-modal-body modal-body'>
|
||||||
<Textbox
|
<Textbox
|
||||||
onInput={this.handleInput}
|
onInput={this.handleInput}
|
||||||
onKeyDown={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}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export default class Textbox extends React.Component {
|
|||||||
this.focus = this.focus.bind(this);
|
this.focus = this.focus.bind(this);
|
||||||
this.getStateFromStores = this.getStateFromStores.bind(this);
|
this.getStateFromStores = this.getStateFromStores.bind(this);
|
||||||
this.onRecievedError = this.onRecievedError.bind(this);
|
this.onRecievedError = this.onRecievedError.bind(this);
|
||||||
|
this.handleKeyPress = this.handleKeyPress.bind(this);
|
||||||
this.handleKeyDown = this.handleKeyDown.bind(this);
|
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||||
this.handleHeightChange = this.handleHeightChange.bind(this);
|
this.handleHeightChange = this.handleHeightChange.bind(this);
|
||||||
this.showPreview = this.showPreview.bind(this);
|
this.showPreview = this.showPreview.bind(this);
|
||||||
@@ -68,8 +69,14 @@ export default class Textbox extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleKeyPress(e) {
|
||||||
|
this.props.onKeyPress(e);
|
||||||
|
}
|
||||||
|
|
||||||
handleKeyDown(e) {
|
handleKeyDown(e) {
|
||||||
this.props.onKeyDown(e);
|
if (this.props.onKeyDown) {
|
||||||
|
this.props.onKeyDown(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleHeightChange(height) {
|
handleHeightChange(height) {
|
||||||
@@ -183,6 +190,7 @@ export default class Textbox extends React.Component {
|
|||||||
maxLength={Constants.MAX_POST_LEN}
|
maxLength={Constants.MAX_POST_LEN}
|
||||||
placeholder={this.props.createMessage}
|
placeholder={this.props.createMessage}
|
||||||
onInput={this.props.onInput}
|
onInput={this.props.onInput}
|
||||||
|
onKeyPress={this.handleKeyPress}
|
||||||
onKeyDown={this.handleKeyDown}
|
onKeyDown={this.handleKeyDown}
|
||||||
onHeightChange={this.handleHeightChange}
|
onHeightChange={this.handleHeightChange}
|
||||||
style={{visibility: this.state.preview ? 'hidden' : 'visible'}}
|
style={{visibility: this.state.preview ? 'hidden' : 'visible'}}
|
||||||
@@ -227,7 +235,8 @@ Textbox.propTypes = {
|
|||||||
channelId: React.PropTypes.string,
|
channelId: React.PropTypes.string,
|
||||||
messageText: React.PropTypes.string.isRequired,
|
messageText: React.PropTypes.string.isRequired,
|
||||||
onInput: React.PropTypes.func.isRequired,
|
onInput: React.PropTypes.func.isRequired,
|
||||||
|
onKeyPress: React.PropTypes.func.isRequired,
|
||||||
createMessage: React.PropTypes.string.isRequired,
|
createMessage: React.PropTypes.string.isRequired,
|
||||||
onKeyDown: React.PropTypes.func.isRequired,
|
onKeyDown: React.PropTypes.func,
|
||||||
supportsCommands: React.PropTypes.bool.isRequired
|
supportsCommands: React.PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user