Doc fixes, running examples instructions, change menubar behavior for desktop

This commit is contained in:
Jonathan Kelley 2024-03-27 17:57:05 -07:00
parent 537f064001
commit 329c323b35
No known key found for this signature in database
GPG key ID: 1FBB50F7EB0A08BE
3 changed files with 29 additions and 17 deletions

View file

@ -219,6 +219,10 @@ Dioxus has grown from a side project to a small team of fulltime engineers. Than
</table>
</div>
## Running the examples
The examples in the top level of this repository can be run with `cargo run --example <example>`. However, we encourage you to download the dioxus-cli and run the examples with `dx serve` since many examples also support web. When running for web, you either need to modify the Cargo.toml to disable the default desktop feature, or use
## Dioxus vs other frameworks
We love all frameworks and enjoy watching innovation in the Rust ecosystem. In fact, many of our projects are shared with other frameworks. For example, our flex-box library [Taffy](https://github.com/DioxusLabs/taffy) is used by [Bevy](https://bevyengine.org/), [Zed](https://zed.dev/), [Lapce](https://lapce.dev/), [Iced](https://github.com/iced-rs/iced), and many more.

View file

@ -63,7 +63,7 @@ impl App {
webviews: HashMap::new(),
control_flow: ControlFlow::Wait,
unmounted_dom: Cell::new(Some(virtual_dom)),
float_all: cfg!(debug_assertions),
float_all: !cfg!(debug_assertions),
cfg: Cell::new(Some(cfg)),
shared: Rc::new(SharedContext {
event_handlers: WindowEventHandlers::default(),

View file

@ -88,28 +88,36 @@ mod desktop_platforms {
])
.unwrap();
let help_menu = Submenu::new("Help", true);
help_menu
.append_items(&[&MenuItem::new("Toggle Developer Tools", true, None)])
.unwrap();
menu.append_items(&[&window_menu, &edit_menu]).unwrap();
// By default we float the window on top in dev mode, but let the user disable it
help_menu
.append_items(&[&MenuItem::with_id(
"dioxus-float-top",
"Float on Top (dev mode only)",
true,
None,
)])
.unwrap();
if cfg!(debug_assertions) {
let help_menu = Submenu::new("Help", true);
menu.append_items(&[&window_menu, &edit_menu, &help_menu])
.unwrap();
help_menu
.append_items(&[&MenuItem::new("Toggle Developer Tools", true, None)])
.unwrap();
// By default we float the window on top in dev mode, but let the user disable it
help_menu
.append_items(&[&MenuItem::with_id(
"dioxus-float-top",
"Float on Top (dev mode only)",
true,
None,
)])
.unwrap();
_ = menu.append_items(&[&help_menu]);
#[cfg(target_os = "macos")]
{
help_menu.set_as_help_menu_for_nsapp();
}
}
#[cfg(target_os = "macos")]
{
window_menu.set_as_windows_menu_for_nsapp();
help_menu.set_as_help_menu_for_nsapp();
}
menu