diff options
author | enahum <nahumhbl@gmail.com> | 2016-09-06 09:22:47 -0300 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-09-06 08:22:47 -0400 |
commit | 6e0c3605fbe1d0101c8a89fca7b15faaeb98440c (patch) | |
tree | 120e3c220f1e6d28861c417ea3d29397f556469b /webapp/components/edit_post_modal.jsx | |
parent | 37068bfdc0321d93845c9d3705457ed2e250ef6e (diff) | |
download | chat-6e0c3605fbe1d0101c8a89fca7b15faaeb98440c.tar.gz chat-6e0c3605fbe1d0101c8a89fca7b15faaeb98440c.tar.bz2 chat-6e0c3605fbe1d0101c8a89fca7b15faaeb98440c.zip |
PLT-4025 "CTRL+ENTER" option isn't honoured on the edit dialog after a refresh (#3948)
Diffstat (limited to 'webapp/components/edit_post_modal.jsx')
-rw-r--r-- | webapp/components/edit_post_modal.jsx | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/webapp/components/edit_post_modal.jsx b/webapp/components/edit_post_modal.jsx index b346503a9..40029064f 100644 --- a/webapp/components/edit_post_modal.jsx +++ b/webapp/components/edit_post_modal.jsx @@ -28,7 +28,6 @@ export default class EditPostModal extends React.Component { this.handleEdit = this.handleEdit.bind(this); this.handleEditKeyPress = this.handleEditKeyPress.bind(this); this.handleEditPostEvent = this.handleEditPostEvent.bind(this); - this.handleKeyDown = this.handleKeyDown.bind(this); this.handleInput = this.handleInput.bind(this); this.onPreferenceChange = this.onPreferenceChange.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.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() { @@ -88,11 +96,11 @@ export default class EditPostModal extends React.Component { if (!this.state.ctrlSend && e.which === KeyCodes.ENTER && !e.shiftKey && !e.altKey) { e.preventDefault(); ReactDOM.findDOMNode(this.refs.editbox).blur(); - this.handleEdit(e); + this.handleEdit(); } else if (this.state.ctrlSend && e.ctrlKey && e.which === KeyCodes.ENTER) { e.preventDefault(); 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'); } - handleKeyDown(e) { - if (this.state.ctrlSend && e.keyCode === KeyCodes.ENTER && e.ctrlKey === true) { - this.handleEdit(e); - } - } - onPreferenceChange() { this.setState({ 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' data-dismiss='modal' aria-label='Close' - onClick={this.handleEditClose} > <span aria-hidden='true'>{'×'}</span> </button> @@ -222,7 +223,6 @@ export default class EditPostModal extends React.Component { <Textbox onInput={this.handleInput} onKeyPress={this.handleEditKeyPress} - onKeyDown={this.handleKeyDown} messageText={this.state.editText} createMessage={Utils.localizeMessage('edit_post.editPost', 'Edit the post...')} supportsCommands={false} |