[PLT-5445] Mobile view: Set focus back to message box after uploading a file (#5360)

Этот коммит содержится в:
Saturnino Abril
2017-02-23 17:57:41 +09:00
коммит произвёл George Goldberg
родитель 9220254f05
Коммит f6d22ee4f0
3 изменённых файлов: 19 добавлений и 10 удалений

Просмотреть файл

@@ -45,7 +45,7 @@ export default class CreateComment extends React.Component {
this.handleChange = this.handleChange.bind(this); this.handleChange = this.handleChange.bind(this);
this.handleKeyDown = this.handleKeyDown.bind(this); this.handleKeyDown = this.handleKeyDown.bind(this);
this.handleBlur = this.handleBlur.bind(this); this.handleBlur = this.handleBlur.bind(this);
this.handleUploadClick = this.handleUploadClick.bind(this); this.handleFileUploadChange = this.handleFileUploadChange.bind(this);
this.handleUploadStart = this.handleUploadStart.bind(this); this.handleUploadStart = this.handleUploadStart.bind(this);
this.handleFileUploadComplete = this.handleFileUploadComplete.bind(this); this.handleFileUploadComplete = this.handleFileUploadComplete.bind(this);
this.handleUploadError = this.handleUploadError.bind(this); this.handleUploadError = this.handleUploadError.bind(this);
@@ -314,8 +314,8 @@ export default class CreateComment extends React.Component {
} }
} }
handleUploadClick() { handleFileUploadChange() {
this.focusTextbox(); this.focusTextbox(true);
} }
handleUploadStart(clientIds) { handleUploadStart(clientIds) {
@@ -400,9 +400,9 @@ export default class CreateComment extends React.Component {
draft.uploadsInProgress = uploadsInProgress; draft.uploadsInProgress = uploadsInProgress;
PostStore.storeCommentDraft(this.props.rootId, draft); PostStore.storeCommentDraft(this.props.rootId, draft);
const enableAddButton = this.handleEnableAddButton(this.state.message, fileInfos); this.setState({fileInfos, uploadsInProgress});
this.setState({fileInfos, uploadsInProgress, enableAddButton}); this.handleFileUploadChange();
} }
componentWillReceiveProps(newProps) { componentWillReceiveProps(newProps) {
@@ -524,7 +524,7 @@ export default class CreateComment extends React.Component {
<FileUpload <FileUpload
ref='fileUpload' ref='fileUpload'
getFileCount={this.getFileCount} getFileCount={this.getFileCount}
onClick={this.handleUploadClick} onFileUploadChange={this.handleFileUploadChange}
onUploadStart={this.handleUploadStart} onUploadStart={this.handleUploadStart}
onFileUpload={this.handleFileUploadComplete} onFileUpload={this.handleFileUploadComplete}
onUploadError={this.handleUploadError} onUploadError={this.handleUploadError}

Просмотреть файл

@@ -46,7 +46,7 @@ export default class CreatePost extends React.Component {
this.handleSubmit = this.handleSubmit.bind(this); this.handleSubmit = this.handleSubmit.bind(this);
this.postMsgKeyPress = this.postMsgKeyPress.bind(this); this.postMsgKeyPress = this.postMsgKeyPress.bind(this);
this.handleChange = this.handleChange.bind(this); this.handleChange = this.handleChange.bind(this);
this.handleUploadClick = this.handleUploadClick.bind(this); this.handleFileUploadChange = this.handleFileUploadChange.bind(this);
this.handleUploadStart = this.handleUploadStart.bind(this); this.handleUploadStart = this.handleUploadStart.bind(this);
this.handleFileUploadComplete = this.handleFileUploadComplete.bind(this); this.handleFileUploadComplete = this.handleFileUploadComplete.bind(this);
this.handleUploadError = this.handleUploadError.bind(this); this.handleUploadError = this.handleUploadError.bind(this);
@@ -244,8 +244,8 @@ export default class CreatePost extends React.Component {
PostStore.storeCurrentDraft(draft); PostStore.storeCurrentDraft(draft);
} }
handleUploadClick() { handleFileUploadChange() {
this.focusTextbox(); this.focusTextbox(true);
} }
handleUploadStart(clientIds, channelId) { handleUploadStart(clientIds, channelId) {
@@ -337,6 +337,8 @@ export default class CreatePost extends React.Component {
const enableSendButton = this.handleEnableSendButton(this.state.message, fileInfos); const enableSendButton = this.handleEnableSendButton(this.state.message, fileInfos);
this.setState({fileInfos, uploadsInProgress, enableSendButton}); this.setState({fileInfos, uploadsInProgress, enableSendButton});
this.handleFileUploadChange();
} }
componentWillMount() { componentWillMount() {
@@ -577,7 +579,7 @@ export default class CreatePost extends React.Component {
<FileUpload <FileUpload
ref='fileUpload' ref='fileUpload'
getFileCount={this.getFileCount} getFileCount={this.getFileCount}
onClick={this.handleUploadClick} onFileUploadChange={this.handleFileUploadChange}
onUploadStart={this.handleUploadStart} onUploadStart={this.handleUploadStart}
onFileUpload={this.handleFileUploadComplete} onFileUpload={this.handleFileUploadComplete}
onUploadError={this.handleUploadError} onUploadError={this.handleUploadError}

Просмотреть файл

@@ -126,6 +126,8 @@ class FileUpload extends React.Component {
Utils.clearFileInput(e.target); Utils.clearFileInput(e.target);
} }
this.props.onFileUploadChange();
} }
handleDrop(e) { handleDrop(e) {
@@ -190,6 +192,8 @@ class FileUpload extends React.Component {
self.handleDrop(e); self.handleDrop(e);
} }
}); });
this.props.onFileUploadChange();
} }
componentWillUnmount() { componentWillUnmount() {
@@ -289,6 +293,8 @@ class FileUpload extends React.Component {
this.props.onUploadStart([clientId], channelId); this.props.onUploadStart([clientId], channelId);
} }
} }
this.props.onFileUploadChange();
} }
keyUpload(e) { keyUpload(e) {
@@ -369,6 +375,7 @@ FileUpload.propTypes = {
onClick: React.PropTypes.func, onClick: React.PropTypes.func,
onFileUpload: React.PropTypes.func, onFileUpload: React.PropTypes.func,
onUploadStart: React.PropTypes.func, onUploadStart: React.PropTypes.func,
onFileUploadChange: React.PropTypes.func,
onTextDrop: React.PropTypes.func, onTextDrop: React.PropTypes.func,
channelId: React.PropTypes.string, channelId: React.PropTypes.string,
postType: React.PropTypes.string postType: React.PropTypes.string