From 2d21f7ade1d90d3e157b6e63dffd1353dcbba339 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Wed, 1 Mar 2023 13:32:13 -0600 Subject: [PATCH] add a shortcut for ctrl-r to prevent it breaking the application --- packages/desktop/src/shortcut.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/desktop/src/shortcut.rs b/packages/desktop/src/shortcut.rs index 9b36a5638..cf70d307a 100644 --- a/packages/desktop/src/shortcut.rs +++ b/packages/desktop/src/shortcut.rs @@ -41,10 +41,17 @@ impl Shortcut { impl ShortcutRegistry { pub fn new(target: &EventLoopWindowTarget) -> Self { - Self { + let myself = Self { manager: Rc::new(RefCell::new(ShortcutManager::new(target))), shortcuts: Rc::new(RefCell::new(HashMap::new())), - } + }; + // prevent CTRL+R from reloading the page which breaks apps + let _ = myself.add_shortcut( + Some(ModifiersState::CONTROL), + KeyCode::KeyR, + Box::new(|| {}), + ); + myself } pub(crate) fn call_handlers(&self, id: AcceleratorId) {