diff --git a/webapp/components/create_comment.jsx b/webapp/components/create_comment.jsx index 0e9d2a41ae..d9d66c8fa9 100644 --- a/webapp/components/create_comment.jsx +++ b/webapp/components/create_comment.jsx @@ -331,6 +331,9 @@ export default class CreateComment extends React.Component { draft.fileInfos = draft.fileInfos.concat(fileInfos); PostStore.storeCommentDraft(this.props.rootId, draft); + // Focus on preview if needed + this.refs.preview.refs.container.scrollIntoViewIfNeeded(); + this.setState({uploadsInProgress: draft.uploadsInProgress, fileInfos: draft.fileInfos}); } @@ -355,6 +358,9 @@ export default class CreateComment extends React.Component { const fileInfos = this.state.fileInfos; const uploadsInProgress = this.state.uploadsInProgress; + // Clear previous errors + this.handleUploadError(null); + // id can either be the id of an uploaded file or the client id of an in progress upload let index = fileInfos.findIndex((info) => info.id === id); if (index === -1) { @@ -432,6 +438,7 @@ export default class CreateComment extends React.Component { fileInfos={this.state.fileInfos} onRemove={this.removePreview} uploadsInProgress={this.state.uploadsInProgress} + ref='preview' /> ); } diff --git a/webapp/components/create_post.jsx b/webapp/components/create_post.jsx index e1b2ca059b..9269633ff4 100644 --- a/webapp/components/create_post.jsx +++ b/webapp/components/create_post.jsx @@ -297,6 +297,9 @@ export default class CreatePost extends React.Component { const fileInfos = Object.assign([], this.state.fileInfos); const uploadsInProgress = this.state.uploadsInProgress; + // Clear previous errors + this.handleUploadError(null); + // id can either be the id of an uploaded file or the client id of an in progress upload let index = fileInfos.findIndex((info) => info.id === id); if (index === -1) { diff --git a/webapp/components/file_preview.jsx b/webapp/components/file_preview.jsx index 53cec7f7b7..624bfaf445 100644 --- a/webapp/components/file_preview.jsx +++ b/webapp/components/file_preview.jsx @@ -84,7 +84,10 @@ export default class FilePreview extends React.Component { }); return ( -