mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-10 06:34:20 +00:00
Fix desktop drag events that don't have associated files (#2358)
This commit is contained in:
parent
c835512b04
commit
6234f60b0e
2 changed files with 13 additions and 12 deletions
File diff suppressed because one or more lines are too long
|
@ -194,12 +194,17 @@ function serializeAnimationEvent(event: AnimationEvent): SerializedEvent {
|
|||
}
|
||||
|
||||
function serializeDragEvent(event: DragEvent): SerializedEvent {
|
||||
// let files = [];
|
||||
// if (event.dataTransfer && event.dataTransfer.files) {
|
||||
// files = ["a", "b", "c"];
|
||||
// // files = await serializeFileList(event.dataTransfer.files);
|
||||
// }
|
||||
// return { mouse: get_mouse_data(event), files };
|
||||
let files = undefined;
|
||||
// On desktop if there is file data, we insert it from wry. We just add a placeholder to let the rust side of dioxus know there's files
|
||||
if (
|
||||
event.dataTransfer &&
|
||||
event.dataTransfer.files &&
|
||||
event.dataTransfer.files.length > 0
|
||||
) {
|
||||
files = {
|
||||
files: { placeholder: [] },
|
||||
};
|
||||
}
|
||||
return {
|
||||
mouse: {
|
||||
alt_key: event.altKey,
|
||||
|
@ -208,10 +213,6 @@ function serializeDragEvent(event: DragEvent): SerializedEvent {
|
|||
shift_key: event.shiftKey,
|
||||
...serializeMouseEvent(event),
|
||||
},
|
||||
files: {
|
||||
files: {
|
||||
"a": [1, 2, 3],
|
||||
}
|
||||
},
|
||||
files,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue