[Client] Fix bug

This commit is contained in:
syuilo 2017-02-25 13:23:54 +09:00
parent 306da1b43a
commit c338c1b844
3 changed files with 18 additions and 7 deletions

View file

@ -516,13 +516,23 @@
};
this.chooseFile = file => {
if (this.selectedFiles.some(f => f.id == file.id)) {
const isAlreadySelected = this.selectedFiles.some(f => f.id == file.id);
if (this.multiple) {
if (isAlreadySelected) {
this.selectedFiles = this.selectedFiles.filter(f => f.id != file.id);
} else {
this.selectedFiles.push(file);
}
this.update();
this.trigger('change-selection', this.selectedFiles);
} else {
if (isAlreadySelected) {
this.trigger('selected', file);
} else {
this.selectedFiles = [file];
this.trigger('change-selection', [file]);
}
}
};
this.newWindow = folderId => {

View file

@ -156,6 +156,7 @@
this.browser.on('change-selection', selections => {
this.isSelected = selections.some(f => f.id == this.file.id);
this.update();
});
this.onclick = () => {

View file

@ -142,7 +142,7 @@
this.on('mount', () => {
this.refs.window.refs.browser.on('selected', file => {
this.files = file;
this.files = [file];
this.ok();
});
@ -166,7 +166,7 @@
};
this.ok = () => {
this.trigger('selected', this.files);
this.trigger('selected', this.multiple ? this.files : this.files[0]);
this.refs.window.close();
};
</script>