mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-20 06:01:24 +02:00
Improve docs for the main page for SlateHistory with more descriptions
This commit is contained in:
@@ -2,20 +2,20 @@
|
||||
|
||||
This sub-library tracks changes to the Slate value state over time, and enables undo and redo functionality.
|
||||
|
||||
## `History`
|
||||
|
||||
`History` objects hold all of the operations that are applied to a value, so they can be undone or redone as necessary.
|
||||
|
||||
## `HistoryEditor`
|
||||
|
||||
`HistoryEditor` contains helpers for history-enabled editors.
|
||||
|
||||
## `withHistory`
|
||||
|
||||
The `withHistory` plugin keeps track of the operation history of a Slate editor as operations are applied to it, using undo and redo stacks.
|
||||
The `withHistory` plugin adds the `HistoryEditor` to an `Editor` instance and keeps track of the operation history of a Slate editor as operations are applied to it, using undo and redo stacks.
|
||||
|
||||
When used with `withReact`, `withHistory` should be applied inside. For example:
|
||||
|
||||
```javascript
|
||||
const [editor] = useState(() => withReact(withHistory(createEditor())))
|
||||
```
|
||||
|
||||
## `HistoryEditor`
|
||||
|
||||
`HistoryEditor` is the Editor with history related methods and the `History` object property. It also contains static helpers for history-enabled editors.
|
||||
|
||||
## `History`
|
||||
|
||||
`History` objects accessed at `editor.history` on a `HistoryEditor` holds all of the operations that are applied to a value, so they can be undone or redone as necessary.
|
||||
|
Reference in New Issue
Block a user