[*] Событие Drop Comples, и я могу увидеть Event.datatransfer.files , но путь (
Код: Выделить всё
webkitRelativePathconst folderDropped = async (event: React.DragEvent) => {
event.preventDefault();
// If a folder or file has been dragged
if (event.dataTransfer.files.length > 0) {
const filePath = event.dataTransfer.files[0].path;
console.log("Drop event:", event.dataTransfer.files);
console.log("Dropped file path:", filePath);
// Call the IPC handler: readDroppedFile
const result = await window.api.readDroppedFile(filePath, browserWindowId);
console.log("readDroppedFile result:", result);
/* Further Process:
After the api call, the object is checked if its a folder and that it contains files
of a specific type (for example, only PNG files). Once confirmed, the main process will scan through all the
files within the folder recursively.
*/
}
};
< /code>
Visual Studio Code, который также построен с помощью электрона, может принять отбрасываемые файлы и папки у исследователя, так что это также возможно для моего приложения. /> Windows 11 < /li>
< /ul>
Подробнее здесь: https://stackoverflow.com/questions/794 ... rocess-the
Мобильная версия