add file property to drag data

This commit is contained in:
Evan Almloff committed 2023-04-27 10:21:05 -05:00
1 parent c904411190
commit ada246c12e
11 files changed
+133 -77

No files matched your search

+1 -1
View File
@@ -87,7 +87,7 @@ impl Config {
self
}
/// Set a file drop handler
/// Set a file drop handler. If this is enabled, html drag events will be disabled.
pub fn with_file_drop_handler(
mut self,
handler: impl Fn(&Window, FileDropEvent) -> bool + 'static,
+4 -6
View File
@@ -49,14 +49,12 @@ pub fn build(
.with_custom_protocol(String::from("dioxus"), move |r| {
protocol::desktop_handler(r, custom_head.clone(), index_file.clone(), &root_name)
})
.with_file_drop_handler(move |window, evet| {
file_handler
.as_ref()
.map(|handler| handler(window, evet))
.unwrap_or_default()
})
.with_web_context(&mut web_context);
if let Some(handler) = file_handler {
webview = webview.with_file_drop_handler(handler)
}
#[cfg(windows)]
{
// Windows has a platform specific settings to disable the browser shortcut keys