FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

plotdb/ctrlz at v0.1.0 · GitHub

/ ctrlz Public

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

    <script src="path-to-your-ctrlz-bundle.js"></script>

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.

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.

About

JSON edit history manager for undo / redo functionality, powered by operational transform.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages


Back | FazBrowse Home | New Git URL