Make sure to only close import alert after import is done
This commit is contained in:
1 parent
7847f9e775
commit
541c43482d
2 files changed
+15
-14
No files matched your search
@@ -161,13 +161,12 @@ class CostumeTab extends React.Component {
|
||||
handleNewCostume (costume, fromCostumeLibrary) {
|
||||
const costumes = Array.isArray(costume) ? costume : [costume];
|
||||
|
||||
costumes.forEach(c => {
|
||||
return Promise.all(costumes.map(c => {
|
||||
if (fromCostumeLibrary) {
|
||||
this.props.vm.addCostumeFromLibrary(c.md5, c);
|
||||
} else {
|
||||
this.props.vm.addCostume(c.md5, c);
|
||||
return this.props.vm.addCostumeFromLibrary(c.md5, c);
|
||||
}
|
||||
});
|
||||
return this.props.vm.addCostume(c.md5, c);
|
||||
}));
|
||||
}
|
||||
handleNewBlankCostume () {
|
||||
const name = this.props.vm.editingTarget.isStage ?
|
||||
@@ -211,10 +210,11 @@ class CostumeTab extends React.Component {
|
||||
vmCostumes.forEach((costume, i) => {
|
||||
costume.name = `${fileName}${i ? i + 1 : ''}`;
|
||||
});
|
||||
this.handleNewCostume(vmCostumes);
|
||||
if (fileIndex === fileCount - 1) {
|
||||
this.props.onCloseAlert('importingAsset');
|
||||
}
|
||||
this.handleNewCostume(vmCostumes).then(() => {
|
||||
if (fileIndex === fileCount - 1) {
|
||||
this.props.onCloseAlert('importingAsset');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ class TargetPane extends React.Component {
|
||||
this.props.onActivateTab(BLOCKS_TAB_INDEX);
|
||||
}
|
||||
handleNewSprite (spriteJSONString) {
|
||||
this.props.vm.addSprite(spriteJSONString)
|
||||
return this.props.vm.addSprite(spriteJSONString)
|
||||
.then(this.handleActivateBlocksTab);
|
||||
}
|
||||
handleFileUploadClick () {
|
||||
@@ -138,10 +138,11 @@ class TargetPane extends React.Component {
|
||||
this.props.onShowAlert('importingAsset');
|
||||
handleFileUpload(e.target, (buffer, fileType, fileName, fileIndex, fileCount) => {
|
||||
spriteUpload(buffer, fileType, fileName, storage, newSprite => {
|
||||
this.handleNewSprite(newSprite);
|
||||
if (fileIndex === fileCount - 1) {
|
||||
this.props.onCloseAlert('importingAsset');
|
||||
}
|
||||
this.handleNewSprite(newSprite).then(() => {
|
||||
if (fileIndex === fileCount - 1) {
|
||||
this.props.onCloseAlert('importingAsset');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user