More Undo functionality

I'm very new to Zotero, but I've noticed that there aren't a lot of Undo options for common tasks. I may have been coddled by years of this being a common feature, but I'm a little surprised and disappointed that I may make accidental changes that I can't "Undo". This makes me hesitant to switch to using Zotero full-time.

For example:

  • Editing a field: Undo works as long as the cursor is in the field, but as soon as I hit "Return"/"Enter", those changes are committed, and can't be undone.
  • Moving items. I noticed that if items are deleted (move to Trash), they can be restored, but I have to go to the Trash, find the appropriate item, right-click, and select "Restore to Library". But, if I accidentally drag a child item from one item to another, There's no way to undo it!
  • Other things I just can't think of right now.

How much Undo support is already included? Are there limitations to the interface that prevent "Command/Control-Z" from triggering "Undo"? Is there a need for an "Undo" button in the toolbar to provide direct access to this feature, and have it greyed out when Undo is not available?

  • It's not an interface issue—Zotero just doesn't have any undo functionality currently. It'd obviously be good to have, but it's not trivial to implement.

    Cmd/Ctrl-Z within text areas is provided by Mozilla.
  • How would you implement undo functionality? Something like Photoshop's history panel? ( http://help.adobe.com/en_US/Photoshop/11.0/WSfd1234e1c4b69f30ea53e41001031ab64-7497a.html )
  • Thanks for the replies.

    Wow Rintze, that looks complicated. I'd be happy with being able to undo/redo changes to individual items in order (all since Zotero was started, or last save):

    • edit field (including tags, notes, etc.)
    • collections
    • move to trash
    • also changes to child items (parent item, contents, etc.)

    I can see how adding something like this would be non-trivial, but I have to say, the lack of undo capability is a bit of a deal-breaker for me. I think most users have just gotten used to having this ability, and I admit, I'm a little scared without it. It's the biggest thing stopping me from switching over from EndNote (as well as batch editing, but pyzotero looks like a promising short-term workaround for that).

    I know a little Javascript, and enough general programming to be dangerous, but very little about actual software development, or the best approach to actually add a feature like this. Is there anything I can contribute, or any way to help add this feature?

  • Undo feature is generally very difficult to implement properly if it has not been built into the data model of a software. Zotero does not have undo built into the data model, so including something like this would be a major change. To contribute to something like this you would need to know the Zotero code really well.
  • I admit, I don't have anywhere near that kind of time at the moment, sorry :(

    However, looking at the sample plugin, would it be feasible to something like this?:

    • Add an event listener (as in the sample plugin) to monitor changes
    • keep track of changes as they are made, in such a way that they can be reversed
      • e.g. store a copy of items as they were prior to each change
      • stored in order (or a 'stack' of changes).

    Then, you would just need an interface to reverse (undo) or re-apply (redo) each change in sequence, maybe even with a way to display a summary of changes in sequence: akin to the 'Photoshop history panel', though maybe a simpler version, like lists under undo/redo buttons.

    I appreciate that the data model isn't currently designed for undo, although I strongly urge the developers to consider adding this to any planned changes. Nevertheless, if I can come up with a workaround, even a simple unoptimized plugin, it would make me very happy.

  • We started to build undo functionality into Zotero 1.0, but it was never finished and was dropped due to its complexity.

    It will probably happen eventually, but it's not on the immediate roadmap.

    As mronkko says, I think one would need to have a pretty deep understanding of Zotero's internals to implement this well. In terms of a plugin, I'm not sure whether the current state of the notifier (as used in the sample plugin) could support this, though you could certainly experiment. (I would say, though, that even your proposed version is far more complicated than necessary—a single-level undo would be much easier to implement, safer to use, and sufficient for the vast majority of cases.)
  • Well, I started with the sample plugin, to see what I could do, but I realized I don't really understand how the Notifier system works well enough to know what's possible. Should I go ask at zotero-dev, or can someone suggest where to look in the code to get a better idea of what's possible and how to do it?

    I did find some documentation, but it says that the "JavaScript API is under-documented". I poked around the code on gitHub, and did find some interesting bits in notifier.js, and history.js, but I'm not sure how any of it connects to the way data is passed to the Callback function in a plugin itself.

    I'd be happy to try to experiment a little in my free time, but at this point, I'm not really sure where to start, and I think I'm in a little over my head.

  • As you suggest yourself, you should post to zotero-dev to get help about development related issues.
  • jawhiteley speaks above of "pyzotero" as a workaround for batch changes. What is it? I could nowehere find anything about it. I have been asking for batch changes forever, and if this is a workaround, please make it more widely known.

    best
    m
  • Unless you know Python and want to work with the server API, it's not for you. And it's circuitous at best anyway.

    But see this: http://forums.zotero.org/discussion/7707/#Item_16
Sign In or Register to comment.