File size: 318 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { createContext, useContext } from 'react'

/**
 * A React context for sharing the `focused` state of the editor.
 */

export const FocusedContext = createContext(false)

/**
 * Get the current `focused` state of the editor.
 */

export const useFocused = (): boolean => {
  return useContext(FocusedContext)
}