1import { createContext, useContext } from "react"; 2 3/** 4 * A React context for sharing the `focused` state of the editor. 5 * WARNING: For efficiency purposes it doesn't cause the component to update 6 * when the state changes. 7 */ 8 9export const FocusedContext = createContext({ isFocused: false }); 10 11/** 12 * Get the current `focused` state of the editor. 13 */ 14 15export const useFocused = (): boolean => { 16 return useContext(FocusedContext).isFocused; 17}; 18 19