This commit is contained in:
Andrew Pimenov 2026-09-04 10:10:13 +03:00 • committed by GitHub
commit 5d771ae2f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -310,14 +310,16 @@ export async function onFileDrop(cb: (content: string) => void): Promise<void> {
const { getCurrentWebview } = await import("@tauri-apps/api/webview");
await getCurrentWebview().onDragDropEvent(async (event) => {
if (event.payload.type !== "drop") return;
for (const path of event.payload.paths) {
await Promise.all(
event.payload.paths.map(async (path) => {
try {
const content = await invoke<string>("read_text_file", { path });
cb(content);
} catch (e) {
logger.warn("file drop rejected", path, e);
}
}
})
);
});
return;
}