mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-12 02:03:59 +02:00
feat: add useComposing hook (#5695)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
15
packages/slate-react/src/hooks/use-composing.ts
Normal file
15
packages/slate-react/src/hooks/use-composing.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { createContext, useContext } from 'react'
|
||||
|
||||
/**
|
||||
* A React context for sharing the `composing` state of the editor.
|
||||
*/
|
||||
|
||||
export const ComposingContext = createContext(false)
|
||||
|
||||
/**
|
||||
* Get the current `composing` state of the editor.
|
||||
*/
|
||||
|
||||
export const useComposing = (): boolean => {
|
||||
return useContext(ComposingContext)
|
||||
}
|
Reference in New Issue
Block a user