1
0
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:
Sunny Hirai
2023-04-12 22:20:54 -07:00
parent 083424eeb0
commit f80ecaf165
3 changed files with 40 additions and 39 deletions

View 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.