-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate getUndoEdit and getRedoEdit
- Loading branch information
1 parent
7ae67d8
commit 18733ea
Showing
7 changed files
with
63 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import type { State } from './selectors'; | ||
|
||
type Optional< T > = T | undefined; | ||
|
||
/** | ||
* Returns the previous edit from the current undo offset | ||
* for the entity records edits history, if any. | ||
* | ||
* @param state State tree. | ||
* | ||
* @return The edit. | ||
*/ | ||
export function getUndoEdits( state: State ): Optional< any > { | ||
return state.undo.list[ state.undo.list.length - 2 + state.undo.offset ]; | ||
} | ||
|
||
/** | ||
* Returns the next edit from the current undo offset | ||
* for the entity records edits history, if any. | ||
* | ||
* @param state State tree. | ||
* | ||
* @return The edit. | ||
*/ | ||
export function getRedoEdits( state: State ): Optional< any > { | ||
return state.undo.list[ state.undo.list.length + state.undo.offset ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters