mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-11 01:02:01 +03:00
Merge 069360e387 into 37cfd2144b
This commit is contained in:
commit
5d771ae2f9
1 changed files with 10 additions and 8 deletions
|
|
@ -310,14 +310,16 @@ export async function onFileDrop(cb: (content: string) => void): Promise<void> {
|
||||||
const { getCurrentWebview } = await import("@tauri-apps/api/webview");
|
const { getCurrentWebview } = await import("@tauri-apps/api/webview");
|
||||||
await getCurrentWebview().onDragDropEvent(async (event) => {
|
await getCurrentWebview().onDragDropEvent(async (event) => {
|
||||||
if (event.payload.type !== "drop") return;
|
if (event.payload.type !== "drop") return;
|
||||||
for (const path of event.payload.paths) {
|
await Promise.all(
|
||||||
|
event.payload.paths.map(async (path) => {
|
||||||
try {
|
try {
|
||||||
const content = await invoke<string>("read_text_file", { path });
|
const content = await invoke<string>("read_text_file", { path });
|
||||||
cb(content);
|
cb(content);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn("file drop rejected", path, e);
|
logger.warn("file drop rejected", path, e);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue