mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-06 23:36:31 +02:00
Add withHistory page to docs, reorganize the History docs in general and update Summary.md
This commit is contained in:
@@ -54,9 +54,10 @@
|
|||||||
## Libraries
|
## Libraries
|
||||||
|
|
||||||
- [Slate React](libraries/slate-react.md)
|
- [Slate React](libraries/slate-react.md)
|
||||||
- [Slate History](libraries/slate-history.md)
|
- [Slate History](libraries/slate-history/README.md)
|
||||||
- [History](/history/history.md)
|
- [withHistory](/libraries/slate-history/with-history.md)
|
||||||
- [HistoryEditor](/history/history-editor.md)
|
- [HistoryEditor](/libraries/slate-history/history-editor.md)
|
||||||
|
- [History](/libraries/slate-history/history.md)
|
||||||
- [Slate Hyperscript](libraries/slate-hyperscript.md)
|
- [Slate Hyperscript](libraries/slate-hyperscript.md)
|
||||||
|
|
||||||
## General
|
## General
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
# Slate History
|
|
||||||
|
|
||||||
This sub-library tracks changes to the Slate value state over time, and enables undo and redo functionality.
|
|
||||||
|
|
||||||
## `withHistory`
|
|
||||||
|
|
||||||
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`](../history/history-editor.md)
|
|
||||||
|
|
||||||
`HistoryEditor` is the Editor with history related methods and the `History` object property. It also contains static helpers for history-enabled editors.
|
|
||||||
|
|
||||||
## [`History`](../history/history.md)
|
|
||||||
|
|
||||||
`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.
|
|
7
docs/libraries/slate-history/README.md
Normal file
7
docs/libraries/slate-history/README.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Slate History
|
||||||
|
|
||||||
|
This sub-library tracks changes to the Slate value state over time, and enables undo and redo functionality.
|
||||||
|
|
||||||
|
- [withHistory](./with-history.md)
|
||||||
|
- [HistoryEditor](./history-editor.md)
|
||||||
|
- [History](./history.md)
|
13
docs/libraries/slate-history/with-history.md
Normal file
13
docs/libraries/slate-history/with-history.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# withHistory
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
#### `withHistory<T extends Editor>(editor: T): T & HistoryEditor`
|
||||||
|
|
||||||
|
Add `HistoryEditor` interface to an instance of any `Editor`.
|
||||||
|
|
||||||
|
When used with `withReact`, `withHistory` should be applied inside. For example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const [editor] = useState(() => withReact(withHistory(createEditor())))
|
||||||
|
```
|
Reference in New Issue
Block a user