mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-28 09:29:49 +02:00
Add properties hasUndo and hasRedo to State (#193)
* Add properties hasUndo and hasRedo to State * Fix description fo hadRedo
This commit is contained in:
committed by
Ian Storm Taylor
parent
dca2efca0f
commit
b2c1b844af
@@ -22,6 +22,8 @@ For convenience, in addition to transforms, many of the [`Selection`](./selectio
|
|||||||
- [`fragment`](#fragment)
|
- [`fragment`](#fragment)
|
||||||
- [`inlines`](#inlines)
|
- [`inlines`](#inlines)
|
||||||
- [`texts`](#texts)
|
- [`texts`](#texts)
|
||||||
|
- [`hasUndo`](#hasundo)
|
||||||
|
- [`hasRedo`](#hasredo)
|
||||||
- [Selection-like Properties](#selection-like-properties)
|
- [Selection-like Properties](#selection-like-properties)
|
||||||
- [`{edge}Key`](#edgekey)
|
- [`{edge}Key`](#edgekey)
|
||||||
- [`{edge}Offset`](#edgeoffset)
|
- [`{edge}Offset`](#edgeoffset)
|
||||||
@@ -97,6 +99,15 @@ Get a list of the lowest-depth [`Inline`](./inline.md) nodes in the current sele
|
|||||||
|
|
||||||
Get a list of the [`Text`](./text.md) nodes in the current selection.
|
Get a list of the [`Text`](./text.md) nodes in the current selection.
|
||||||
|
|
||||||
|
### `hasUndo`
|
||||||
|
`Boolean`
|
||||||
|
|
||||||
|
Whether there are undoable events.
|
||||||
|
|
||||||
|
### `hasRedo`
|
||||||
|
`Boolean`
|
||||||
|
|
||||||
|
Whether there are redoable events.
|
||||||
|
|
||||||
## Selection-like Properties
|
## Selection-like Properties
|
||||||
|
|
||||||
|
@@ -58,6 +58,26 @@ class State extends new Record(DEFAULTS) {
|
|||||||
return 'state'
|
return 'state'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is there undoable events?
|
||||||
|
*
|
||||||
|
* @return {Boolean} hasUndo
|
||||||
|
*/
|
||||||
|
|
||||||
|
get hasUndo() {
|
||||||
|
return this.history.undos.size > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is there redoable events?
|
||||||
|
*
|
||||||
|
* @return {Boolean} hasRedo
|
||||||
|
*/
|
||||||
|
|
||||||
|
get hasRedo() {
|
||||||
|
return this.history.redos.size > 0
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the current selection blurred?
|
* Is the current selection blurred?
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user