properly mutate history after adding clips

This commit is contained in:
rolux 2013-08-09 17:14:30 +00:00
parent ca75a1dc94
commit 620890389d

View file

@ -351,9 +351,6 @@ pandora.createLinks = function($element) {
} }
} }
function done(result, addedItems) { function done(result, addedItems) {
if (object.action == 'join' || object.action == 'split') {
object.items[1] = addedItems;
}
doneHistory(object, callback); doneHistory(object, callback);
} }
}; };
@ -376,9 +373,6 @@ pandora.createLinks = function($element) {
} }
} }
function done(result, addedItems) { function done(result, addedItems) {
if (object.action == 'join' || object.action == 'split') {
object.items[0] = addedItems;
}
doneHistory(object, callback); doneHistory(object, callback);
} }
}; };
@ -407,7 +401,9 @@ pandora.createLinks = function($element) {
}); });
} else { } else {
pandora.api.addClips({clips: getClipData(items), edit: target, index: 0}, function(result) { pandora.api.addClips({clips: getClipData(items), edit: target, index: 0}, function(result) {
callback(result, getClipItems(result.data.clips)); // adding clips creates new ids, so mutate items in history
items.splice.apply(items, [0, items.length].concat(getClipItems(result.data.clips)));
callback(result, items);
}); });
} }
} }