|
@@ -8,6 +8,7 @@ mod desktop_context;
|
|
mod escape;
|
|
mod escape;
|
|
mod eval;
|
|
mod eval;
|
|
mod events;
|
|
mod events;
|
|
|
|
+mod file_upload;
|
|
mod protocol;
|
|
mod protocol;
|
|
mod shortcut;
|
|
mod shortcut;
|
|
mod waker;
|
|
mod waker;
|
|
@@ -19,14 +20,14 @@ pub use desktop_context::{
|
|
};
|
|
};
|
|
use desktop_context::{EventData, UserWindowEvent, WebviewQueue, WindowEventHandlers};
|
|
use desktop_context::{EventData, UserWindowEvent, WebviewQueue, WindowEventHandlers};
|
|
use dioxus_core::*;
|
|
use dioxus_core::*;
|
|
-use dioxus_html::HtmlEvent;
|
|
|
|
|
|
+use dioxus_html::{native_bind::NativeFileEngine, FormData, HtmlEvent};
|
|
pub use eval::{use_eval, EvalResult};
|
|
pub use eval::{use_eval, EvalResult};
|
|
use futures_util::{pin_mut, FutureExt};
|
|
use futures_util::{pin_mut, FutureExt};
|
|
use shortcut::ShortcutRegistry;
|
|
use shortcut::ShortcutRegistry;
|
|
pub use shortcut::{use_global_shortcut, ShortcutHandle, ShortcutId, ShortcutRegistryError};
|
|
pub use shortcut::{use_global_shortcut, ShortcutHandle, ShortcutId, ShortcutRegistryError};
|
|
-use std::collections::HashMap;
|
|
|
|
use std::rc::Rc;
|
|
use std::rc::Rc;
|
|
use std::task::Waker;
|
|
use std::task::Waker;
|
|
|
|
+use std::{collections::HashMap, sync::Arc};
|
|
pub use tao::dpi::{LogicalSize, PhysicalSize};
|
|
pub use tao::dpi::{LogicalSize, PhysicalSize};
|
|
use tao::event_loop::{EventLoopProxy, EventLoopWindowTarget};
|
|
use tao::event_loop::{EventLoopProxy, EventLoopWindowTarget};
|
|
pub use tao::window::WindowBuilder;
|
|
pub use tao::window::WindowBuilder;
|
|
@@ -264,6 +265,29 @@ pub fn launch_with_props<P: 'static>(root: Component<P>, props: P, cfg: Config)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ EventData::Ipc(msg) if msg.method() == "file_diolog" => {
|
|
|
|
+ if let Ok(file_diolog) =
|
|
|
|
+ serde_json::from_value::<file_upload::FileDiologRequest>(msg.params())
|
|
|
|
+ {
|
|
|
|
+ let id = ElementId(file_diolog.target);
|
|
|
|
+ let event_name = &file_diolog.event;
|
|
|
|
+ let event_bubbles = file_diolog.bubbles;
|
|
|
|
+ let files = file_upload::get_file_event(&file_diolog);
|
|
|
|
+ let data = FormData {
|
|
|
|
+ value: Default::default(),
|
|
|
|
+ values: Default::default(),
|
|
|
|
+ files: Some(Arc::new(NativeFileEngine::new(files))),
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ let view = webviews.get_mut(&event.1).unwrap();
|
|
|
|
+
|
|
|
|
+ view.dom
|
|
|
|
+ .handle_event(event_name, Rc::new(data), id, event_bubbles);
|
|
|
|
+
|
|
|
|
+ send_edits(view.dom.render_immediate(), &view.webview);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
_ => {}
|
|
_ => {}
|
|
},
|
|
},
|
|
Event::GlobalShortcutEvent(id) => shortcut_manager.call_handlers(id),
|
|
Event::GlobalShortcutEvent(id) => shortcut_manager.call_handlers(id),
|