Format with Prettier
This commit is contained in:
		
					parent
					
						
							
								56bd54a645
							
						
					
				
			
			
				commit
				
					
						1184b71396
					
				
			
		
					 1 changed files with 9 additions and 10 deletions
				
			
		| 
						 | 
					@ -24,9 +24,12 @@ import { useEventTarget } from "./useEvents";
 | 
				
			||||||
 * element (specifically, if an ancestor or descendant of it is focused).
 | 
					 * element (specifically, if an ancestor or descendant of it is focused).
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
const mayReceiveKeyEvents = (e: HTMLElement): boolean => {
 | 
					const mayReceiveKeyEvents = (e: HTMLElement): boolean => {
 | 
				
			||||||
  const focusedElement = document.activeElement
 | 
					  const focusedElement = document.activeElement;
 | 
				
			||||||
  return focusedElement !== null && (focusedElement.contains(e) || e.contains(focusedElement))
 | 
					  return (
 | 
				
			||||||
}
 | 
					    focusedElement !== null &&
 | 
				
			||||||
 | 
					    (focusedElement.contains(e) || e.contains(focusedElement))
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function useCallViewKeyboardShortcuts(
 | 
					export function useCallViewKeyboardShortcuts(
 | 
				
			||||||
  focusElement: RefObject<HTMLElement | null>,
 | 
					  focusElement: RefObject<HTMLElement | null>,
 | 
				
			||||||
| 
						 | 
					@ -44,7 +47,7 @@ export function useCallViewKeyboardShortcuts(
 | 
				
			||||||
    "keydown",
 | 
					    "keydown",
 | 
				
			||||||
    useCallback(
 | 
					    useCallback(
 | 
				
			||||||
      (event: KeyboardEvent) => {
 | 
					      (event: KeyboardEvent) => {
 | 
				
			||||||
        if (focusElement.current === null) return
 | 
					        if (focusElement.current === null) return;
 | 
				
			||||||
        if (!mayReceiveKeyEvents(focusElement.current)) return;
 | 
					        if (!mayReceiveKeyEvents(focusElement.current)) return;
 | 
				
			||||||
        // Check if keyboard shortcuts are enabled
 | 
					        // Check if keyboard shortcuts are enabled
 | 
				
			||||||
        const keyboardShortcuts = getSetting("keyboard-shortcuts", true);
 | 
					        const keyboardShortcuts = getSetting("keyboard-shortcuts", true);
 | 
				
			||||||
| 
						 | 
					@ -59,11 +62,7 @@ export function useCallViewKeyboardShortcuts(
 | 
				
			||||||
          setMicrophoneMuted(false);
 | 
					          setMicrophoneMuted(false);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      [
 | 
					      [toggleLocalVideoMuted, toggleMicrophoneMuted, setMicrophoneMuted]
 | 
				
			||||||
        toggleLocalVideoMuted,
 | 
					 | 
				
			||||||
        toggleMicrophoneMuted,
 | 
					 | 
				
			||||||
        setMicrophoneMuted,
 | 
					 | 
				
			||||||
      ]
 | 
					 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -72,7 +71,7 @@ export function useCallViewKeyboardShortcuts(
 | 
				
			||||||
    "keyup",
 | 
					    "keyup",
 | 
				
			||||||
    useCallback(
 | 
					    useCallback(
 | 
				
			||||||
      (event: KeyboardEvent) => {
 | 
					      (event: KeyboardEvent) => {
 | 
				
			||||||
        if (focusElement.current === null) return
 | 
					        if (focusElement.current === null) return;
 | 
				
			||||||
        if (!mayReceiveKeyEvents(focusElement.current)) return;
 | 
					        if (!mayReceiveKeyEvents(focusElement.current)) return;
 | 
				
			||||||
        // Check if keyboard shortcuts are enabled
 | 
					        // Check if keyboard shortcuts are enabled
 | 
				
			||||||
        const keyboardShortcuts = getSetting("keyboard-shortcuts", true);
 | 
					        const keyboardShortcuts = getSetting("keyboard-shortcuts", true);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue