Fix typo (#702)
This commit is contained in:
1 parent
fd86420c08
commit
c8f88b6428
7 files changed
+23
-23
No files matched your search
@@ -14,7 +14,7 @@ fn App(cx: Scope) -> Element {
|
|||||||
button {
|
button {
|
||||||
onclick: move |event| {
|
onclick: move |event| {
|
||||||
// now, outer won't be triggered
|
// now, outer won't be triggered
|
||||||
event.stop_propogation();
|
event.stop_propagation();
|
||||||
},
|
},
|
||||||
"inner"
|
"inner"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,18 +16,18 @@ fn app(cx: Scope) -> Element {
|
|||||||
onclick: move |_| println!("clicked! top"),
|
onclick: move |_| println!("clicked! top"),
|
||||||
"- div"
|
"- div"
|
||||||
button {
|
button {
|
||||||
onclick: move |_| println!("clicked! bottom propoate"),
|
onclick: move |_| println!("clicked! bottom propagate"),
|
||||||
"Propogate"
|
"Propagate"
|
||||||
}
|
}
|
||||||
button {
|
button {
|
||||||
onclick: move |evt| {
|
onclick: move |evt| {
|
||||||
println!("clicked! bottom no bubbling");
|
println!("clicked! bottom no bubbling");
|
||||||
evt.stop_propogation();
|
evt.stop_propagation();
|
||||||
},
|
},
|
||||||
"Dont propogate"
|
"Dont propagate"
|
||||||
}
|
}
|
||||||
button {
|
button {
|
||||||
"Does not handle clicks - only propogate"
|
"Does not handle clicks - only propagate"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -35,13 +35,13 @@ fn app(cx: Scope) -> Element {
|
|||||||
nav { class: "md:ml-auto flex flex-wrap items-center text-base justify-center" }
|
nav { class: "md:ml-auto flex flex-wrap items-center text-base justify-center" }
|
||||||
button {
|
button {
|
||||||
class: "inline-flex items-center bg-gray-800 border-0 py-1 px-3 focus:outline-none hover:bg-gray-700 rounded text-base mt-4 md:mt-0",
|
class: "inline-flex items-center bg-gray-800 border-0 py-1 px-3 focus:outline-none hover:bg-gray-700 rounded text-base mt-4 md:mt-0",
|
||||||
onmousedown: |evt| evt.stop_propogation(),
|
onmousedown: |evt| evt.stop_propagation(),
|
||||||
onclick: move |_| window.set_minimized(true),
|
onclick: move |_| window.set_minimized(true),
|
||||||
"Minimize"
|
"Minimize"
|
||||||
}
|
}
|
||||||
button {
|
button {
|
||||||
class: "inline-flex items-center bg-gray-800 border-0 py-1 px-3 focus:outline-none hover:bg-gray-700 rounded text-base mt-4 md:mt-0",
|
class: "inline-flex items-center bg-gray-800 border-0 py-1 px-3 focus:outline-none hover:bg-gray-700 rounded text-base mt-4 md:mt-0",
|
||||||
onmousedown: |evt| evt.stop_propogation(),
|
onmousedown: |evt| evt.stop_propagation(),
|
||||||
onclick: move |_| {
|
onclick: move |_| {
|
||||||
|
|
||||||
window.set_fullscreen(!**fullscreen);
|
window.set_fullscreen(!**fullscreen);
|
||||||
@@ -52,7 +52,7 @@ fn app(cx: Scope) -> Element {
|
|||||||
}
|
}
|
||||||
button {
|
button {
|
||||||
class: "inline-flex items-center bg-gray-800 border-0 py-1 px-3 focus:outline-none hover:bg-gray-700 rounded text-base mt-4 md:mt-0",
|
class: "inline-flex items-center bg-gray-800 border-0 py-1 px-3 focus:outline-none hover:bg-gray-700 rounded text-base mt-4 md:mt-0",
|
||||||
onmousedown: |evt| evt.stop_propogation(),
|
onmousedown: |evt| evt.stop_propagation(),
|
||||||
onclick: move |_| window.close(),
|
onclick: move |_| window.close(),
|
||||||
"Close"
|
"Close"
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ fn app(cx: Scope) -> Element {
|
|||||||
div {
|
div {
|
||||||
button {
|
button {
|
||||||
class: "inline-flex items-center text-white bg-green-500 border-0 py-1 px-3 hover:bg-green-700 rounded",
|
class: "inline-flex items-center text-white bg-green-500 border-0 py-1 px-3 hover:bg-green-700 rounded",
|
||||||
onmousedown: |evt| evt.stop_propogation(),
|
onmousedown: |evt| evt.stop_propagation(),
|
||||||
onclick: move |_| {
|
onclick: move |_| {
|
||||||
window.set_always_on_top(!always_on_top);
|
window.set_always_on_top(!always_on_top);
|
||||||
always_on_top.set(!always_on_top);
|
always_on_top.set(!always_on_top);
|
||||||
@@ -77,7 +77,7 @@ fn app(cx: Scope) -> Element {
|
|||||||
div {
|
div {
|
||||||
button {
|
button {
|
||||||
class: "inline-flex items-center text-white bg-blue-500 border-0 py-1 px-3 hover:bg-green-700 rounded",
|
class: "inline-flex items-center text-white bg-blue-500 border-0 py-1 px-3 hover:bg-green-700 rounded",
|
||||||
onmousedown: |evt| evt.stop_propogation(),
|
onmousedown: |evt| evt.stop_propagation(),
|
||||||
onclick: move |_| {
|
onclick: move |_| {
|
||||||
window.set_decorations(!decorations);
|
window.set_decorations(!decorations);
|
||||||
decorations.set(!decorations);
|
decorations.set(!decorations);
|
||||||
@@ -88,7 +88,7 @@ fn app(cx: Scope) -> Element {
|
|||||||
div {
|
div {
|
||||||
button {
|
button {
|
||||||
class: "inline-flex items-center text-white bg-blue-500 border-0 py-1 px-3 hover:bg-green-700 rounded",
|
class: "inline-flex items-center text-white bg-blue-500 border-0 py-1 px-3 hover:bg-green-700 rounded",
|
||||||
onmousedown: |evt| evt.stop_propogation(),
|
onmousedown: |evt| evt.stop_propagation(),
|
||||||
onclick: move |_| window.set_title("Dioxus Application"),
|
onclick: move |_| window.set_title("Dioxus Application"),
|
||||||
"Change Title"
|
"Change Title"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ use std::{
|
|||||||
pub struct Event<T: 'static + ?Sized> {
|
pub struct Event<T: 'static + ?Sized> {
|
||||||
/// The data associated with this event
|
/// The data associated with this event
|
||||||
pub data: Rc<T>,
|
pub data: Rc<T>,
|
||||||
pub(crate) propogates: Rc<Cell<bool>>,
|
pub(crate) propagates: Rc<Cell<bool>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Event<T> {
|
impl<T> Event<T> {
|
||||||
@@ -40,9 +40,9 @@ impl<T> Event<T> {
|
|||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[deprecated = "use stop_propogation instead"]
|
#[deprecated = "use stop_propagation instead"]
|
||||||
pub fn cancel_bubble(&self) {
|
pub fn cancel_bubble(&self) {
|
||||||
self.propogates.set(false);
|
self.propagates.set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Prevent this event from continuing to bubble up the tree to parent elements.
|
/// Prevent this event from continuing to bubble up the tree to parent elements.
|
||||||
@@ -58,8 +58,8 @@ impl<T> Event<T> {
|
|||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn stop_propogation(&self) {
|
pub fn stop_propagation(&self) {
|
||||||
self.propogates.set(false);
|
self.propagates.set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a reference to the inner data from this event
|
/// Get a reference to the inner data from this event
|
||||||
@@ -84,7 +84,7 @@ impl<T> Event<T> {
|
|||||||
impl<T: ?Sized> Clone for Event<T> {
|
impl<T: ?Sized> Clone for Event<T> {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
propogates: self.propogates.clone(),
|
propagates: self.propagates.clone(),
|
||||||
data: self.data.clone(),
|
data: self.data.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ impl<T> std::ops::Deref for Event<T> {
|
|||||||
impl<T: std::fmt::Debug> std::fmt::Debug for Event<T> {
|
impl<T: std::fmt::Debug> std::fmt::Debug for Event<T> {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
f.debug_struct("UiEvent")
|
f.debug_struct("UiEvent")
|
||||||
.field("bubble_state", &self.propogates)
|
.field("bubble_state", &self.propagates)
|
||||||
.field("data", &self.data)
|
.field("data", &self.data)
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ impl<'src> ScopeState {
|
|||||||
BumpBox::from_raw(self.bump().alloc(move |event: Event<dyn Any>| {
|
BumpBox::from_raw(self.bump().alloc(move |event: Event<dyn Any>| {
|
||||||
if let Ok(data) = event.data.downcast::<T>() {
|
if let Ok(data) = event.data.downcast::<T>() {
|
||||||
callback(Event {
|
callback(Event {
|
||||||
propogates: event.propogates,
|
propagates: event.propagates,
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ impl VirtualDom {
|
|||||||
|
|
||||||
// We will clone this later. The data itself is wrapped in RC to be used in callbacks if required
|
// We will clone this later. The data itself is wrapped in RC to be used in callbacks if required
|
||||||
let uievent = Event {
|
let uievent = Event {
|
||||||
propogates: Rc::new(Cell::new(bubbles)),
|
propagates: Rc::new(Cell::new(bubbles)),
|
||||||
data,
|
data,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -388,7 +388,7 @@ impl VirtualDom {
|
|||||||
cb(uievent.clone());
|
cb(uievent.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
if !uievent.propogates.get() {
|
if !uievent.propagates.get() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ impl<T> UseRef<T> {
|
|||||||
|
|
||||||
/// Set the curernt value to `new_value`. This will mark the component as "dirty"
|
/// Set the curernt value to `new_value`. This will mark the component as "dirty"
|
||||||
///
|
///
|
||||||
/// This change will propogate immediately, so any other contexts that are
|
/// This change will propagate immediately, so any other contexts that are
|
||||||
/// using this RefCell will also be affected. If called during an async context,
|
/// using this RefCell will also be affected. If called during an async context,
|
||||||
/// the component will not be re-rendered until the next `.await` call.
|
/// the component will not be re-rendered until the next `.await` call.
|
||||||
pub fn set(&self, new: T) {
|
pub fn set(&self, new: T) {
|
||||||
|
|||||||
Reference in new issue
Block a user