From a4a06aa102e4abc1c4e75098f723d7b64dffeee5 Mon Sep 17 00:00:00 2001 From: David Lu Date: Thu, 12 May 2016 07:46:12 -0400 Subject: [PATCH] PLT-2755 Shortcut to upload file (#2967) * wrong ref * Changed back to CTRL+U * Fixed scope of fileUpload * Removed stray comma --- webapp/components/file_upload.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/webapp/components/file_upload.jsx b/webapp/components/file_upload.jsx index 05f1701a83..829e580b9d 100644 --- a/webapp/components/file_upload.jsx +++ b/webapp/components/file_upload.jsx @@ -284,7 +284,10 @@ class FileUpload extends React.Component { keyUpload(e) { if ((e.ctrlKey || e.metaKey) && e.keyCode === Constants.KeyCodes.U) { - $(this.refs.input).focus().trigger('click'); + e.preventDefault(); + if (this.props.postType === 'post' && document.activeElement.id === 'post_textbox' || this.props.postType === 'comment' && document.activeElement.id === 'reply_textbox') { + $(this.refs.fileInput).focus().trigger('click'); + } } }