mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-01-17 13:38:37 +01:00
Extract SlateReact hooks documentation onto its own page
This commit is contained in:
parent
083424eeb0
commit
f80ecaf165
@ -53,13 +53,14 @@
|
||||
|
||||
## Libraries
|
||||
|
||||
- [Slate React](/libraries/slate-react/README.md)
|
||||
- [withReact](/libraries/slate-react/with-react.md)
|
||||
- [ReactEditor](/libraries/slate-react/react-editor.md)
|
||||
- [Slate History](/libraries/slate-history/README.md)
|
||||
- [withHistory](/libraries/slate-history/with-history.md)
|
||||
- [HistoryEditor](/libraries/slate-history/history-editor.md)
|
||||
- [History](/libraries/slate-history/history.md)
|
||||
- [Slate React](libraries/slate-react/README.md)
|
||||
- [withReact](libraries/slate-react/with-react.md)
|
||||
- [ReactEditor](libraries/slate-react/react-editor.md)
|
||||
- [Hooks](libraries/slate-react/hooks.md)
|
||||
- [Slate History](libraries/slate-history/README.md)
|
||||
- [withHistory](libraries/slate-history/with-history.md)
|
||||
- [HistoryEditor](libraries/slate-history/history-editor.md)
|
||||
- [History](libraries/slate-history/history.md)
|
||||
- [Slate Hyperscript](libraries/slate-hyperscript.md)
|
||||
|
||||
## General
|
||||
|
@ -4,6 +4,7 @@ This sub-library contains the React-specific logic for Slate.
|
||||
|
||||
- [withReact](./with-react.md)
|
||||
- [ReactEditor](./react-editor.md)
|
||||
- [Hooks](./hooks.md)
|
||||
|
||||
## Components
|
||||
|
||||
@ -79,38 +80,6 @@ The default custom leaf renderer.
|
||||
|
||||
A wrapper around the provider to handle `onChange` events, because the editor is a mutable singleton so it won't ever register as "changed" otherwise.
|
||||
|
||||
## 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.
|
||||
|
||||
## Plugins
|
||||
|
||||
React-specific plugins for Slate editors
|
||||
|
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.
|
Loading…
x
Reference in New Issue
Block a user