Pergunta

does exist a library that gives you undo/redo capability with history for a web app? An idea would be a php/javascript/ajax system in which you can register for every user action an opposite action and the variable state (like a normal undo manager!). and it should work both at client level and server level.

Did i ask too much?

Foi útil?

Solução

https://github.com/jscott1989/jsundoable is pretty good. Flexible. You can use http://www.openjs.com/scripts/events/keyboard_shortcuts to attach the shortcut key

The thing I like about this one is the group facility. You implement the undo functionality at the lowest levels possible and then in the higher functions, you don't have to bother about any of the undoing, just group each discrete action under a different group. I find this extremely intuitive since logically, if u reverse every small action that you take, then the whole process will be flawlessly reversed.

It is also very easy to merge into an existing project since I have just recently done so to a large code of mine that handles a lot of DOM manipulations and processing.

Outras dicas

Some pretty good link that might interest you as well:

Undo.js

Undo.js provides an abstraction for undoing and redoing any task. 
It can run both in the browser and on the server (targetted at node.js).

Checkout their demos:

https://github.com/jzaefferer/undo

http://jzaefferer.github.com/undo/demos/

http://jzaefferer.github.com/undo/demos/contenteditable.html

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top