change prevent default to detect on{event} rather than {event}

This commit is contained in:
Evan Almloff committed 2022-05-05 11:37:11 -05:00
1 parent bbe9c1bbf0
commit 53d5ea2f42
1 file changed
+14 -14
+14 -14
View File
@@ -69,20 +69,20 @@ impl NodeDepState for PreventDefault {
.find(|a| a.name == "dioxus-prevent-default") .find(|a| a.name == "dioxus-prevent-default")
.map(|a| a.value) .map(|a| a.value)
{ {
Some("focus") => PreventDefault::Focus, Some("onfocus") => PreventDefault::Focus,
Some("keypress") => PreventDefault::KeyPress, Some("onkeypress") => PreventDefault::KeyPress,
Some("keyrelease") => PreventDefault::KeyRelease, Some("onkeyrelease") => PreventDefault::KeyRelease,
Some("keydown") => PreventDefault::KeyDown, Some("onkeydown") => PreventDefault::KeyDown,
Some("keyup") => PreventDefault::KeyUp, Some("onkeyup") => PreventDefault::KeyUp,
Some("click") => PreventDefault::Click, Some("onclick") => PreventDefault::Click,
Some("mousedown") => PreventDefault::MouseDown, Some("onmousedown") => PreventDefault::MouseDown,
Some("mouseup") => PreventDefault::MouseUp, Some("onmouseup") => PreventDefault::MouseUp,
Some("mouseenter") => PreventDefault::MouseEnter, Some("onmouseenter") => PreventDefault::MouseEnter,
Some("mouseover") => PreventDefault::MouseOver, Some("onmouseover") => PreventDefault::MouseOver,
Some("mouseleave") => PreventDefault::MouseLeave, Some("onmouseleave") => PreventDefault::MouseLeave,
Some("mouseout") => PreventDefault::MouseOut, Some("onmouseout") => PreventDefault::MouseOut,
Some("wheel") => PreventDefault::Wheel, Some("onwheel") => PreventDefault::Wheel,
Some("contextmenu") => PreventDefault::ContextMenu, Some("oncontextmenu") => PreventDefault::ContextMenu,
_ => return false, _ => return false,
}; };
if new == *self { if new == *self {