From a5ebbcfdb4f151de204b6be276c5f07175ceb82a Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Wed, 7 Sep 2016 01:12:27 -0300 Subject: PLT-4084 Fix Unable to send messages in RC --- webapp/components/textbox.jsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'webapp/components/textbox.jsx') diff --git a/webapp/components/textbox.jsx b/webapp/components/textbox.jsx index 791513b88..fac1bd027 100644 --- a/webapp/components/textbox.jsx +++ b/webapp/components/textbox.jsx @@ -26,6 +26,7 @@ export default class Textbox extends React.Component { this.focus = this.focus.bind(this); this.getStateFromStores = this.getStateFromStores.bind(this); this.onRecievedError = this.onRecievedError.bind(this); + this.handleKeyPress = this.handleKeyPress.bind(this); this.handleKeyDown = this.handleKeyDown.bind(this); this.handleHeightChange = this.handleHeightChange.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) { - this.props.onKeyDown(e); + if (this.props.onKeyDown) { + this.props.onKeyDown(e); + } } handleHeightChange(height) { @@ -183,6 +190,7 @@ export default class Textbox extends React.Component { maxLength={Constants.MAX_POST_LEN} placeholder={this.props.createMessage} onInput={this.props.onInput} + onKeyPress={this.handleKeyPress} onKeyDown={this.handleKeyDown} onHeightChange={this.handleHeightChange} style={{visibility: this.state.preview ? 'hidden' : 'visible'}} @@ -227,7 +235,8 @@ Textbox.propTypes = { channelId: React.PropTypes.string, messageText: React.PropTypes.string.isRequired, onInput: React.PropTypes.func.isRequired, + onKeyPress: React.PropTypes.func.isRequired, createMessage: React.PropTypes.string.isRequired, - onKeyDown: React.PropTypes.func.isRequired, + onKeyDown: React.PropTypes.func, supportsCommands: React.PropTypes.bool.isRequired }; -- cgit v1.2.3-1-g7c22