Skip to content
Snippets Groups Projects
Commit c338c1b8 authored by syuilo's avatar syuilo
Browse files

[Client] Fix bug

parent 306da1b4
No related merge requests found
......@@ -516,13 +516,23 @@
};
this.chooseFile = file => {
if (this.selectedFiles.some(f => f.id == file.id)) {
this.selectedFiles = this.selectedFiles.filter(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 {
this.selectedFiles.push(file);
if (isAlreadySelected) {
this.trigger('selected', file);
} else {
this.selectedFiles = [file];
this.trigger('change-selection', [file]);
}
}
this.update();
this.trigger('change-selection', this.selectedFiles);
};
this.newWindow = folderId => {
......
......@@ -156,6 +156,7 @@
this.browser.on('change-selection', selections => {
this.isSelected = selections.some(f => f.id == this.file.id);
this.update();
});
this.onclick = () => {
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment