Skip to content

Commit

Permalink
multiple files upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Metelkin committed Nov 1, 2023
1 parent 989894f commit a3b45ae
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
- Dot support
- hot keys for InfoPage
- drug and drop directory
- multiple files upload
- Download project button
- switch monaco themes
? platform.yml
Expand Down
13 changes: 8 additions & 5 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ $(async () => {
});

// Drag and Drop
new DnDFileController(async (file) => {
await leftCollection.addPageFromFile(file);
new DnDFileController(async (files) => {
for (let file of files) {
await leftCollection.addPageFromFile(file);
}
});

// add file or template to left panel
Expand All @@ -149,10 +151,11 @@ $(async () => {
let value = evt.target.value;
evt.target.value = '';
if (value==='loadFile') { // from file
$('<input type="file" accept=".yml,.yaml,.json,.xml,.heta,.txt,.csv,.xlsx" multiple=false/>')
$('<input type="file" accept=".yml,.yaml,.json,.xml,.heta,.txt,.csv,.xlsx" multiple=true/>')
.on('change', async (evt) => {
let file = $(evt.target)[0].files[0];
await leftCollection.addPageFromFile(file);
for (let file of $(evt.target)[0].files) {
await leftCollection.addPageFromFile(file);
}
})
.click();
} else { // from template
Expand Down
2 changes: 1 addition & 1 deletion src/drug-and-drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function DnDFileController(onDropCallback) {
//el_.classList.remove('dropping');
m.style.display = 'none';

onDropCallback(evt.dataTransfer.files[0]);
onDropCallback(evt.dataTransfer.files);
};

el_.addEventListener('dragenter', this.dragenter, false);
Expand Down

0 comments on commit a3b45ae

Please sign in to comment.