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