feat: it works everywhere
This commit is contained in:
1 parent
b4923b2b81
commit
84959a7826
5 files changed
+40
-545
No files matched your search
@@ -248,6 +248,19 @@ export class Interpreter {
|
||||
|
||||
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`) {
|
||||
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) {
|
||||
@@ -255,7 +268,7 @@ export class Interpreter {
|
||||
realId = target.getAttribute(`data-dioxus-id`);
|
||||
}
|
||||
|
||||
const shouldPreventDefault = target.getAttribute(`dioxus-prevent-default`);
|
||||
shouldPreventDefault = target.getAttribute(`dioxus-prevent-default`);
|
||||
|
||||
let contents = serialize_event(event);
|
||||
|
||||
@@ -267,20 +280,6 @@ export class Interpreter {
|
||||
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;
|
||||
|
||||
Reference in new issue
Block a user