From 551b07960ed8ec36c24341f96f2b06fee25ceab3 Mon Sep 17 00:00:00 2001 From: Florian Orben Date: Thu, 15 Oct 2015 02:13:48 +0200 Subject: PLT-74: Enable Up Arrow keyboard shortcut to edit your last message --- web/react/components/textbox.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'web/react/components/textbox.jsx') diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx index d51fb9523..86bb42f62 100644 --- a/web/react/components/textbox.jsx +++ b/web/react/components/textbox.jsx @@ -9,6 +9,7 @@ const ErrorStore = require('../stores/error_store.jsx'); const Utils = require('../utils/utils.jsx'); const Constants = require('../utils/constants.jsx'); const ActionTypes = Constants.ActionTypes; +const KeyCodes = Constants.KeyCodes; export default class Textbox extends React.Component { constructor(props) { @@ -148,8 +149,10 @@ export default class Textbox extends React.Component { this.doProcessMentions = true; } - if (e.keyCode === 8) { + if (e.keyCode === KeyCodes.BACKSPACE) { this.handleBackspace(e); + } else if (this.props.onKeyDown) { + this.props.onKeyDown(e); } } @@ -318,5 +321,6 @@ Textbox.propTypes = { onUserInput: React.PropTypes.func.isRequired, onKeyPress: React.PropTypes.func.isRequired, onHeightChange: React.PropTypes.func, - createMessage: React.PropTypes.string.isRequired + createMessage: React.PropTypes.string.isRequired, + onKeyDown: React.PropTypes.func }; -- cgit v1.2.3-1-g7c22