use the right index while adding clips to an edit
This commit is contained in:
parent
e02f1eb6df
commit
1702b37877
2 changed files with 17 additions and 2 deletions
|
@ -232,7 +232,12 @@ pandora.ui.editPanel = function() {
|
||||||
var clips = pandora.clipboard.paste();
|
var clips = pandora.clipboard.paste();
|
||||||
pandora.doHistory('paste', clips, ui.edit, function(result) {
|
pandora.doHistory('paste', clips, ui.edit, function(result) {
|
||||||
Ox.Request.clearCache('getEdit');
|
Ox.Request.clearCache('getEdit');
|
||||||
updateClips(edit.clips.concat(result.data.clips));
|
updateClips(edit.clips.map(function(clip) {
|
||||||
|
if (clip.index >= result.data.clips[0].index) {
|
||||||
|
clip.index += result.data.clips.length
|
||||||
|
}
|
||||||
|
return clip;
|
||||||
|
}).concat(result.data.clips));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
playing: function(data) {
|
playing: function(data) {
|
||||||
|
|
|
@ -413,7 +413,17 @@ 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: pandora.user.ui.edits[pandora.user.ui.edit].selection.length
|
||||||
|
? Ox.getObjectById(
|
||||||
|
pandora.$ui.editPanel.options('clips'),
|
||||||
|
pandora.user.ui.edits[pandora.user.ui.edit].selection[0]
|
||||||
|
).index
|
||||||
|
: void 0
|
||||||
|
}, function(result) {
|
||||||
// adding clips creates new ids, so mutate items in history
|
// adding clips creates new ids, so mutate items in history
|
||||||
items.splice.apply(items, [0, items.length].concat(getClipItems(result.data.clips)));
|
items.splice.apply(items, [0, items.length].concat(getClipItems(result.data.clips)));
|
||||||
callback(result, items);
|
callback(result, items);
|
||||||
|
|
Loading…
Reference in a new issue