|
@@ -200,14 +200,35 @@ export class Interpreter {
|
|
|
let target = event.target;
|
|
|
if (target != null) {
|
|
|
let realId = target.getAttribute(`data-dioxus-id`);
|
|
|
+ let shouldPreventDefault = target.getAttribute(
|
|
|
+ `dioxus-prevent-default`
|
|
|
+ );
|
|
|
+
|
|
|
+ if (event.type == "click") {
|
|
|
+ event.preventDefault();
|
|
|
+ if (shouldPreventDefault !== `onclick`) {
|
|
|
+ console.log("click", event);
|
|
|
+ console.log("clickeded", event.target);
|
|
|
+ console.log("clickeded", event.target.tagName);
|
|
|
+ if (target.tagName == "A") {
|
|
|
+ const href = target.getAttribute("href");
|
|
|
+ if (href !== "" && href !== null && href !== undefined) {
|
|
|
+ window.rpc.call("browser_open", { href });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// walk the tree to find the real element
|
|
|
while (realId == null && target.parentElement != null) {
|
|
|
target = target.parentElement;
|
|
|
realId = target.getAttribute(`data-dioxus-id`);
|
|
|
}
|
|
|
- const shouldPreventDefault = target.getAttribute(
|
|
|
+
|
|
|
+ shouldPreventDefault = target.getAttribute(
|
|
|
`dioxus-prevent-default`
|
|
|
);
|
|
|
+
|
|
|
let contents = serialize_event(event);
|
|
|
if (shouldPreventDefault === `on${event.type}`) {
|
|
|
event.preventDefault();
|
|
@@ -215,25 +236,6 @@ export class Interpreter {
|
|
|
if (event.type == "submit") {
|
|
|
event.preventDefault();
|
|
|
}
|
|
|
- if (event.type == "click") {
|
|
|
- event.preventDefault();
|
|
|
- if (shouldPreventDefault !== `onclick`) {
|
|
|
- if (target.tagName == "A") {
|
|
|
- const href = target.getAttribute("href");
|
|
|
- if (
|
|
|
- href !== "" &&
|
|
|
- href !== null &&
|
|
|
- href !== undefined &&
|
|
|
- realId != null
|
|
|
- ) {
|
|
|
- window.rpc.call("browser_open", {
|
|
|
- mounted_dom_id: parseInt(realId),
|
|
|
- href,
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
if (realId == null) {
|
|
|
return;
|
|
|
}
|