1
0
Эх сурвалжийг харах

add a shortcut for ctrl-r to prevent it breaking the application

Evan Almloff 2 жил өмнө
parent
commit
2d21f7ade1

+ 9 - 2
packages/desktop/src/shortcut.rs

@@ -41,10 +41,17 @@ impl Shortcut {
 
 impl ShortcutRegistry {
     pub fn new<T>(target: &EventLoopWindowTarget<T>) -> 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) {