diff --git a/docs/Summary.md b/docs/Summary.md index 6185eac86..22c9f134c 100644 --- a/docs/Summary.md +++ b/docs/Summary.md @@ -54,6 +54,7 @@ - [Slate React](libraries/slate-react.md) - [Slate History](libraries/slate-history.md) + - [History](/history/history.md) - [Slate Hyperscript](libraries/slate-hyperscript.md) ## General diff --git a/docs/history/history.md b/docs/history/history.md new file mode 100644 index 000000000..e4522a3a6 --- /dev/null +++ b/docs/history/history.md @@ -0,0 +1,19 @@ +# History + +The `History` object contains the undo and redo history for the editor. + +```typescript +export interface History { + redos: Batch[] + undos: Batch[] +} + +interface Batch { + operations: Operation[] + selectionBefore: Range | null +} +``` + +It can be accessed from an `Editor` instance as the property `history`. + +This property is only available on the `Editor` if it was instantiated using the `withHistory` method which adds undo/redo functionality to the Slate editor.