Update file drop event handling in App.tsx
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import { open } from "@tauri-apps/plugin-dialog";
|
import { open } from "@tauri-apps/plugin-dialog";
|
||||||
import { invoke } from "@tauri-apps/api/core";
|
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.";
|
const IMAGE_PROMPT_PLACEHOLDER = "Generated image prompt will appear here.";
|
||||||
|
|
||||||
@@ -136,9 +136,9 @@ export default function App() {
|
|||||||
let unlisten: (() => void) | undefined;
|
let unlisten: (() => void) | undefined;
|
||||||
const attach = async () => {
|
const attach = async () => {
|
||||||
try {
|
try {
|
||||||
const current = getCurrent() as any;
|
const current = getCurrentWebview() as any;
|
||||||
unlisten = await current.onFileDropEvent((event: any) => {
|
unlisten = await current.onDragDropEvent((event: any) => {
|
||||||
if (event.payload.type === "drop") {
|
if (event.payload?.type === "drop") {
|
||||||
const paths = event.payload.paths ?? [];
|
const paths = event.payload.paths ?? [];
|
||||||
if (paths.length) {
|
if (paths.length) {
|
||||||
void addFilesByPath(paths, true);
|
void addFilesByPath(paths, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user