fix HasFileData for WebDragData
This commit is contained in:
1 parent
53343bfd19
commit
6ca877eb6d
1 file changed
+6
-7
@@ -10,7 +10,7 @@ use dioxus_html::{
|
||||
};
|
||||
use js_sys::Array;
|
||||
use wasm_bindgen::{prelude::wasm_bindgen, JsCast, JsValue};
|
||||
use web_sys::{Document, Element, Event, MouseEvent};
|
||||
use web_sys::{Document, DragEvent, Element, Event, MouseEvent};
|
||||
|
||||
pub(crate) struct WebEventConverter;
|
||||
|
||||
@@ -529,17 +529,16 @@ impl HasFileData for WebDragData {
|
||||
#[cfg(not(feature = "file_engine"))]
|
||||
let files = None;
|
||||
#[cfg(feature = "file_engine")]
|
||||
let files = self
|
||||
.element
|
||||
.dyn_ref()
|
||||
.and_then(|input: &web_sys::HtmlInputElement| {
|
||||
input.files().and_then(|files| {
|
||||
let files = self.raw.dyn_ref::<DragEvent>().and_then(|drag_event| {
|
||||
drag_event.data_transfer().and_then(|dt| {
|
||||
dt.files().and_then(|files| {
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
crate::file_engine::WebFileEngine::new(files).map(|f| {
|
||||
std::sync::Arc::new(f) as std::sync::Arc<dyn dioxus_html::FileEngine>
|
||||
})
|
||||
})
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
files
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user