Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(keyboard-shortcuts): support Ctrl+Alt modifier combos in registerShortcut
Hristo Terezov57b820f77fbb
diff --git a/react/features/keyboard-shortcuts/reducer.ts b/react/features/keyboard-shortcuts/reducer.tsindex fa78f5d386..a331dcedf7 100644--- a/react/features/keyboard-shortcuts/reducer.ts+++ b/react/features/keyboard-shortcuts/reducer.ts@@ -38,7 +38,16 @@ ReducerRegistry.register<IKeyboardShortcutsState>(STORE_NAME,enabled: false};case REGISTER_KEYBOARD_SHORTCUT: {- const shortcutKey = action.shortcut.alt ? `:${action.shortcut.character}` : action.shortcut.character;+ const { alt, character, ctrl } = action.shortcut;+ let shortcutKey = character;++ if (ctrl && alt) {+ shortcutKey = `-:${character}`;+ } else if (alt) {+ shortcutKey = `:${character}`;+ } else if (ctrl) {+ shortcutKey = `-${character}`;+ }return {...state,@@ -51,7 +60,15 @@ ReducerRegistry.register<IKeyboardShortcutsState>(STORE_NAME,};}case UNREGISTER_KEYBOARD_SHORTCUT: {- const shortcutKey = action.alt ? `:${action.character}` : action.character;+ let shortcutKey = action.character;++ if (action.ctrl && action.alt) {+ shortcutKey = `-:${action.character}`;+ } else if (action.alt) {+ shortcutKey = `:${action.character}`;+ } else if (action.ctrl) {+ shortcutKey = `-${action.character}`;+ }const shortcuts = new Map(state.shortcuts);shortcuts.delete(shortcutKey);diff --git a/react/features/keyboard-shortcuts/types.ts b/react/features/keyboard-shortcuts/types.tsindex 9807328fa9..4e9550a704 100644--- a/react/features/keyboard-shortcuts/types.ts+++ b/react/features/keyboard-shortcuts/types.ts@@ -6,6 +6,9 @@ export interface IKeyboardShortcut {// the character to be pressed that triggers the actioncharacter: string;+ // whether or not the ctrl key must be pressed+ ctrl?: boolean;+// the function to be executed when the shortcut is pressedhandler: Function;diff --git a/react/features/keyboard-shortcuts/utils.ts b/react/features/keyboard-shortcuts/utils.tsindex c7e628d5b4..a8a9408bff 100644--- a/react/features/keyboard-shortcuts/utils.ts+++ b/react/features/keyboard-shortcuts/utils.ts@@ -41,6 +41,10 @@ export const getKeyboardKey = (e: KeyboardEvent): string => {const replacedKey = code.replace('Key', '');+ if (ctrlKey && altKey) {+ return `-:${replacedKey}`;+ }+if (altKey) {return `:${replacedKey}`;}