Michael Geary schrieb:
I'll tidy up the undo code to make a nice plugin release out of it, but there 
it is in case anyone wants to take a look at it now.
I'd be interested in any feedback on the issues I mentioned in my previous 
message. (I'd mentioned saving the undo/redo queue in a
hidden form field so it survives a soft reload, but now that I look at the 
code, it doesn't do that. Must have been something I was
thinking about doing. The code actually should work with either strings or 
objects or any type as the undo queue entries.)
Interesting stuff Mike! I can imagine quite a few scenarios where that could be used. For example I'm currently working on persisting the treeview plugin in a cookie. Pushing my serialized form to the undo-plugin would be really easy, and the persistence in a hidden field may be even the more appropiate approach in same cases.

You could make it an actual plugin that must start with the two buttons as the selected elements, something like this:

$.fn.undo = function() {
 var $undoBtn = this.eq(0), undoBtn = this[0];
 var $redoBtn = this.eq(1), redoBtn = this[1];
 ...
}

A bit of documentation about the options and the return value definitely help a lot.

-- Jörn

Reply via email to