Update file drop event handling in App.tsx

This commit is contained in:
2026-02-04 07:19:00 +01:00
parent 9695382070
commit 1fac38dbe0

View File

@@ -1,7 +1,7 @@
import { useEffect, useMemo, useState } from "react";
import { open } from "@tauri-apps/plugin-dialog";
import { invoke } from "@tauri-apps/api/core";
import { getCurrent } from "@tauri-apps/api/webviewWindow";
import { getCurrentWebview } from "@tauri-apps/api/webview";
const IMAGE_PROMPT_PLACEHOLDER = "Generated image prompt will appear here.";
@@ -136,9 +136,9 @@ export default function App() {
let unlisten: (() => void) | undefined;
const attach = async () => {
try {
const current = getCurrent() as any;
unlisten = await current.onFileDropEvent((event: any) => {
if (event.payload.type === "drop") {
const current = getCurrentWebview() as any;
unlisten = await current.onDragDropEvent((event: any) => {
if (event.payload?.type === "drop") {
const paths = event.payload.paths ?? [];
if (paths.length) {
void addFilesByPath(paths, true);