Commit Graph

68 Commits

Author SHA1 Message Date
Oliver Sartun
3ef848ac25 The merge method now makes use of the unregisterAll method 2013-10-24 12:02:00 +02:00
Oliver Sartun
8938a0dc84 The check if an object is registered now happens in the objectRegistry
register and unregister are returning true now, if they successfully
register resp. unregister an object
2013-10-24 12:02:00 +02:00
Oliver Sartun
6ec2869cc8 defaults function added for globally changing/setting the UndoManager's default values 2013-10-24 12:02:00 +02:00
Oliver Sartun
b01f919b9a Feature: You can register objects on instantiation now
No need for calling the register method afterwards anymore. Pass an
array or a single object
2013-10-24 12:02:00 +02:00
Oliver Sartun
ab20281c58 The "change" UndoType now rightfully unsets added attributes on undo/redo 2013-10-24 12:02:00 +02:00
Oliver Sartun
65fead3ffa The UndoTypes function get the "options" object passed as the fourth argument instead of the UndoAction's data
This change can break compatibility with externally added UndoTypes
2013-10-24 12:02:00 +02:00
Oliver Sartun
3829003ad3 Comment slightly changed 2013-10-24 12:02:00 +02:00
Oliver Sartun
46bd67b72b Added method unregisterAll to unregister all registered objects 2013-10-24 12:01:59 +02:00
Oliver Sartun
1623d0be70 Added a whole lotta comments 2013-10-24 12:01:59 +02:00
Oliver Sartun
17c66ee928 Renamed "cycleIndex" into "magicCondensationIndex" and made the magicCondensation an Opt-In
By altering the default behaviour and making magicCondensation and
opt-in, this version of Backbone.Undo is not backward compatible anymore
2013-10-24 12:01:59 +02:00
Oliver Sartun
51a06f7bf1 Typo corrected
Jeez! Have I been asleep while writing that?
2013-09-23 11:48:43 +02:00
Oliver Sartun
a78d7c8bf8 Deeper integration of undoTypes-"condition"-function
Instead of getting called from within the "on"-function, the
"condition"-function now gets called by the addToStack function. That
way its better suitable for custom undoTypes or changed undoTypes, as
the authors of these undoTypes don't have to manually integrate it into
their implementation.
2013-07-06 17:01:28 +02:00
Oliver Sartun
7df7d2ae2f The undoTypes now have a "condition" function that is called in the "on"-Handler
The "condition" function gets called with the same arguments like the
"on" function. If it returns true, the "on" function continues and
creates the UndoAction-data. If it returns false, no UndoAction gets
created
2013-07-06 16:00:46 +02:00
Oliver Sartun
9fa2990957 Bugfix: The undoTypes-object is now stored/referenced per UndoAction 2013-07-06 15:54:51 +02:00
Oliver Sartun
33b05920ea Added the possibility to start tracking right away by passing {track: true} to the constructor 2013-06-30 16:57:04 +02:00
Oliver Sartun
5ddef62b54 Added tests for 'merge' and the objectRegistry 2013-06-29 19:48:15 +02:00
Oliver Sartun
32d3cf4e60 The objectRegistry and the ownedUndoTypes are now properties of the undoManager and not of the undoStack. This was necessary to get 'merge' running 2013-06-29 19:47:33 +02:00
Oliver Sartun
178d9ecb73 Bugfix: changingUndoType always took effect globally and never per instance. Fixed. 2013-06-29 19:45:46 +02:00
Oliver Sartun
878cea2009 Minor changes to JSDoc comments 2013-06-29 19:44:33 +02:00
Oliver Sartun
1cbb59690f Fixed bug in objectRegistry's 'get' function 2013-06-29 19:43:50 +02:00
Oliver Sartun
bf6cb099fd Documented the code by using JSDoc 2013-06-29 01:14:21 +02:00
Oliver Sartun
b2fd78e5d4 Repositioned the manipulateUndoType function 2013-06-29 01:14:21 +02:00
Oliver Sartun
dfef4d0390 Shortened the hasKey function by using _.all 2013-06-29 01:14:21 +02:00
Oliver Sartun
be360f87f9 Repositioned the slice function within the code 2013-06-29 01:14:21 +02:00
Oliver Sartun
e6c376b8c5 Updated Backbone.min.js 2013-06-28 16:34:31 +02:00
Oliver Sartun
17fe0732f7 Fixed bug in the ObjectRegistry's 'get' function that only returned objects which didn't had a cid 2013-06-28 16:27:48 +02:00
Oliver Sartun
fa9d20b085 Indented something for better legibility 2013-06-28 16:14:27 +02:00
Oliver Sartun
f77a949c20 Added merge function
The merge function enables to "merge" several undoManagers so that they
write on only one stack
2013-06-28 16:13:59 +02:00
Oliver Sartun
4bb3c1454d isAvailable("undo" / "redo") now returns wether there are actions in the stack to be undone / redone or not 2013-06-28 16:12:46 +02:00
Oliver Sartun
18bc3aaf6f The manager now triggers a Backbone-Event "undo" or "redo" after something was undone / redone 2013-06-28 16:11:37 +02:00
Oliver Sartun
bee60d6c65 Added a 'get' function to the ObjectRegistry to get a copy of the registered objects 2013-06-28 16:10:20 +02:00
Oliver Sartun
c580fc04c4 Explained the way the ObjectRegistry registeres objects in a lengthy comment 2013-06-28 16:09:14 +02:00
Oliver Sartun
63b52142c0 Increased the number of arguments the apply function uses 'call' for from 3 to 4 2013-06-28 16:08:36 +02:00
Oliver Sartun
2154f097e8 Corrected Minified version 2013-06-24 17:57:42 +02:00
Oliver Sartun
a37970a352 Removed Bug 2013-06-24 17:56:12 +02:00
Oliver Sartun
2edb5d0931 Updated Minified version 2013-06-24 18:55:32 +03:00
Oliver Sartun
8076868052 Added "addUndoType", "changeUndoType" and "removeUndoType" to manipulate the global and the local UndoTypes-Object 2013-06-24 17:25:19 +02:00
Oliver Sartun
5bb5a7de35 Minor changes or bugfixes 2013-06-21 19:16:24 +02:00
Oliver Sartun
ee6001983d Repositioned the definition of the "reset" UndoType 2013-06-21 19:16:03 +02:00
Oliver Sartun
674efa9507 Added possibility to have undoTypes per instance
Instead of one global UndoTypes object, every UndoManager now has the
possibility to have a custom UndoTypes object. The great thing: Nothing
changes for those who don't want to use a custom one. Global changes of
the undoTypes still take effect on all instances, just as changes on
one instance don't intermingle with the global object.
2013-06-21 19:13:31 +02:00
Oliver Sartun
dc8fb5dafd Added comment 2013-06-21 19:07:12 +02:00
Oliver Sartun
ce8e40c9e2 Added a sample 2013-05-28 20:32:30 +02:00
Oliver Sartun
e3f874236d Added uglified (compressed) version 2013-05-28 17:52:13 +02:00
Oliver Sartun
37a9a44a90 Formatting changes 2013-05-28 17:39:45 +02:00
Oliver Sartun
f74df3c85e Minor Change 2013-05-28 18:36:32 +03:00
Oliver Sartun
09ebfa61cb Explained addUndoType further 2013-05-28 17:04:20 +02:00
Oliver Sartun
d8cd371991 Minor changes 2013-05-28 16:53:46 +02:00
Oliver Sartun
7f9b2dbf3b Added .gitignore 2013-05-28 16:46:52 +02:00
Oliver Sartun
0987209695 Added License note 2013-05-28 16:46:20 +02:00
Oliver Sartun
a21cf13dd8 Definition of the "reset"-UndoType was placed before the "change"-definition to have all collection-related undo-Types together 2013-05-28 16:46:20 +02:00