Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/plotdb/ctrlz
JSON edit history manager for undo / redo functionality, powered by operational transform.
https://github.com/plotdb/ctrlz
operational-transformation
Last synced: about 2 months ago
JSON representation
JSON edit history manager for undo / redo functionality, powered by operational transform.
- Host: GitHub
- URL: https://github.com/plotdb/ctrlz
- Owner: plotdb
- Created: 2020-01-07T09:19:41.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T05:36:27.000Z (almost 2 years ago)
- Last Synced: 2024-08-09T12:19:18.134Z (5 months ago)
- Topics: operational-transformation
- Language: HTML
- Homepage: http://plotdb.github.io/ctrlz
- Size: 1010 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# ctrlz
JSON Edit History Manager for Undo / Redo Functionality, powered by operational transform. Keep state and support undo for anything that can be expressed / stored by JSON!
# Install
include required js file:
```
```ctrlz uses `@plotdb/json0` as a dependency. `ctrlz.bundle.min.js` already includes it but for a separate file, use `ctrlz.mins.js` instead, and include `@plotdb/json0` separately downloaded from [its repo](https://github.com/plotdb/json0).
## Usage
```
/* init directly in constructor */
mananger = new ctrlz({obj: obj});/* or alternatively, reset anytime after initialized */
manager.reset({obj: obj});/* when obj is updated */
manager.update(obj);/* if you have ot to apply: */
manager.apply({op: op});/* undo, return a undo-ed object */
ret = manager.undo();/* redo, return a redo-ed object */
ret = manager.redo();/* clean history */
mananger.clear();
```## License
MIT.