Ver código fonte

Enable External Links Without Modifier (#2983)

* make external links usable without modifier

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
Leon Wimbes 7 meses atrás
pai
commit
e7e624f05e
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3 3
      packages/router/src/components/link.rs

+ 3 - 3
packages/router/src/components/link.rs

@@ -198,13 +198,13 @@ pub fn Link(props: LinkProps) -> Element {
         if !event.modifiers().is_empty() {
             return;
         }
-        // only handle left clicks
+        // Only handle left clicks
         if event.trigger_button() != Some(dioxus_elements::input_data::MouseButton::Primary) {
             return;
         }
 
         // todo(jon): this is extra hacky for no reason - we should fix prevent default on Links
-        if do_default && is_external && cfg!(target_arch = "wasm32") {
+        if do_default && is_external {
             return;
         }
 
@@ -232,7 +232,7 @@ pub fn Link(props: LinkProps) -> Element {
         // If the event is a click with the left mouse button and no modifiers, prevent the default action
         // and navigate to the href with client side routing
         router.include_prevent_default().then_some(
-            "if (event.button === 0 && !event.ctrlKey && !event.metaKey && !event.shiftKey && !event.altKey) { event.preventDefault() }"   
+            "if (event.button === 0 && !event.ctrlKey && !event.metaKey && !event.shiftKey && !event.altKey) { event.preventDefault() }"
         )
     };