Added the ability to cancel file uploads on comments
Этот коммит содержится в:
@@ -150,10 +150,18 @@ module.exports = React.createClass({
|
||||
},
|
||||
removePreview: function(filename) {
|
||||
var previews = this.state.previews;
|
||||
for (var i = 0; i < previews.length; i++) {
|
||||
if (previews[i] === filename) {
|
||||
previews.splice(i, 1);
|
||||
break;
|
||||
var uploadsInProgress = this.state.uploadsInProgress;
|
||||
|
||||
// this can be either an uploaded file or an in progress upload that we need to remove
|
||||
var index = previews.indexOf(filename);
|
||||
if (index !== -1) {
|
||||
previews.splice(index, 1);
|
||||
} else {
|
||||
index = uploadsInProgress.indexOf(filename);
|
||||
|
||||
if (index !== -1) {
|
||||
uploadsInProgress.splice(index, 1);
|
||||
this.refs.fileUpload.cancelUpload(filename);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,9 +170,10 @@ module.exports = React.createClass({
|
||||
draft = { message: '', uploadsInProgress: []};
|
||||
}
|
||||
draft.previews = previews;
|
||||
draft.uploadsInProgress = uploadsInProgress;
|
||||
PostStore.storeCommentDraft(this.props.rootId, draft);
|
||||
|
||||
this.setState({previews: previews});
|
||||
this.setState({previews: previews, uploadsInProgress: uploadsInProgress});
|
||||
},
|
||||
getInitialState: function() {
|
||||
PostStore.clearCommentDraftUploads();
|
||||
@@ -225,6 +234,7 @@ module.exports = React.createClass({
|
||||
id="reply_textbox"
|
||||
ref="textbox" />
|
||||
<FileUpload
|
||||
ref='fileUpload'
|
||||
getFileCount={this.getFileCount}
|
||||
onUploadStart={this.handleUploadStart}
|
||||
onFileUpload={this.handleFileUploadComplete}
|
||||
|
||||
Ссылка в новой задаче
Block a user