dioxus_web/events/
clipboard.rs

1use dioxus_html::HasClipboardData;
2use web_sys::Event;
3
4use super::{Synthetic, WebEventExt};
5
6impl From<&Event> for Synthetic<Event> {
7    fn from(e: &Event) -> Self {
8        Synthetic::new(e.clone())
9    }
10}
11
12impl HasClipboardData for Synthetic<Event> {
13    fn as_any(&self) -> &dyn std::any::Any {
14        &self.event
15    }
16}
17
18impl WebEventExt for dioxus_html::ClipboardData {
19    type WebEvent = web_sys::Event;
20
21    #[inline(always)]
22    fn try_as_web_event(&self) -> Option<Self::WebEvent> {
23        self.downcast::<web_sys::Event>().cloned()
24    }
25}