mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-13 18:53:59 +02:00
Extract SlateReact hooks documentation onto its own page
This commit is contained in:
31
docs/libraries/slate-react/hooks.md
Normal file
31
docs/libraries/slate-react/hooks.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Slate React Hooks
|
||||
|
||||
React hooks for Slate editors
|
||||
|
||||
### `useFocused`
|
||||
|
||||
Get the current `focused` state of the editor.
|
||||
|
||||
### `useReadOnly`
|
||||
|
||||
Get the current `readOnly` state of the editor.
|
||||
|
||||
### `useSelected`
|
||||
|
||||
Get the current `selected` state of an element.
|
||||
|
||||
### `useSlate`
|
||||
|
||||
Get the current editor object from the React context. Re-renders the context whenever changes occur in the editor.
|
||||
|
||||
### `useSlateWithV`
|
||||
|
||||
The same as `useSlate()` but includes a version counter which you can use to prevent re-renders.
|
||||
|
||||
### `useSlateStatic`
|
||||
|
||||
Get the current editor object from the React context. A version of useSlate that does not re-render the context. Previously called `useEditor`.
|
||||
|
||||
### `useSlateSelection`
|
||||
|
||||
Get the current editor selection from the React context. Only re-renders when the selection changes.
|
Reference in New Issue
Block a user