mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-23 12:39:59 +01:00
[Client] Fix bug
This commit is contained in:
parent
3e6b0e8c59
commit
5f120a5272
@ -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 => {
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user