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
This commit is contained in:
parent
3829003ad3
commit
65fead3ffa
@ -223,7 +223,7 @@
|
|||||||
function actionUndoRedo (which, action) {
|
function actionUndoRedo (which, action) {
|
||||||
var type = action.type, undoTypes = action.undoTypes, fn = !undoTypes[type] || undoTypes[type][which];
|
var type = action.type, undoTypes = action.undoTypes, fn = !undoTypes[type] || undoTypes[type][which];
|
||||||
if (_.isFunction(fn)) {
|
if (_.isFunction(fn)) {
|
||||||
fn(action.object, action.before, action.after, action);
|
fn(action.object, action.before, action.after, action.options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,17 +326,16 @@
|
|||||||
*/
|
*/
|
||||||
var UndoTypes = {
|
var UndoTypes = {
|
||||||
"add": {
|
"add": {
|
||||||
"undo": function (collection, ignore, model, data) {
|
"undo": function (collection, ignore, model, options) {
|
||||||
// Undo add = remove
|
// Undo add = remove
|
||||||
collection.remove(model, data.options);
|
collection.remove(model, options);
|
||||||
},
|
},
|
||||||
"redo": function (collection, ignore, model, data) {
|
"redo": function (collection, ignore, model, options) {
|
||||||
// Redo add = add
|
// Redo add = add
|
||||||
var options = data.options;
|
|
||||||
if (options.index) {
|
if (options.index) {
|
||||||
options.at = options.index;
|
options.at = options.index;
|
||||||
}
|
}
|
||||||
collection.add(model, data.options);
|
collection.add(model, options);
|
||||||
},
|
},
|
||||||
"on": function (model, collection, options) {
|
"on": function (model, collection, options) {
|
||||||
return {
|
return {
|
||||||
@ -348,15 +347,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"remove": {
|
"remove": {
|
||||||
"undo": function (collection, model, ignore, data) {
|
"undo": function (collection, model, ignore, options) {
|
||||||
var options = data.options;
|
if ("index" in options) {
|
||||||
if (options.index) {
|
|
||||||
options.at = options.index;
|
options.at = options.index;
|
||||||
}
|
}
|
||||||
collection.add(model, options);
|
collection.add(model, options);
|
||||||
},
|
},
|
||||||
"redo": function (collection, model, ignore, data) {
|
"redo": function (collection, model, ignore, options) {
|
||||||
collection.remove(model, data.options);
|
collection.remove(model, options);
|
||||||
},
|
},
|
||||||
"on": function (model, collection, options) {
|
"on": function (model, collection, options) {
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user