From fea0638d9ad100c00b95468aa16fc44d6517ac0d Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Thu, 27 Oct 2022 15:42:15 +0200 Subject: [PATCH] feat: enable devtools in debug mode by default (#741) * feat: enable devtools in debug mode by default * fix docs --- .changes/devtools-debug-mode.md | 5 +++++ src/lib.rs | 2 +- src/webview/mod.rs | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .changes/devtools-debug-mode.md diff --git a/.changes/devtools-debug-mode.md b/.changes/devtools-debug-mode.md new file mode 100644 index 000000000..80ffb7192 --- /dev/null +++ b/.changes/devtools-debug-mode.md @@ -0,0 +1,5 @@ +--- +"wry": "patch" +--- + +Enabled devtools in debug mode by default. \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 528b7be3b..d0dfca1f0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -56,7 +56,7 @@ //! This feature requires either `libayatana-appindicator` or `libappindicator` package installed. //! You can still create those types if you disable it. They just don't create the actual objects. //! - `devtools`: Enables devtools on release builds. Devtools are always enabled in debug builds. -//! On **macOS**, enabling devtools, requires calling private apis so you should enabling this flag in release +//! On **macOS**, enabling devtools, requires calling private apis so you should not enable this flag in release //! build if your app needs to publish to App Store. //! - `transparent`: Transparent background on **macOS** requires calling private functions. //! Avoid this in release build if your app needs to publish to App Store. diff --git a/src/webview/mod.rs b/src/webview/mod.rs index 68bfd5e82..03b457c39 100644 --- a/src/webview/mod.rs +++ b/src/webview/mod.rs @@ -235,6 +235,9 @@ impl Default for WebViewAttributes { download_completed_handler: None, new_window_req_handler: None, clipboard: false, + #[cfg(debug_assertions)] + devtools: true, + #[cfg(not(debug_assertions))] devtools: false, zoom_hotkeys_enabled: false, accept_first_mouse: false, @@ -439,7 +442,7 @@ impl<'a> WebViewBuilder<'a> { self } - /// Enable web inspector which is usually called dev tool. + /// Enable or disable web inspector which is usually called dev tool. /// /// Note this only enables dev tool to the webview. To open it, you can call /// [`WebView::open_devtools`], or right click the page and open it from the context menu.