mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-10 15:42:01 +03:00
Merge ece847ef50 into 37cfd2144b
This commit is contained in:
commit
383d0edd9e
1 changed files with 6 additions and 3 deletions
|
|
@ -324,8 +324,11 @@ export async function onFileDrop(cb: (content: string) => void): Promise<void> {
|
|||
window.addEventListener("dragover", (e) => e.preventDefault());
|
||||
window.addEventListener("drop", async (e) => {
|
||||
e.preventDefault();
|
||||
for (const f of e.dataTransfer?.files ?? []) {
|
||||
if (/\.(numi|txt|md)$/i.test(f.name)) cb(await f.text());
|
||||
}
|
||||
const files = Array.from(e.dataTransfer?.files ?? []);
|
||||
await Promise.all(
|
||||
files
|
||||
.filter((f) => /\.(numi|txt|md)$/i.test(f.name))
|
||||
.map(async (f) => cb(await f.text()))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue