diff --git a/packages/desktop/src/index.html b/packages/desktop/src/index.html index e244b6faa..292a1ae6a 100644 --- a/packages/desktop/src/index.html +++ b/packages/desktop/src/index.html @@ -1,15 +1,15 @@ - - Dioxus app - - - -
- - + + Dioxus app + + + +
+ + diff --git a/packages/desktop/src/lib.rs b/packages/desktop/src/lib.rs index 197735ddc..4d204a378 100644 --- a/packages/desktop/src/lib.rs +++ b/packages/desktop/src/lib.rs @@ -174,7 +174,25 @@ pub fn launch_with_props( } if cfg!(debug_assertions) { + // in debug, we are okay with the reload menu showing and dev tool webview = webview.with_dev_tool(true); + } else { + // in release mode, we don't want to show the dev tool or reload menus + webview = webview.with_initialization_script( + r#" + if (document.addEventListener) { + document.addEventListener('contextmenu', function(e) { + alert("You've tried to open context menu"); + e.preventDefault(); + }, false); + } else { + document.attachEvent('oncontextmenu', function() { + alert("You've tried to open context menu"); + window.event.returnValue = false; + }); + } + "#, + ) } desktop.webviews.insert(window_id, webview.build().unwrap());