add upload button
This commit is contained in:
parent
10a4e91504
commit
db98a635b7
|
@ -37,6 +37,21 @@ export class NavDragDrop {
|
|||
this.nav_window_ref = nav_window_ref;
|
||||
this.modal_prompt = new ModalPrompt();
|
||||
this.upload_manager = new FileUploadManager(this.nav_window_ref, 6);
|
||||
this.upload_element = document.createElement('input');
|
||||
this.upload_element.type = 'file';
|
||||
this.upload_element.multiple = true;
|
||||
this.upload_element.onchange = async e => {
|
||||
var uploads = []
|
||||
for (const file of e.target.files) {
|
||||
let uploader = new FileUpload(file, this.nav_window_ref);
|
||||
uploader.using_webkit = false;
|
||||
uploads.push(uploader);
|
||||
}
|
||||
uploads = await this.handle_conflicts(uploads);
|
||||
this.upload_manager.add(... uploads);
|
||||
this.nav_window_ref.stop_load();
|
||||
}
|
||||
document.getElementById("nav-upload-btn").addEventListener("click", this.upload_dialog.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -196,4 +211,9 @@ export class NavDragDrop {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
upload_dialog() {
|
||||
this.nav_window_ref.start_load();
|
||||
this.upload_element.click();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,8 @@
|
|||
<button class="disable-while-loading pf-c-button pf-m-primary" id="nav-touch-btn" title="New File"><i class="fas fa-file-medical"></i></button>
|
||||
<div class="horizontal-spacer"></div>
|
||||
<button class="disable-while-loading pf-c-button pf-m-primary" id="nav-ln-btn" title="New Symbolic Link"><i class="fas fa-link nav-icon-decorated"><i class="fas fa-plus nav-icon-decoration"></i></i></button>
|
||||
<div class="horizontal-spacer"></div>
|
||||
<button class="disable-while-loading pf-c-button pf-m-primary" id="nav-upload-btn" title="Upload File(s)"><i class="fas fa-upload"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vertical-spacer"></div>
|
||||
|
|
Loading…
Reference in New Issue