fix desktop mounted event

This commit is contained in:
Evan Almloff committed 2023-10-20 08:45:04 -05:00
1 parent 007aacc247
commit 378cbfabd9
5 files changed
+17 -126

No files matched your search

+6 -3
View File
@@ -29,7 +29,7 @@ impl RenderedElementBacking for LiveviewElement {
>,
>,
> {
let script = format!("return getClientRect({});", self.id.0);
let script = format!("return window.interpreter.getClientRect({});", self.id.0);
let fut = self
.query
@@ -53,7 +53,7 @@ impl RenderedElementBacking for LiveviewElement {
behavior: dioxus_html::ScrollBehavior,
) -> std::pin::Pin<Box<dyn futures_util::Future<Output = dioxus_html::MountedResult<()>>>> {
let script = format!(
"return scrollTo({}, {});",
"return window.interpreter.scrollTo({}, {});",
self.id.0,
serde_json::to_string(&behavior).expect("Failed to serialize ScrollBehavior")
);
@@ -76,7 +76,10 @@ impl RenderedElementBacking for LiveviewElement {
&self,
focus: bool,
) -> std::pin::Pin<Box<dyn futures_util::Future<Output = dioxus_html::MountedResult<()>>>> {
let script = format!("return setFocus({}, {});", self.id.0, focus);
let script = format!(
"return window.interpreter.setFocus({}, {});",
self.id.0, focus
);
let fut = self.query.new_query::<bool>(&script).resolve();