Fix bug
This commit is contained in:
parent
7245a2fff2
commit
bce6c006b2
|
@ -3,7 +3,7 @@
|
||||||
<header>
|
<header>
|
||||||
<h1>%i18n:mobile.tags.mk-drive-selector.select-file%<span class="count" if={ files.length > 0 }>({ files.length })</span></h1>
|
<h1>%i18n:mobile.tags.mk-drive-selector.select-file%<span class="count" if={ files.length > 0 }>({ files.length })</span></h1>
|
||||||
<button class="close" onclick={ cancel }><i class="fa fa-times"></i></button>
|
<button class="close" onclick={ cancel }><i class="fa fa-times"></i></button>
|
||||||
<button class="ok" onclick={ ok }><i class="fa fa-check"></i></button>
|
<button if={ opts.multiple } class="ok" onclick={ ok }><i class="fa fa-check"></i></button>
|
||||||
</header>
|
</header>
|
||||||
<mk-drive ref="browser" select-file={ true } multiple={ opts.multiple }/>
|
<mk-drive ref="browser" select-file={ true } multiple={ opts.multiple }/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -68,6 +68,11 @@
|
||||||
files: files
|
files: files
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.refs.browser.on('selected', file => {
|
||||||
|
this.trigger('selected', file);
|
||||||
|
this.unmount();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.cancel = () => {
|
this.cancel = () => {
|
||||||
|
|
|
@ -190,7 +190,7 @@
|
||||||
this.file = null;
|
this.file = null;
|
||||||
|
|
||||||
this.isFileSelectMode = this.opts.selectFile;
|
this.isFileSelectMode = this.opts.selectFile;
|
||||||
this.multiple =this.opts.multiple;
|
this.multiple = this.opts.multiple;
|
||||||
|
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.stream.on('drive_file_created', this.onStreamDriveFileCreated);
|
this.stream.on('drive_file_created', this.onStreamDriveFileCreated);
|
||||||
|
@ -435,6 +435,7 @@
|
||||||
|
|
||||||
this.chooseFile = file => {
|
this.chooseFile = file => {
|
||||||
if (this.isFileSelectMode) {
|
if (this.isFileSelectMode) {
|
||||||
|
if (this.multiple) {
|
||||||
if (this.selectedFiles.some(f => f.id == file.id)) {
|
if (this.selectedFiles.some(f => f.id == file.id)) {
|
||||||
this.selectedFiles = this.selectedFiles.filter(f => f.id != file.id);
|
this.selectedFiles = this.selectedFiles.filter(f => f.id != file.id);
|
||||||
} else {
|
} else {
|
||||||
|
@ -442,6 +443,9 @@
|
||||||
}
|
}
|
||||||
this.update();
|
this.update();
|
||||||
this.trigger('change-selection', this.selectedFiles);
|
this.trigger('change-selection', this.selectedFiles);
|
||||||
|
} else {
|
||||||
|
this.trigger('selected', file);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.cf(file);
|
this.cf(file);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue